<html> <head><title>ClanLib Reference: CL_Canvas</title></head> <body text=black link=blue vlink=#800080 bgcolor=white topmargin=0 leftmargin=0> <table border=0 cellspacing=0 cellpadding=0 width=100%><tr><td><img border=0 src="../images/eyeheader-main-purple-a.gif" alt="ClanSoft logo" width=525 height=96></td></tr> <tr bgcolor=#dadada><td align=left valign=top><img border=0 src="../images/eyeheader-main-purple-b.gif" alt="ClanSoft logo" width=190 height=14></td><td align=right valign=top><img border=0 src="../images/clanlib_light.gif" width=42 height=14></td></tr></table> <table align=center border=0 cellspacing=10> <tr> <td><a href="entire_class_index.html">Entire Class Index</a></td> <td><a href="class_index.html">Main Class Index</a></td> <td><a href="cross_index.html">Cross Index</a></td> <td><a href="global_index.html">Global Index</a></td> </table><h1 align=center>Class CL_Canvas</h1><p> <b> Empty surfaceprovider to be used as a rendering target.</b><br> Contained in: <a href="global_index.html">global</a><br> Derived from: <a href="CL_SurfaceProvider.html">CL_SurfaceProvider</a> <br> Derived by: <i>none</i> <br>Group: Display (Surface Providers) <p> #include <ClanLib/display.h> <p> <hr noshade> <table border=0> <tr><td colspan=3><h3>public function member index:</h3></td> <tr valign=top><td align=left><h3>Construction:</h3></td> <tr valign=top><td align=right><tt><tt>static</tt> <a href="CL_Surface.html"><tt><font color=navy><b>CL_Surface</b></font></tt></a>*</tt> </td><td align=right><a href="CL_Canvas.html#2190"><tt><font color=blue><b>create</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>no_sprs</font></tt> = 1, <tt><font color=purple>int</font></tt> <tt><font color=blue>red_mask</font></tt> = 0xff000000, <tt><font color=purple>int</font></tt> <tt><font color=blue>green_mask</font></tt> = 0x00ff0000, <tt><font color=purple>int</font></tt> <tt><font color=blue>blue_mask</font></tt> = 0x0000ff00, <tt><font color=purple>int</font></tt> <tt><font color=blue>alpha_mask</font></tt> = 0x000000ff, <tt><font color=purple>bool</font></tt> <tt><font color=blue>use_transcol</font></tt> = false, <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt> = 0)</tt>;</td> <tr valign=top><td align=right><tt></tt> </td><td align=right><a href="CL_Canvas.html#2191"><tt><font color=blue><b>CL_Canvas</b></font></tt></a></td><td><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>no_sprs</font></tt> = 1, <tt><font color=purple>int</font></tt> <tt><font color=blue>red_mask</font></tt> = 0xff000000, <tt><font color=purple>int</font></tt> <tt><font color=blue>green_mask</font></tt> = 0x00ff0000, <tt><font color=purple>int</font></tt> <tt><font color=blue>blue_mask</font></tt> = 0x0000ff00, <tt><font color=purple>int</font></tt> <tt><font color=blue>alpha_mask</font></tt> = 0x000000ff, <tt><font color=purple>bool</font></tt> <tt><font color=blue>use_transcol</font></tt> = false, <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt> = 0)</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> </tt> </td><td align=right><a href="CL_Canvas.html#2192"><tt><font color=blue><b>~CL_Canvas</b></font></tt></a></td><td><tt>()</tt>;</td> <tr valign=top><td align=left><h3>Attributes:</h3></td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2193"><tt><font color=blue><b>get_width</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2194"><tt><font color=blue><b>get_height</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2195"><tt><font color=blue><b>get_num_frames</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2196"><tt><font color=blue><b>get_red_mask</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2197"><tt><font color=blue><b>get_green_mask</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2198"><tt><font color=blue><b>get_blue_mask</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2199"><tt><font color=blue><b>get_alpha_mask</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2200"><tt><font color=blue><b>get_pitch</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=left><h3>Operations:</h3></td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2201"><tt><font color=blue><b>is_indexed</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2202"><tt><font color=blue><b>set_palette</b></font></tt></a></td><td><tt>(<a href="CL_Palette.html"><tt><font color=navy><b>CL_Palette</b></font></tt></a>*)</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <a href="CL_Palette.html"><tt><font color=navy><b>CL_Palette</b></font></tt></a>*</tt> </td><td align=right><a href="CL_Canvas.html#2203"><tt><font color=blue><b>get_palette</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2204"><tt><font color=blue><b>set_src_colorkey</b></font></tt></a></td><td><tt>(<tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt>)</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2205"><tt><font color=blue><b>uses_src_colorkey</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2206"><tt><font color=blue><b>get_src_colorkey</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt>*</tt> </td><td align=right><a href="CL_Canvas.html#2207"><tt><font color=blue><b>get_data</b></font></tt></a></td><td><tt>() <tt>const</tt></tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2208"><tt><font color=blue><b>lock</b></font></tt></a></td><td><tt>()</tt>;</td> <tr valign=top><td align=right><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> </td><td align=right><a href="CL_Canvas.html#2209"><tt><font color=blue><b>unlock</b></font></tt></a></td><td><tt>()</tt>;</td> <tr><td> </td></table> <hr noshade> <h2>Description:</h2> CL_Canvas is a surface provider useful to create images at run-time.<br><br> When constructed, the surface provider will contain an empty image buffer of the specified dimensions. It is then the intention that the game fills the buffer with data.<br><br> There are three ways to do this (and you can mix them as you please):<br><br><br> Lock() the provider, and then call get_data() to get a pointer to the image buffer. Party on it. And then finally unlock() the provider.<br><br> Use the drawing primitives available in <a href="CL_Target.html">CL_Target</a>. This includes line drawing, fill rects and clipping.<br><br> Use the put_target() function in <a href="CL_Surface.html">CL_Surface</a> (create the image from other surfaces).<br><p> <hr noshade> <h2>Function Member Descriptions:</h2> <a name="2191"><font size=+1><b>CL_Canvas::CL_Canvas</b></font></a> - Constructs the Canvas.<br><tt></tt> <a href="CL_Canvas.html#2191"><tt><font color=blue><b>CL_Canvas</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>no_sprs</font></tt> = 1, <tt><font color=purple>int</font></tt> <tt><font color=blue>red_mask</font></tt> = 0xff000000, <tt><font color=purple>int</font></tt> <tt><font color=blue>green_mask</font></tt> = 0x00ff0000, <tt><font color=purple>int</font></tt> <tt><font color=blue>blue_mask</font></tt> = 0x0000ff00, <tt><font color=purple>int</font></tt> <tt><font color=blue>alpha_mask</font></tt> = 0x000000ff, <tt><font color=purple>bool</font></tt> <tt><font color=blue>use_transcol</font></tt> = false, <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt> = 0)</tt>;<br><blockquote> width - the width of the surface to be created<br> height - the height of the surface to be created<br> no_sprs - the number of sprites the surface will have<br> red_mask - the bit mask for red<br> blue_mask - the bit mask for blue<br> green_mask - the bit mask for green<br> alpha_mask - the bit mask for the alpha <br> use_transcol - whether the surface should use source key transparancy<br> transcol - the (optional) source key color</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2190"><font size=+1><b>CL_Canvas::create</b></font></a> - Creates the surface.<br><tt><tt>static</tt> <a href="CL_Surface.html"><tt><font color=navy><b>CL_Surface</b></font></tt></a>*</tt> <a href="CL_Canvas.html#2190"><tt><font color=blue><b>create</b></font></tt></a><tt>(<tt><font color=purple>int</font></tt> <tt><font color=blue>width</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>height</font></tt>, <tt><font color=purple>int</font></tt> <tt><font color=blue>no_sprs</font></tt> = 1, <tt><font color=purple>int</font></tt> <tt><font color=blue>red_mask</font></tt> = 0xff000000, <tt><font color=purple>int</font></tt> <tt><font color=blue>green_mask</font></tt> = 0x00ff0000, <tt><font color=purple>int</font></tt> <tt><font color=blue>blue_mask</font></tt> = 0x0000ff00, <tt><font color=purple>int</font></tt> <tt><font color=blue>alpha_mask</font></tt> = 0x000000ff, <tt><font color=purple>bool</font></tt> <tt><font color=blue>use_transcol</font></tt> = false, <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt> = 0)</tt>;<br><blockquote> width - the width of the surface to be created<br> height - the height of the surface to be created<br> no_sprs - the number of sprites the surface will have<br> red_mask - the bit mask for red<br> blue_mask - the bit mask for blue<br> green_mask - the bit mask for green<br> alpha_mask - the bit mask for the alpha <br> use_transcol - whether the surface should use source key transparancy<br> transcol - the (optional) source key color</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2199"><font size=+1><b>CL_Canvas::get_alpha_mask</b></font></a> - Returns the bit mask for the alpha <br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2199"><tt><font color=blue><b>get_alpha_mask</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2198"><font size=+1><b>CL_Canvas::get_blue_mask</b></font></a> - Returns the bit mask for blue<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2198"><tt><font color=blue><b>get_blue_mask</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2207"><font size=+1><b>CL_Canvas::get_data</b></font></a> - Returns the pointer to the surface data, where you can copy your data to. It should be only called between lock() and unlock(). <br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt>*</tt> <a href="CL_Canvas.html#2207"><tt><font color=blue><b>get_data</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2197"><font size=+1><b>CL_Canvas::get_green_mask</b></font></a> - Returns the bit mask for green<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2197"><tt><font color=blue><b>get_green_mask</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2194"><font size=+1><b>CL_Canvas::get_height</b></font></a> - Returns the height of the surface<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2194"><tt><font color=blue><b>get_height</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2195"><font size=+1><b>CL_Canvas::get_num_frames</b></font></a> - Returns the number of frames (sprites) for this surface <br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2195"><tt><font color=blue><b>get_num_frames</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2203"><font size=+1><b>CL_Canvas::get_palette</b></font></a> - <a href="CL_Canvas.html">CL_Canvas</a> doesn't work with PAL8<br><tt><tt>virtual</tt> <a href="CL_Palette.html"><tt><font color=navy><b>CL_Palette</b></font></tt></a>*</tt> <a href="CL_Canvas.html#2203"><tt><font color=blue><b>get_palette</b></font></tt></a><tt>() <tt>const</tt></tt>;<br><blockquote> Returns - NULL</blockquote> <hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2200"><font size=+1><b>CL_Canvas::get_pitch</b></font></a> - returns the pitch of the surface<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2200"><tt><font color=blue><b>get_pitch</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2196"><font size=+1><b>CL_Canvas::get_red_mask</b></font></a> - Returns the bit mask for red <br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2196"><tt><font color=blue><b>get_red_mask</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2206"><font size=+1><b>CL_Canvas::get_src_colorkey</b></font></a> - Returns the transparent color, which was set in the constructor<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2206"><tt><font color=blue><b>get_src_colorkey</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2193"><font size=+1><b>CL_Canvas::get_width</b></font></a> - Returns the width of the surface<br><tt><tt>virtual</tt> <tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt></tt> <a href="CL_Canvas.html#2193"><tt><font color=blue><b>get_width</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2201"><font size=+1><b>CL_Canvas::is_indexed</b></font></a> - returns true if the surface uses indexed colors which is currently not supported (it always returns false)<br><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> <a href="CL_Canvas.html#2201"><tt><font color=blue><b>is_indexed</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2208"><font size=+1><b>CL_Canvas::lock</b></font></a> - Locks the surface so that writing to the surface may occur.<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_Canvas.html#2208"><tt><font color=blue><b>lock</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2202"><font size=+1><b>CL_Canvas::set_palette</b></font></a> - <a href="CL_Canvas.html">CL_Canvas</a> doesn't work with PAL8<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_Canvas.html#2202"><tt><font color=blue><b>set_palette</b></font></tt></a><tt>(<a href="CL_Palette.html"><tt><font color=navy><b>CL_Palette</b></font></tt></a>*)</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2204"><font size=+1><b>CL_Canvas::set_src_colorkey</b></font></a> - Sets the transparent color<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_Canvas.html#2204"><tt><font color=blue><b>set_src_colorkey</b></font></tt></a><tt>(<tt><font color=navy>unsigned</font></tt> <tt><font color=purple>int</font></tt> <tt><font color=blue>transcol</font></tt>)</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2209"><font size=+1><b>CL_Canvas::unlock</b></font></a> - Unlocks the surface.<br> ( Call Unlock when all writing to the surface is done )<br><tt><tt>virtual</tt> <tt><font color=purple>void</font></tt></tt> <a href="CL_Canvas.html#2209"><tt><font color=blue><b>unlock</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2205"><font size=+1><b>CL_Canvas::uses_src_colorkey</b></font></a> - Uses Src Colourkey<br><tt><tt>virtual</tt> <tt><font color=purple>bool</font></tt></tt> <a href="CL_Canvas.html#2205"><tt><font color=blue><b>uses_src_colorkey</b></font></tt></a><tt>() <tt>const</tt></tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <a name="2192"><font size=+1><b>CL_Canvas::~CL_Canvas</b></font></a> - Deletes the DynamicProvider and deletes the data<br> which was allocated in the constructor<br><tt><tt>virtual</tt> </tt> <a href="CL_Canvas.html#2192"><tt><font color=blue><b>~CL_Canvas</b></font></tt></a><tt>()</tt>;<hr size="1" width="70%" align="left" noshade="noshade"><br><br> <hr noshade> <h2>Variable Member Descriptions:</h2> <hr noshade> </body> </html>