#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 ¢er, const Pointf ¢ergradient, float radius, const Gradient &gradient) |
| Gradient circle. | |
| void | fill_circle (const Pointf ¢er, float radius, const Colorf &color=StandardColorf::white()) |
| Circle. | |
| void | fill_circle (const Pointf ¢er, 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 ¢er, float radius_x, float radius_y, const Colorf &color=StandardColorf::white()) |
| Draw a filled ellipse. | |
| void | fill_ellipse (const Pointf ¢er, 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 |
2D Graphics Canvas
| clan::Canvas::Canvas | ( | ) |
Constructs a null instance.
| clan::Canvas::Canvas | ( | Canvas & | canvas, |
| FrameBuffer & | framebuffer ) |
Constructs a Canvas based on a framebuffer. (based on the copy of the canvas)
|
explicit |
Constructs a Canvas.
| clan::Canvas::~Canvas | ( | ) |
| void clan::Canvas::clear | ( | const Colorf & | color = StandardColorf::black() | ) |
Clears the whole context using the specified color.
| void clan::Canvas::clear_depth | ( | float | value = 0 | ) |
Clear the depth buffer.
| value | value to clear to. Range 0.0 - 1.0. |
| void clan::Canvas::clear_stencil | ( | int | value = 0 | ) |
Clear the stencil buffer.
| value | value to clear to. |
| Canvas clan::Canvas::create | ( | ) |
Create a copy of a canvas.
| void clan::Canvas::draw_box | ( | const Pointf & | start, |
| const Pointf & | end, | ||
| const Colorf & | color = StandardColorf::white() ) |
| void clan::Canvas::draw_box | ( | float | x1, |
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a box / rectangle.
| void clan::Canvas::draw_line | ( | const LineSegment2f & | line_segment, |
| const Colorf & | color = StandardColorf::white() ) |
Line.
| gc | = Graphic Context |
| line_segment | = The line |
| color | = Colorf |
| void clan::Canvas::draw_line | ( | const Pointf & | start, |
| const Pointf & | end, | ||
| const Colorf & | color = StandardColorf::white() ) |
| void clan::Canvas::draw_line | ( | float | x1, |
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a line.
| void clan::Canvas::draw_line_strip | ( | const Vec2f * | positions, |
| int | num_vertices, | ||
| const Colorf & | color = StandardColorf::white() ) |
Line Strip.
| 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.
| void clan::Canvas::draw_lines | ( | const Vec2f * | positions, |
| int | num_vertices, | ||
| const Colorf & | color = StandardColorf::white() ) |
Lines.
| void clan::Canvas::draw_point | ( | float | x1, |
| float | y1, | ||
| const Colorf & | color ) |
Draw a point.
| void clan::Canvas::fill_circle | ( | const Pointf & | center, |
| float | radius, | ||
| const Colorf & | color = StandardColorf::white() ) |
| void clan::Canvas::fill_circle | ( | float | center_x, |
| float | center_y, | ||
| float | radius, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a circle.
| void clan::Canvas::fill_ellipse | ( | const Pointf & | center, |
| float | radius_x, | ||
| float | radius_y, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a filled ellipse.
| void clan::Canvas::fill_ellipse | ( | const Pointf & | center, |
| float | radius_x, | ||
| float | radius_y, | ||
| const Gradient & | gradient ) |
Draw a gradient filled ellipse.
| void clan::Canvas::fill_rect | ( | const Pointf & | start, |
| const Pointf & | end, | ||
| const Colorf & | color = StandardColorf::white() ) |
| void clan::Canvas::fill_rect | ( | float | x1, |
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a filled box / rectangle.
| void clan::Canvas::fill_rect | ( | float | x1, |
| float | y1, | ||
| float | x2, | ||
| float | y2, | ||
| const Gradient & | color ) |
| void clan::Canvas::fill_triangle | ( | const Pointf & | a, |
| const Pointf & | b, | ||
| const Pointf & | c, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw a triangle.
| void clan::Canvas::fill_triangle | ( | const Trianglef & | dest_triangle, |
| const Colorf & | color = StandardColorf::white() ) |
Draw a triangle.
| 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.
| 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.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions, |
| const Texture2D & | texture, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions, |
| const Texture2D & | texture, | ||
| const Gradient & | gradient ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions, |
| const Texture2D & | texture, | ||
| const Rect & | texture_rect, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | positions, |
| const Texture2D & | texture, | ||
| const Rect & | texture_rect, | ||
| const Gradient & | gradient ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | triangles, |
| const Colorf & | color = StandardColorf::white() ) |
Draw triangles.
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const std::vector< Vec2f > & | triangles, |
| const Gradient & | gradient ) |
Draw triangles.
| 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.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | positions, |
| const Vec2f * | texture_positions, | ||
| int | num_vertices, | ||
| const Texture2D & | texture, | ||
| const Colorf * | colors ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| const Colorf * | colors, | ||
| int | num_vertices ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| int | num_vertices, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| int | num_vertices, | ||
| const Gradient & | gradient ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| int | num_vertices, | ||
| const Texture2D & | texture, | ||
| const Colorf & | color = StandardColorf::white() ) |
Draw triangles.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| int | num_vertices, | ||
| const Texture2D & | texture, | ||
| const Gradient & | gradient ) |
Draw triangles.
| 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.
| void clan::Canvas::fill_triangles | ( | const Vec2f * | triangle_positions, |
| int | num_vertices, | ||
| const Texture2D & | texture, | ||
| const Rect & | texture_rect, | ||
| const Gradient & | gradient ) |
Draw triangles.
| void clan::Canvas::flush | ( | ) |
Flushes the render batcher currently active.
| Rectf clan::Canvas::get_cliprect | ( | ) | const |
Returns the current clipping rectangle.
| GraphicContext & clan::Canvas::get_gc | ( | ) | const |
Get gc.
Referenced by get_height(), get_pixel_ratio(), get_size(), get_width(), and operator GraphicContext &().
|
inline |
Returns the current height of the context.
References clan::GraphicContext::get_dip_height(), and get_gc().
| Mat4f & clan::Canvas::get_inverse_transform | ( | ) |
Returns the inverse of the current effective transform matrix.
This is cached
|
inline |
Retrieves the display pixel ratio of the context. \seealso Resolution Independence
References get_gc(), and clan::GraphicContext::get_pixel_ratio().
| 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.
| PixelBuffer clan::Canvas::get_pixeldata | ( | TextureFormat | texture_format = TextureFormat::rgba8, |
| bool | clamp = true ) |
Return the content of the read buffer into a pixel buffer.
| const Mat4f & clan::Canvas::get_projection | ( | ) | const |
Returns the current effective projection matrix.
|
inline |
Returns the current size of the context.
References clan::GraphicContext::get_dip_size(), and get_gc().
Referenced by clan::ClipRectState::~ClipRectState().
| const Mat4f & clan::Canvas::get_transform | ( | ) | const |
Returns the current effective transform matrix.
|
inline |
Returns the current width of the context.
References clan::GraphicContext::get_dip_width(), and get_gc().
|
inline |
Returns true if this object is invalid.
| void clan::Canvas::mult_transform | ( | const Mat4f & | matrix | ) |
Multiplies the passed matrix onto the transform matrix.
|
inlineexplicit |
|
inline |
References get_gc().
| void clan::Canvas::pop_cliprect | ( | ) |
Pop current clipping rectangle from the stack.
Referenced by clan::ClipRectStack::~ClipRectStack(), and clan::ClipRectStack::pop_cliprect().
| void clan::Canvas::push_cliprect | ( | ) |
Push cliprect.
| 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.
Referenced by clan::ClipRectStack::push_cliprect(), and clan::ClipRectStack::push_cliprect().
| void clan::Canvas::reset_blend_state | ( | ) |
Set active blend state.
| void clan::Canvas::reset_cliprect | ( | ) |
Removes the set clipping rectangle and empties the cliprect stack.
Referenced by clan::ClipRectState::~ClipRectState().
| void clan::Canvas::reset_depth_stencil_state | ( | ) |
Set active depth stencil state.
| void clan::Canvas::reset_rasterizer_state | ( | ) |
Set active rasterizer state.
| 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.
| void clan::Canvas::set_blend_state | ( | const BlendState & | state, |
| const Colorf & | blend_color = StandardColorf::white(), | ||
| unsigned int | sample_mask = 0xffffffff ) |
Set active blend state.
| void clan::Canvas::set_cliprect | ( | const Rectf & | rect | ) |
Set the current clipping rectangle.
Referenced by clan::ClipRectState::~ClipRectState().
| void clan::Canvas::set_depth_stencil_state | ( | const DepthStencilState & | state, |
| int | stencil_ref = 0 ) |
Set active depth stencil state.
| void clan::Canvas::set_map_mode | ( | MapMode | mode | ) |
Set the projection mapping mode.
| void clan::Canvas::set_program_object | ( | StandardProgram | standard_program | ) |
Set active program object to the standard program specified.
| void clan::Canvas::set_projection | ( | const Mat4f & | matrix | ) |
Set the projection matrix to be used in user projection map mode.
| void clan::Canvas::set_rasterizer_state | ( | const RasterizerState & | state | ) |
Set active rasterizer state.
| void clan::Canvas::set_transform | ( | const Mat4f & | matrix | ) |
Sets the transform matrix to a new matrix.
Referenced by clan::TransformState::~TransformState().
| void clan::Canvas::set_viewport | ( | const Rectf & | viewport | ) |
Set the viewport to be used in user projection map mode.
| viewport | = The viewport to set |
| void clan::Canvas::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |