CL_Surface::draw - ClanLib Game SDK

Home | All Classes | Grouped Classes | Index | Search

# CL_Surface::draw

Stateful draw surface on graphic context. Stateless draw surface on graphic context.

    	void draw(
    		float x = 0, float y = 0, CL_GraphicContext* context = 0);

    	void draw(
    		const CL_Rect& dest, CL_GraphicContext* context = 0);

    	void draw(
    		const CL_Rect& src, const CL_Rect& dest, CL_GraphicContext* context = 0);

    	void draw(
    		const CL_Surface_DrawParams1& params1, CL_GraphicContext* context = 0);

    	void draw(
    		const CL_Surface_DrawParams2& params2, CL_GraphicContext* context = 0);

Parameters:

x, y
  Anchor position of where to render surface. Actual rendering position depends on the anchor and the alignment mode.
context
  Graphic context on which to render upon. If null, will use CL_Display's current graphic context.
dest
  Rectangle to draw surface in.
src
  Rectangle specifying the sub section of a surface to render.
srcX, srcY, srcWidth, srcHeight
  Source rectangle for the surface.
srcX[4], srcY[4]
  Four vertex points used as the source rectangle for the render.
destX, destY
  Destination origin point for render.
destZ
  Depth value for zbuffer when rendering.
red[4], green[4], blue[4], alpha[4]
  Color for each corner of rectangle.
red, green, blue, alpha
  Color for entire rectangle.
blend_src
  Source blend function.
blend_dest
  Destination blend function.
scale_x, scale_y
  Scale values for render.
translate_origin
  Alignment origin.
translate_x, translate_y
  Translate relative to alignment origin.
rotate_angle
  Angle in degrees to rotate the surface in the X-Y direction.
rotate_pitch
  Angle in degrees to rotate the surface in the Y-Z direction.
rotate_yaw
  Angle in degrees to rotate the surface in the X-Z direction.
rotate_origin
  Rotation origin.
rotate_x, rotate_y
  Rotation hotspot relative to rotation origin.
sub_pixel_accuracy
  If true, floating point data isn't truncated and the texture matrix isn't offset (applicable to GL only)
context
  Graphic context on which to render upon. If null, will use CL_Display's current graphic context.

Detailed description:

These drawing functions will draw the surface on the graphic context, using the attributes on CL_Surface. Attributes such as scaling, translate hotspot, rotate hotspot, blend functions, color will be used when drawing the surface.

Stateless drawing functions will not use any of the state attributes on CL_Surface. The state attributes on CL_Surface are parameters such as scaling, hotspots, blending functions and color. Instead the drawing functions take all the parameters it need to perform the render.

Subpixel versions don't perform texture texel shifting or truncate input to integers.

See also:

CL_GraphicContext | CL_Rect | CL_Surface_DrawParams2 | CL_Surface | CL_Display | CL_Surface_DrawParams1

Questions or comments, write to the ClanLib mailing list.