Reference

CL_Canvas(3)

Empty surfaceprovider to be used as a rendering target.

NAME

CL_Canvas - Empty surfaceprovider to be used as a rendering target.

DESCRIPTION

CL_Canvas is a surface provider useful to create images at run-time.

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.

There are three ways to do this (and you can mix them as you please):

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.

Use the drawing primitives available in CL_Target. This includes line drawing, fill rects and clipping.

Use the put_target() function in CL_Surface (create the image from other surfaces).

Inherited from public CL_SurfaceProvider

CLASS MEMBERS

static CL_Surface *create(
 int width,
int height,
int no_sprs = 1,
int red_mask = 0xff000000,
int green_mask = 0x00ff0000,
int blue_mask = 0x0000ff00,
int alpha_mask = 0x000000ff,
bool use_transcol = false,
unsigned int transcol = 0)

CL_Canvas(
 int width,
int height,
int no_sprs = 1,
int red_mask = 0xff000000,
int green_mask = 0x00ff0000,
int blue_mask = 0x0000ff00,
int alpha_mask = 0x000000ff,
bool use_transcol = false,
unsigned int transcol = 0)

virtual ~CL_Canvas()
virtual unsigned int get_width()
virtual unsigned int get_height()
virtual unsigned int get_num_frames()
virtual unsigned int get_red_mask()
virtual unsigned int get_green_mask()
virtual unsigned int get_blue_mask()
virtual unsigned int get_alpha_mask()
virtual unsigned int get_pitch()
virtual bool is_indexed()
virtual void set_palette(
CL_Palette* palette)

virtual CL_Palette *get_palette()
virtual void set_src_colorkey(
unsigned int transcol)

virtual bool uses_src_colorkey()
virtual unsigned int get_src_colorkey()
virtual void *get_data()
virtual void lock()
virtual void unlock()

MEMBERS WITH DESCRIPTIONS

static CL_Surface *create(
 int width,
int height,
int no_sprs = 1,
int red_mask = 0xff000000,
int green_mask = 0x00ff0000,
int blue_mask = 0x0000ff00,
int alpha_mask = 0x000000ff,
bool use_transcol = false,
unsigned int transcol = 0)

Parameters:
width - the width of the surface to be created
height - the height of the surface to be created
no_sprs - the number of sprites the surface will have
red_mask - the bit mask for red
blue_mask - the bit mask for blue
green_mask - the bit mask for green
alpha_mask - the bit mask for the alpha 
use_transcol - whether the surface should use source key transparancy
transcol - the (optional) source key color

Description:

Creates the surface. has to be blitted by the dynamic blitter at the moment

CL_Canvas(
 int width,
int height,
int no_sprs = 1,
int red_mask = 0xff000000,
int green_mask = 0x00ff0000,
int blue_mask = 0x0000ff00,
int alpha_mask = 0x000000ff,
bool use_transcol = false,
unsigned int transcol = 0)

Parameters:
width - the width of the surface to be created
height - the height of the surface to be created
no_sprs - the number of sprites the surface will have
red_mask - the bit mask for red
blue_mask - the bit mask for blue
green_mask - the bit mask for green
alpha_mask - the bit mask for the alpha 
use_transcol - whether the surface should use source key transparancy
transcol - the (optional) source key color

Description:

Constructs the Canvas.

virtual ~CL_Canvas()
Description:

Deletes the DynamicProvider and deletes the datawhich was allocated in the constructor

virtual unsigned int get_width()
Description:

Returns the width of the surface

virtual unsigned int get_height()
Description:

Returns the height of the surface

virtual unsigned int get_num_frames()
Description:

Returns the number of frames (sprites) for this surface

virtual unsigned int get_red_mask()
Description:

Returns the bit mask for red

virtual unsigned int get_green_mask()
Description:

Returns the bit mask for green

virtual unsigned int get_blue_mask()
Description:

Returns the bit mask for blue

virtual unsigned int get_alpha_mask()
Description:

Returns the bit mask for the alpha

virtual unsigned int get_pitch()
Description:

returns the pitch of the surface

virtual bool is_indexed()
Description:

returns true if the surface uses indexed colorswhich is currently not supported (it alwaysreturns false)

virtual void set_palette(
CL_Palette* palette)

Description:

CL_Canvas doesn't work with PAL8

virtual CL_Palette *get_palette()
Description:

CL_Canvas doesn't work with PAL8 retval! NULL

virtual void set_src_colorkey(
unsigned int transcol)

Description:

Sets the transparent color

virtual bool uses_src_colorkey()
Description:

virtual unsigned int get_src_colorkey()
Description:

Returns the transparent color, which was set in the constructor

virtual void *get_data()
Description:

Returns the pointer to the surface data, where youcan copy your data to. It should beonly called between lock() and unlock().

virtual void lock()
Description:

Locks the surface so that writing to the surfacemay occur.

virtual void unlock()
Description:

Unlocks the surface.( Call Unlock when all writing to the surface is done )
CL_Palette* palette;

SEE ALSO

All ClanLib API classes can be found in clanlib (3).

AUTHORS

Originally written by Magnus Norddahl <[email protected]> and Martin Starch <[email protected]>. ClanLib is now developed by the ClanLib Development team as an Open Source project.

The ClanLib man pages was created using the Perceps documentation system (another excellent piece of Open Source software, available at http://somewhere.in.the.world.org).

See clanlib (3) to find out how to get a full list of contributors and details on how to submit bug reports, comments etc.