clan::Canvas Class Reference - ClanLib SDK
Description: clan::Canvas Class Reference

Public Member Functions | Friends | List of all members
clan::Canvas Class Reference
clanDisplay Display

2D Graphics Canvas More...

`#include <canvas.h>`

## Public Member Functions
| Canvas ()
| Constructs a null instance.
| Canvas (Canvas &canvas, FrameBuffer &framebuffer)
| Constructs a Canvas based on a framebuffer. (based on the copy of the canvas)
| Canvas (DisplayWindow &window)
| Constructs a Canvas.
| ~Canvas ()
void | clear (const Colorf &color=StandardColorf::black())
| Clears the whole context using the specified color.
void | clear_depth (float value=0)
| Clear the depth buffer.
void | clear_stencil (int value=0)
| Clear the stencil buffer.
Canvas | create ()
| Create a copy of a canvas.
void | draw_box (const Pointf &start, const Pointf &end, const Colorf &color=StandardColorf::white())
| Box.
void | draw_box (const Rectf &rect, const Colorf &color)
| Box.
void | draw_box (float x1, float y1, float x2, float y2, const Colorf &color=StandardColorf::white())
| Draw a box / rectangle.
void | draw_line (const LineSegment2f &line_segment, const Colorf &color=StandardColorf::white())
| Line.
void | draw_line (const Pointf &start, const Pointf &end, const Colorf &color=StandardColorf::white())
| Line.
void | draw_line (float x1, float y1, float x2, float y2, const Colorf &color=StandardColorf::white())
| Draw a line.
void | draw_line_strip (const Vec2f *positions, int num_vertices, const Colorf &color=StandardColorf::white())
| Line Strip.
void | draw_lines (const Vec2f *line_positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf &line_color=StandardColorf::white())
| Lines.
void | draw_lines (const Vec2f *positions, int num_vertices, const Colorf &color=StandardColorf::white())
| Lines.
void | draw_point (const Pointf &point, const Colorf &color)
| Point.
void | draw_point (float x1, float y1, const Colorf &color)
| Draw a point.
void | fill_circle (const Pointf &center, const Pointf &centergradient, float radius, const Gradient &gradient)
| Gradient circle.
void | fill_circle (const Pointf &center, float radius, const Colorf &color=StandardColorf::white())
| Circle.
void | fill_circle (const Pointf &center, float radius, const Gradient &gradient)
| Gradient circle.
void | fill_circle (float center_x, float center_y, float radius, const Colorf &color=StandardColorf::white())
| Draw a circle.
void | fill_ellipse (const Pointf &center, float radius_x, float radius_y, const Colorf &color=StandardColorf::white())
| Draw a filled ellipse.
void | fill_ellipse (const Pointf &center, float radius_x, float radius_y, const Gradient &gradient)
| Draw a gradient filled ellipse.
void | fill_rect (const Pointf &start, const Pointf &end, const Colorf &color=StandardColorf::white())
| Fill.
void | fill_rect (const Pointf &start, const Pointf &end, const Gradient &gradient)
| Gradient fill.
void | fill_rect (const Rectf &rect, const Colorf &color)
| Fill.
void | fill_rect (const Rectf &rect, const Gradient &gradient)
| Gradient fill.
void | fill_rect (float x1, float y1, float x2, float y2, const Colorf &color=StandardColorf::white())
| Draw a filled box / rectangle.
void | fill_rect (float x1, float y1, float x2, float y2, const Gradient &color)
| Gradient fill.
void | fill_triangle (const Pointf &a, const Pointf &b, const Pointf &c, const Colorf &color=StandardColorf::white())
| Draw a triangle.
void | fill_triangle (const Trianglef &dest_triangle, const Colorf &color=StandardColorf::white())
| Draw a triangle.
void | fill_triangles (const std::vector< Vec2f > &positions, const std::vector< Vec2f > &texture_positions, const Texture2D &texture, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &positions, const std::vector< Vec2f > &texture_positions, const Texture2D &texture, const std::vector< Colorf > &colors)
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Gradient &gradient)
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Rect &texture_rect, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Rect &texture_rect, const Gradient &gradient)
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &triangles, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &triangles, const Colorf *colors)
| Draw triangles.
void | fill_triangles (const std::vector< Vec2f > &triangles, const Gradient &gradient)
| Draw triangles.
void | fill_triangles (const Vec2f *positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const Vec2f *positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf *colors)
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, const Colorf *colors, int num_vertices)
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Gradient &gradient)
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Gradient &gradient)
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Rect &texture_rect, const Colorf &color=StandardColorf::white())
| Draw triangles.
void | fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Rect &texture_rect, const Gradient &gradient)
| Draw triangles.
void | flush ()
| Flushes the render batcher currently active.
Rectf | get_cliprect () const
| Returns the current clipping rectangle.
GraphicContext & | get_gc () const
| Get gc.
float | get_height () const
| Returns the current height of the context.
Mat4f & | get_inverse_transform ()
| Returns the inverse of the current effective transform matrix.
float | get_pixel_ratio () const
PixelBuffer | get_pixeldata (const Rect &rect, TextureFormat texture_format=TextureFormat::rgba8, bool clamp=true)
| Return the content of the read buffer into a pixel buffer.
PixelBuffer | get_pixeldata (TextureFormat texture_format=TextureFormat::rgba8, bool clamp=true)
| Return the content of the read buffer into a pixel buffer.
const Mat4f & | get_projection () const
| Returns the current effective projection matrix.
Sizef | get_size () const
| Returns the current size of the context.
const Mat4f & | get_transform () const
| Returns the current effective transform matrix.
float | get_width () const
| Returns the current width of the context.
Pointf | grid_fit (const Pointf &pos)
| Snaps the point to the nearest pixel corner.
bool | is_null () const
| Returns true if this object is invalid.
void | mult_transform (const Mat4f &matrix)
| Multiplies the passed matrix onto the transform matrix.
| operator bool () const
| operator GraphicContext & () const
void | pop_cliprect ()
| Pop current clipping rectangle from the stack.
void | push_cliprect ()
| Push cliprect.
void | push_cliprect (const Rectf &rect)
| Push current clipping rectangle to stack.
void | reset_blend_state ()
| Set active blend state.
void | reset_cliprect ()
| Removes the set clipping rectangle and empties the cliprect stack.
void | reset_depth_stencil_state ()
| Set active depth stencil state.
void | reset_rasterizer_state ()
| Set active rasterizer state.
void | set_batcher (RenderBatcher *batcher)
| Specifies which render batcher is to be currently active.
void | set_blend_state (const BlendState &state, const Colorf &blend_color=StandardColorf::white(), unsigned int sample_mask=0xffffffff)
| Set active blend state.
void | set_cliprect (const Rectf &rect)
| Set the current clipping rectangle.
void | set_depth_stencil_state (const DepthStencilState &state, int stencil_ref=0)
| Set active depth stencil state.
void | set_map_mode (MapMode mode)
| Set the projection mapping mode.
void | set_program_object (StandardProgram standard_program)
| Set active program object to the standard program specified.
void | set_projection (const Mat4f &matrix)
| Set the projection matrix to be used in user projection map mode.
void | set_rasterizer_state (const RasterizerState &state)
| Set active rasterizer state.
void | set_transform (const Mat4f &matrix)
| Sets the transform matrix to a new matrix.
void | set_viewport (const Rectf &viewport)
void | throw_if_null () const
| Throw an exception if this object is invalid.

