clan::Canvas Class Reference

2D Graphics Canvas More...

#include <canvas.h>

Public Member Functions

Construction
 Canvas ()
 Constructs a null instance. More...
 
 Canvas (Canvas &canvas, FrameBuffer &framebuffer)
 Constructs a Canvas based on a framebuffer. (based on the copy of the canvas) More...
 
 Canvas (DisplayWindow &window)
 Constructs a Canvas. More...
 
 ~Canvas ()
 
Attributes
Canvas create ()
 Create a copy of a canvas. More...
 
bool is_null () const
 Returns true if this object is invalid. More...
 
void throw_if_null () const
 Throw an exception if this object is invalid. More...
 
GraphicContextget_gc () const
 Get gc. More...
 
const Mat4fget_modelview () const
 Returns the current effective modelview matrix. More...
 
const Mat4fget_projection () const
 Returns the current effective projection matrix. More...
 
 operator GraphicContext & () const
 
int get_width () const
 Returns the current width of the context. More...
 
int get_height () const
 Returns the current height of the context. More...
 
Size get_size () const
 Returns the current size of the context. More...
 
Rect get_cliprect () const
 Returns the current clipping rectangle. More...
 
PixelBuffer get_pixeldata (const Rect &rect, TextureFormat texture_format=tf_rgba8, bool clamp=true)
 Return the content of the read buffer into a pixel buffer. More...
 
PixelBuffer get_pixeldata (TextureFormat texture_format=tf_rgba8, bool clamp=true)
 Return the content of the read buffer into a pixel buffer. More...
 
Operations
void set_rasterizer_state (const RasterizerState &state)
 Set active rasterizer state. More...
 
void set_blend_state (const BlendState &state, const Colorf &blend_color=Colorf::white, unsigned int sample_mask=0xffffffff)
 Set active blend state. More...
 
void set_depth_stencil_state (const DepthStencilState &state, int stencil_ref=0)
 Set active depth stencil state. More...
 
void reset_rasterizer_state ()
 Set active rasterizer state. More...
 
void reset_blend_state ()
 Set active blend state. More...
 
void reset_depth_stencil_state ()
 Set active depth stencil state. More...
 
void set_cliprect (const Rect &rect)
 Set the current clipping rectangle. More...
 
void push_cliprect (const Rect &rect)
 Push current clipping rectangle to stack. More...
 
void push_cliprect ()
 Push cliprect. More...
 
void pop_cliprect ()
 Pop current clipping rectangle from the stack. More...
 
void reset_cliprect ()
 Removes the set clipping rectangle and empties the cliprect stack. More...
 
void clear (const Colorf &color=Colorf::black)
 Clears the whole context using the specified color. More...
 
void clear_stencil (int value=0)
 Clear the stencil buffer. More...
 
void clear_depth (float value=0)
 Clear the depth buffer. More...
 
void set_program_object (StandardProgram standard_program)
 Set active program object to the standard program specified. More...
 
void set_map_mode (MapMode mode)
 Set the projection mapping mode. More...
 
void set_projection (const Mat4f &matrix)
 Set the projection matrix to be used in user projection map mode. More...
 
void set_batcher (RenderBatcher *batcher)
 Specifies which render batcher is to be currently active. More...
 
void set_modelview (const Mat4f &matrix)
 Sets the model view matrix to a new matrix. More...
 
void mult_modelview (const Mat4f &matrix)
 Multiplies the passed matrix onto the model view matrix. More...
 
void push_modelview ()
 Pushes current model view matrix onto the model view stack. More...
 
void set_translate (float x, float y, float z=0.0)
 Sets a translate offset matrix, ignoring any earlier model view settings. More...
 
void set_translate (const Vec2f &vec)
 
void set_translate (const Vec3f &vec)
 
void set_translate (int x, int y, int z=0)
 
void mult_translate (float x, float y, float z=0.0)
 Adds the translate offset. More...
 
void mult_translate (const Vec2f &vec)
 
void mult_translate (const Vec3f &vec)
 
void mult_translate (int x, int y, int z=0)
 
void push_translate (float x, float y, float z=0.0)
 Push translation offset onto model view stack. More...
 
void push_translate (const Vec2f &vec)
 
void push_translate (const Vec3f &vec)
 
void push_translate (int x, int y, int z=0)
 
void set_rotate (const Angle &angle, float x=0.0, float y=0.0, float z=1.0, bool normalize=true)
 Sets a rotation matrix, ignoring any earlier model view settings. More...
 
void set_rotate (const Angle &angle, const Vec2f &vec, bool normalize=true)
 
void set_rotate (const Angle &angle, const Vec3f &vec, bool normalize=true)
 
void mult_rotate (const Angle &angle, float x=0.0, float y=0.0, float z=1.0, bool normalize=true)
 Adds a rotation matrix to existing model view. More...
 
void mult_rotate (const Angle &angle, const Vec2f &vec, bool normalize=true)
 
void mult_rotate (const Angle &angle, const Vec3f &vec, bool normalize=true)
 
void push_rotate (const Angle &angle, float x=0.0, float y=0.0, float z=1.0)
 Pushes a rotation matrix onto model view stack. More...
 