## Friends
class | Font_DrawFlat
class | Font_DrawScaled
class | Font_DrawSubPixel
class | Font_Impl
class | Image
class | Path
class | Sprite_Impl

## Detailed Description

2D Graphics Canvas

## Constructor & Destructor Documentation

## ◆ Canvas() [1/3]

clan::Canvas::Canvas | ( |  | ) |

Constructs a null instance.

Referenced by Canvas(), and create().

## ◆ Canvas() [2/3]

clan::Canvas::Canvas | ( | Canvas & | canvas,
|  | FrameBuffer & | framebuffer )

Constructs a Canvas based on a framebuffer. (based on the copy of the canvas)

References Canvas().

## ◆ Canvas() [3/3]

clan::Canvas::Canvas | ( | DisplayWindow & | window | ) |
| explicit

Constructs a Canvas.

## ◆ ~Canvas()

clan::Canvas::~Canvas | ( |  | ) |

## Member Function Documentation

## ◆ clear()

void clan::Canvas::clear | ( | const Colorf & | color = StandardColorf::black() | ) |

Clears the whole context using the specified color.

References clan::StandardColorf::black(), and clan::color.

## ◆ clear_depth()

void clan::Canvas::clear_depth | ( | float | value = 0 | ) |

Clear the depth buffer.

Parameters

  value | value to clear to. Range 0.0 - 1.0.

## ◆ clear_stencil()

void clan::Canvas::clear_stencil | ( | int | value = 0 | ) |

Clear the stencil buffer.

Parameters

  value | value to clear to.

## ◆ create()

Canvas clan::Canvas::create | ( |  | ) |

Create a copy of a canvas.

References Canvas().

## ◆ draw_box() [1/3]

void clan::Canvas::draw_box | ( | const Pointf & | start,
|  | const Pointf & | end,
|  | const Colorf & | color = StandardColorf::white() )

Box.

Parameters

  gc | = Graphic Context
  start | = Pointf
  end | = Pointf
  color | = Colorf

References clan::color, clan::end, and clan::StandardColorf::white().

## ◆ draw_box() [2/3]

void clan::Canvas::draw_box | ( | const Rectf & | rect,
|  | const Colorf & | color )

Box.

Parameters

  gc | = Graphic Context
  rect | = Rectf
  color | = Colorf

References clan::color.

## ◆ draw_box() [3/3]

void clan::Canvas::draw_box | ( | float | x1,
|  | float | y1,
|  | float | x2,
|  | float | y2,
|  | const Colorf & | color = StandardColorf::white() )

Draw a box / rectangle.

References clan::color, and clan::StandardColorf::white().

## ◆ draw_line() [1/3]

void clan::Canvas::draw_line | ( | const LineSegment2f & | line_segment,
|  | const Colorf & | color = StandardColorf::white() )

Line.

Parameters

  gc | = Graphic Context
  line_segment | = The line
  color | = Colorf

References clan::color, and clan::StandardColorf::white().

## ◆ draw_line() [2/3]

void clan::Canvas::draw_line | ( | const Pointf & | start,
|  | const Pointf & | end,
|  | const Colorf & | color = StandardColorf::white() )

Line.

Parameters

  gc | = Graphic Context
  start | = Pointf
  end | = Pointf
  color | = Colorf

References clan::color, clan::end, and clan::StandardColorf::white().

## ◆ draw_line() [3/3]

void clan::Canvas::draw_line | ( | float | x1,
|  | float | y1,
|  | float | x2,
|  | float | y2,
|  | const Colorf & | color = StandardColorf::white() )

Draw a line.

References clan::color, and clan::StandardColorf::white().

## ◆ draw_line_strip()

void clan::Canvas::draw_line_strip | ( | const Vec2f * | positions,
|  | int | num_vertices,
|  | const Colorf & | color = StandardColorf::white() )

Line Strip.

References clan::color, and clan::StandardColorf::white().

## ◆ draw_lines() [1/2]

void clan::Canvas::draw_lines | ( | const Vec2f * | line_positions,
|  | const Vec2f * | texture_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Colorf & | line_color = StandardColorf::white() )

Lines.

References clan::StandardColorf::white().

## ◆ draw_lines() [2/2]

void clan::Canvas::draw_lines | ( | const Vec2f * | positions,
|  | int | num_vertices,
|  | const Colorf & | color = StandardColorf::white() )

Lines.

References clan::color, and clan::StandardColorf::white().

## ◆ draw_point() [1/2]

void clan::Canvas::draw_point | ( | const Pointf & | point,
|  | const Colorf & | color )

Point.

Parameters

  gc | = Graphic Context
  point | = Pointf
  color | = Colorf

References clan::color, and clan::point.

## ◆ draw_point() [2/2]

void clan::Canvas::draw_point | ( | float | x1,
|  | float | y1,
|  | const Colorf & | color )

Draw a point.

References clan::color.

## ◆ fill_circle() [1/4]

void clan::Canvas::fill_circle | ( | const Pointf & | center,
|  | const Pointf & | centergradient,
|  | float | radius,
|  | const Gradient & | gradient )

Gradient circle.

Parameters

  gc | = Graphic Context
  center | = Pointf
  centergradient | = Pointf
  radius | = value
  gradient | = Gradient

References clan::center.

## ◆ fill_circle() [2/4]

void clan::Canvas::fill_circle | ( | const Pointf & | center,
|  | float | radius,
|  | const Colorf & | color = StandardColorf::white() )

Circle.

Parameters

  gc | = Graphic Context
  center | = Pointf
  radius | = value
  color | = Colorf

References clan::center, clan::color, and clan::StandardColorf::white().

## ◆ fill_circle() [3/4]

void clan::Canvas::fill_circle | ( | const Pointf & | center,
|  | float | radius,
|  | const Gradient & | gradient )

Gradient circle.

Parameters

  gc | = Graphic Context
  center | = Pointf
  radius | = value
  gradient | = Gradient

References clan::center.

## ◆ fill_circle() [4/4]

void clan::Canvas::fill_circle | ( | float | center_x,
|  | float | center_y,
|  | float | radius,
|  | const Colorf & | color = StandardColorf::white() )

Draw a circle.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_ellipse() [1/2]

void clan::Canvas::fill_ellipse | ( | const Pointf & | center,
|  | float | radius_x,
|  | float | radius_y,
|  | const Colorf & | color = StandardColorf::white() )

Draw a filled ellipse.

References clan::center, clan::color, and clan::StandardColorf::white().

## ◆ fill_ellipse() [2/2]

void clan::Canvas::fill_ellipse | ( | const Pointf & | center,
|  | float | radius_x,
|  | float | radius_y,
|  | const Gradient & | gradient )

Draw a gradient filled ellipse.

References clan::center.

## ◆ fill_rect() [1/6]

void clan::Canvas::fill_rect | ( | const Pointf & | start,
|  | const Pointf & | end,
|  | const Colorf & | color = StandardColorf::white() )

Fill.

Parameters

  gc | = Graphic Context
  start | = Pointf
  end | = Pointf
  color | = Colorf

References clan::color, clan::end, and clan::StandardColorf::white().

## ◆ fill_rect() [2/6]

void clan::Canvas::fill_rect | ( | const Pointf & | start,
|  | const Pointf & | end,
|  | const Gradient & | gradient )

Gradient fill.

Parameters

  gc | = Graphic Context
  start | = Pointf
  end | = Pointf
  gradient | = Gradient

References clan::end.

## ◆ fill_rect() [3/6]

void clan::Canvas::fill_rect | ( | const Rectf & | rect,
|  | const Colorf & | color )

Fill.

Parameters

  gc | = Graphic Context
  rect | = Rectf
  color | = Colorf

References clan::color.

## ◆ fill_rect() [4/6]

void clan::Canvas::fill_rect | ( | const Rectf & | rect,
|  | const Gradient & | gradient )

Gradient fill.

Parameters

  gc | = Graphic Context
  rect | = Rectf
  gradient | = Gradient

## ◆ fill_rect() [5/6]

void clan::Canvas::fill_rect | ( | float | x1,
|  | float | y1,
|  | float | x2,
|  | float | y2,
|  | const Colorf & | color = StandardColorf::white() )

Draw a filled box / rectangle.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_rect() [6/6]

void clan::Canvas::fill_rect | ( | float | x1,
|  | float | y1,
|  | float | x2,
|  | float | y2,
|  | const Gradient & | color )

Gradient fill.

Parameters

  gc | = Graphic Context
  x1 | = value
  y1 | = value
  x2 | = value
  y2 | = value
  color | = Gradient

References clan::color.

## ◆ fill_triangle() [1/2]

void clan::Canvas::fill_triangle | ( | const Pointf & | a,
|  | const Pointf & | b,
|  | const Pointf & | c,
|  | const Colorf & | color = StandardColorf::white() )

Draw a triangle.

References clan::a, clan::b, clan::c, clan::color, and clan::StandardColorf::white().

## ◆ fill_triangle() [2/2]

void clan::Canvas::fill_triangle | ( | const Trianglef & | dest_triangle,
|  | const Colorf & | color = StandardColorf::white() )

Draw a triangle.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [1/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const std::vector< Vec2f > & | texture_positions,
|  | const Texture2D & | texture,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [2/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const std::vector< Vec2f > & | texture_positions,
|  | const Texture2D & | texture,
|  | const std::vector< Colorf > & | colors )

Draw triangles.

## ◆ fill_triangles() [3/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const Texture2D & | texture,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [4/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const Texture2D & | texture,
|  | const Gradient & | gradient )

Draw triangles.

## ◆ fill_triangles() [5/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const Texture2D & | texture,
|  | const Rect & | texture_rect,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [6/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions,
|  | const Texture2D & | texture,
|  | const Rect & | texture_rect,
|  | const Gradient & | gradient )