void push_rotate (const Angle &angle, const Vec2f &vec)
 
void push_rotate (const Angle &angle, const Vec3f &vec)
 
void set_scale (float x, float y, float z=1.0)
 Sets a scale matrix, ignoring any earlier model view settings. More...
 
void set_scale (const Vec2f &vec)
 
void set_scale (const Vec3f &vec)
 
void set_scale (int x, int y, int z=1)
 
void mult_scale (float x, float y, float z=1.0)
 Adds a scale matrix to existing model view. More...
 
void mult_scale (const Vec2f &vec)
 
void mult_scale (const Vec3f &vec)
 
void mult_scale (int x, int y, int z=1)
 
void push_scale (float x, float y, float z=1.0)
 Pushes a scale matrix onto model view stack. More...
 
void push_scale (const Vec2f &vec)
 
void push_scale (const Vec3f &vec)
 
void push_scale (int x, int y, int z=1)
 
void pop_modelview ()
 Pops last pushed model view matrix off the stack and makes it the active one. More...
 
void flush ()
 Flushes the render batcher currently active. More...
 
void draw_point (float x1, float y1, const Colorf &color)
 Draw a point. More...
 
void draw_point (const Pointf &point, const Colorf &color)
 Point. More...
 
void draw_line (float x1, float y1, float x2, float y2, const Colorf &color=Colorf::white)
 Draw a line. More...
 
void draw_line (const Pointf &start, const Pointf &end, const Colorf &color=Colorf::white)
 Line. More...
 
void draw_line (const LineSegment2f &line_segment, const Colorf &color=Colorf::white)
 Line. More...
 
void draw_lines (const Vec2f *positions, int num_vertices, const Colorf &color=Colorf::white)
 Lines. More...
 
void draw_lines (const Vec2f *line_positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf &line_color=Colorf::white)
 Lines. More...
 
void draw_line_strip (const Vec2f *positions, int num_vertices, const Colorf &color=Colorf::white)
 Line Strip. More...
 
void draw_box (float x1, float y1, float x2, float y2, const Colorf &color=Colorf::white)
 Draw a box / rectangle. More...
 
void draw_box (const Pointf &start, const Pointf &end, const Colorf &color=Colorf::white)
 Box. More...
 
void draw_box (const Rectf &rect, const Colorf &color)
 Box. More...
 
void fill_rect (float x1, float y1, float x2, float y2, const Colorf &color=Colorf::white)
 Draw a filled box / rectangle. More...
 
void fill_rect (const Pointf &start, const Pointf &end, const Colorf &color=Colorf::white)
 Fill. More...
 
void fill_rect (const Rectf &rect, const Colorf &color)
 Fill. More...
 
void fill_rect (float x1, float y1, float x2, float y2, const Gradient &color)
 Gradient fill. More...
 
void fill_rect (const Pointf &start, const Pointf &end, const Gradient &gradient)
 Gradient fill. More...
 
void fill_rect (const Rectf &rect, const Gradient &gradient)
 Gradient fill. More...
 
void fill_circle (float center_x, float center_y, float radius, const Colorf &color=Colorf::white)
 Draw a circle. More...
 
void fill_circle (const Pointf &center, float radius, const Colorf &color=Colorf::white)
 Circle. More...
 
void fill_circle (const Pointf &center, float radius, const Gradient &gradient)
 Gradient circle. More...
 
void fill_circle (const Pointf &center, const Pointf &centergradient, float radius, const Gradient &gradient)
 Gradient circle. More...
 
void fill_triangle (const Pointf &a, const Pointf &b, const Pointf &c, const Colorf &color=Colorf::white)
 Draw a triangle. More...
 
void fill_triangle (const Trianglef &dest_triangle, const Colorf &color=Colorf::white)
 Draw a triangle. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Gradient &gradient)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, const Colorf *colors, int num_vertices)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &triangles, const Colorf *colors)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &triangles, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &triangles, const Gradient &gradient)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *positions, const Vec2f *texture_positions, int num_vertices, const Texture2D &texture, const Colorf *colors)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const std::vector< Vec2f > &texture_positions, const Texture2D &texture, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const std::vector< Vec2f > &texture_positions, const Texture2D &texture, const std::vector< Colorf > &colors)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Rect &texture_rect, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Rect &texture_rect, const Colorf &color=Colorf::white)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Gradient &gradient)
 Draw triangles. More...
 
void fill_triangles (const std::vector< Vec2f > &positions, const Texture2D &texture, const Rect &texture_rect, const Gradient &gradient)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Gradient &gradient)
 Draw triangles. More...
 
void fill_triangles (const Vec2f *triangle_positions, int num_vertices, const Texture2D &texture, const Rect &texture_rect, const Gradient &gradient)
 Draw triangles. More...
 
void fill_ellipse (const Pointf &center, float radius_x, float radius_y, const Colorf &color=Colorf::white)
 Draw a filled ellipse. More...
 
void fill_ellipse (const Pointf &center, float radius_x, float radius_y, const Gradient &gradient)
 Draw a gradient filled ellipse. More...
 

Implementation

class Sprite_Impl
 
class Image
 
class GlyphCache
 

Detailed Description

2D Graphics Canvas


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