Draw triangles.

## ◆ fill_triangles() [7/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | triangles,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, clan::triangles, and clan::StandardColorf::white().

## ◆ fill_triangles() [8/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | triangles,
|  | const Colorf * | colors )

Draw triangles.

References clan::triangles.

## ◆ fill_triangles() [9/18]

void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | triangles,
|  | const Gradient & | gradient )

Draw triangles.

References clan::triangles.

## ◆ fill_triangles() [10/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | positions,
|  | const Vec2f * | texture_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [11/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | positions,
|  | const Vec2f * | texture_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Colorf * | colors )

Draw triangles.

## ◆ fill_triangles() [12/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | const Colorf * | colors,
|  | int | num_vertices )

Draw triangles.

## ◆ fill_triangles() [13/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [14/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Gradient & | gradient )

Draw triangles.

## ◆ fill_triangles() [15/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [16/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Gradient & | gradient )

Draw triangles.

## ◆ fill_triangles() [17/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Rect & | texture_rect,
|  | const Colorf & | color = StandardColorf::white() )

Draw triangles.

References clan::color, and clan::StandardColorf::white().

## ◆ fill_triangles() [18/18]

void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions,
|  | int | num_vertices,
|  | const Texture2D & | texture,
|  | const Rect & | texture_rect,
|  | const Gradient & | gradient )

Draw triangles.

## ◆ flush()

void clan::Canvas::flush | ( |  | ) |

Flushes the render batcher currently active.

## ◆ get_cliprect()

Rectf clan::Canvas::get_cliprect | ( |  | ) | const

Returns the current clipping rectangle.

## ◆ get_gc()

GraphicContext & clan::Canvas::get_gc | ( |  | ) | const

Get gc.

Returns
  Graphic Context

Referenced by get_height(), get_pixel_ratio(), get_size(), get_width(), and operator GraphicContext &().

## ◆ get_height()

float clan::Canvas::get_height | ( |  | ) | const
| inline

Returns the current height of the context.

References clan::GraphicContext::get_dip_height(), and get_gc().

## ◆ get_inverse_transform()

Mat4f & clan::Canvas::get_inverse_transform | ( |  | ) |

Returns the inverse of the current effective transform matrix.

This is cached

## ◆ get_pixel_ratio()

float clan::Canvas::get_pixel_ratio | ( |  | ) | const
| inline

Retrieves the display pixel ratio of the context. \seealso Resolution Independence

References get_gc(), and clan::GraphicContext::get_pixel_ratio().

## ◆ get_pixeldata() [1/2]

PixelBuffer clan::Canvas::get_pixeldata | ( | const Rect & | rect,
|  | TextureFormat | texture_format = TextureFormat::rgba8,
|  | bool | clamp = true )

Return the content of the read buffer into a pixel buffer.

References clan::clamp(), and clan::rgba8.

## ◆ get_pixeldata() [2/2]

PixelBuffer clan::Canvas::get_pixeldata | ( | TextureFormat | texture_format = TextureFormat::rgba8,
|  | bool | clamp = true )

Return the content of the read buffer into a pixel buffer.

References clan::clamp(), and clan::rgba8.

## ◆ get_projection()

const Mat4f & clan::Canvas::get_projection | ( |  | ) | const

Returns the current effective projection matrix.

## ◆ get_size()

Sizef clan::Canvas::get_size | ( |  | ) | const
| inline

Returns the current size of the context.

References clan::GraphicContext::get_dip_size(), and get_gc().

## ◆ get_transform()

const Mat4f & clan::Canvas::get_transform | ( |  | ) | const

Returns the current effective transform matrix.

## ◆ get_width()

float clan::Canvas::get_width | ( |  | ) | const
| inline

Returns the current width of the context.

References clan::GraphicContext::get_dip_width(), and get_gc().

## ◆ grid_fit()

Pointf clan::Canvas::grid_fit | ( | const Pointf & | pos | ) |

Snaps the point to the nearest pixel corner.

## ◆ is_null()

bool clan::Canvas::is_null | ( |  | ) | const
| inline

Returns true if this object is invalid.

## ◆ mult_transform()

void clan::Canvas::mult_transform | ( | const Mat4f & | matrix | ) |

Multiplies the passed matrix onto the transform matrix.

## ◆ operator bool()

clan::Canvas::operator bool | ( |  | ) | const
| inlineexplicit

## ◆ operator GraphicContext &()

clan::Canvas::operator GraphicContext & | ( |  | ) | const
| inline

References get_gc().

## ◆ pop_cliprect()

void clan::Canvas::pop_cliprect | ( |  | ) |

Pop current clipping rectangle from the stack.

## ◆ push_cliprect() [1/2]

void clan::Canvas::push_cliprect | ( |  | ) |

Push cliprect.

## ◆ push_cliprect() [2/2]

void clan::Canvas::push_cliprect | ( | const Rectf & | rect | ) |

Push current clipping rectangle to stack.

If a rectangle is passed, it afterwards sets clipping rectangle to the union of the current rectangle and the passed rectangle.

## ◆ reset_blend_state()

void clan::Canvas::reset_blend_state | ( |  | ) |

Set active blend state.

## ◆ reset_cliprect()

void clan::Canvas::reset_cliprect | ( |  | ) |

Removes the set clipping rectangle and empties the cliprect stack.

## ◆ reset_depth_stencil_state()

void clan::Canvas::reset_depth_stencil_state | ( |  | ) |

Set active depth stencil state.

## ◆ reset_rasterizer_state()

void clan::Canvas::reset_rasterizer_state | ( |  | ) |

Set active rasterizer state.

## ◆ set_batcher()

void clan::Canvas::set_batcher | ( | RenderBatcher * | batcher | ) |

Specifies which render batcher is to be currently active.

If the render batcher is already active, nothing happens. If a different render batcher is currently active, it is flushed before the new batcher is made active.

## ◆ set_blend_state()

void clan::Canvas::set_blend_state | ( | const BlendState & | state,
|  | const Colorf & | blend_color = StandardColorf::white(),
|  | unsigned int | sample_mask = 0xffffffff )

Set active blend state.

References clan::StandardColorf::white().

## ◆ set_cliprect()

void clan::Canvas::set_cliprect | ( | const Rectf & | rect | ) |

Set the current clipping rectangle.

## ◆ set_depth_stencil_state()

void clan::Canvas::set_depth_stencil_state | ( | const DepthStencilState & | state,
|  | int | stencil_ref = 0 )

Set active depth stencil state.

## ◆ set_map_mode()

void clan::Canvas::set_map_mode | ( | MapMode | mode | ) |

Set the projection mapping mode.

## ◆ set_program_object()

void clan::Canvas::set_program_object | ( | StandardProgram | standard_program | ) |

Set active program object to the standard program specified.

## ◆ set_projection()

void clan::Canvas::set_projection | ( | const Mat4f & | matrix | ) |

Set the projection matrix to be used in user projection map mode.

## ◆ set_rasterizer_state()

void clan::Canvas::set_rasterizer_state | ( | const RasterizerState & | state | ) |

Set active rasterizer state.

## ◆ set_transform()

void clan::Canvas::set_transform | ( | const Mat4f & | matrix | ) |

Sets the transform matrix to a new matrix.

## ◆ set_viewport()

void clan::Canvas::set_viewport | ( | const Rectf & | viewport | ) |

Set the viewport to be used in user projection map mode.

Parameters

  viewport | = The viewport to set

## ◆ throw_if_null()

void clan::Canvas::throw_if_null | ( |  | ) | const

Throw an exception if this object is invalid.

## Friends And Related Symbol Documentation

## ◆ Font_DrawFlat

friend class Font_DrawFlat
| friend

References Font_DrawFlat.

Referenced by Font_DrawFlat.

## ◆ Font_DrawScaled

friend class Font_DrawScaled
| friend

References Font_DrawScaled.

Referenced by Font_DrawScaled.

## ◆ Font_DrawSubPixel

friend class Font_DrawSubPixel
| friend

References Font_DrawSubPixel.

Referenced by Font_DrawSubPixel.

## ◆ Font_Impl

friend class Font_Impl
| friend

References Font_Impl.

Referenced by Font_Impl.

## ◆ Image

friend class Image
| friend

References Image.

Referenced by Image.

## ◆ Path

friend class Path
| friend

References Path.

Referenced by Path.

## ◆ Sprite_Impl

friend class Sprite_Impl
| friend

References Sprite_Impl.

Referenced by Sprite_Impl.

The documentation for this class was generated from the following file:

- canvas.h