NAME
CL_Target - Target class in ClanLib.
DESCRIPTION
The CL_Target class represents a renderer target in ClanLib. This can be a part of the framebuffer, or a piece of memory specified by the application.
This class contains a set of functions used to describe a piece of memory, things such as the width, height, color masks and depth. This information can then be used by ClanLib or the application to access the given piece of memory.
To access the memory itself, call get_data() after a call to lock(). When you are finished accessing the memory, call unlock(). Note that after the unlock() call, the pointer obtained from get_data() will be invalid, and new call to lock() is required before get_data() will return anything valid.
CL_Target contain a set of functions doing simple primitive operations: draw boxes, lines and clipping. These are provided for convience so you won't have to do such simple things manually in a lock session.
CL_Surface supports blitting to a target and all surface providers are inheritated from a target. This means that you can do surface to provider blitting. ClanLib has a special surface provider called CL_Canvas which you should use to easilly build a new image.
CLASS MEMBERS
- virtual ~CL_Target()
- virtual bool is_video()
- virtual void lock()
- virtual void unlock()
- virtual void *get_data()
- virtual unsigned int get_num_frames()
- virtual unsigned int get_width()
- virtual unsigned int get_height()
- virtual unsigned int get_pitch()
- virtual unsigned int get_depth()
- virtual unsigned int get_bytes_per_pixel()
- virtual bool is_indexed()
- 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 CL_Palette *get_palette()
- virtual void push_clip_rect()
- virtual void push_clip_rect(
-
const CL_ClipRect &rect)
- virtual CL_ClipRect get_clip_rect()
- virtual void set_clip_rect(
-
const CL_ClipRect &rect)
- virtual void pop_clip_rect()
- void draw_pixel(
-
int x1, int y1, int color)
- virtual void draw_pixel(
-
int x, int y, float r, float g, float b, float a = 1.0)
- virtual void get_pixel(
-
int x, int y, float *r, float *g, float *b, float *a)
- virtual int get_pixel(
-
int x, int y)
- virtual void fill_rect(
-
int x1, int y1, int x2, int y2, float r, float g, float b, float a = 1.0)
- virtual void draw_line(
-
int x1, int y1, int x2, int y2, float r, float g, float b, float a = 1.0)
MEMBERS WITH DESCRIPTIONS
- virtual ~CL_Target()
-
Description:
- virtual bool is_video()
-
Description:
Returns true if in video memory.
Return value:
True if stored in video memory, false otherwise.
- virtual void lock()
-
Description:
Locks the target. This allows access to the target data using theget_data() function call.
- virtual void unlock()
-
Description:
Unlock the target. Must be called after you're finished with modifyingthe target data.
- virtual void *get_data()
-
Description:
Returns a pointer to the target data. Only valid between lock/unlockcalls.
Return value:
A pointer that points to the beginning of the target pixel data.
- virtual unsigned int get_num_frames()
-
Description:
Returns the number of frames available on this target.
- virtual unsigned int get_width()
-
Description:
Returns the width of the target.
- virtual unsigned int get_height()
-
Description:
Returns the height of the target.
- virtual unsigned int get_pitch()
-
Description:
Returns the pitch (bytes per line) used by the target.
- virtual unsigned int get_depth()
-
Description:
Returns the depth used by the target.
- virtual unsigned int get_bytes_per_pixel()
-
Description:
Returns the bytes per pixel of the target.
- virtual bool is_indexed()
-
Description:
Returns whether the target uses an indexed color mode or not.
- virtual unsigned int get_red_mask()
-
Description:
Returns the red color mask used by the target.
- virtual unsigned int get_green_mask()
-
Description:
Returns the green color mask by the target.
- virtual unsigned int get_blue_mask()
-
Description:
Returns the blue color mask by the target.
- virtual unsigned int get_alpha_mask()
-
Description:
Returns the alpha mask by the target.
- virtual CL_Palette *get_palette()
-
Description:
Returns the palette used by the target.
- virtual void push_clip_rect()
-
Description:
Pushes the current clipping rectangle onto the cliprect stack.
- virtual void push_clip_rect(
-
const CL_ClipRect &rect)
Parameters: rect - The new clipping rectangle to be clipped with the current cliprect and then used.
Description:
Pushes the current clipping rectangle onto the cliprect stack. It then clips the passed rectangle rect with the current one, and uses the result as the new clipping rect.
- virtual CL_ClipRect get_clip_rect()
-
Description:
Returns the current clipping rectangle.
Return value:
The current clipping rectangle.
- virtual void set_clip_rect(
-
const CL_ClipRect &rect)
Description:
Sets the current clipping rectangle. This is an absolute set, so it doesn'tget clipped with the previous one.
- virtual void pop_clip_rect()
-
Description:
Pop the clipping rectangle last pushed onto the stack.
- void draw_pixel(
-
int x1, int y1, int color)
Description:
TODO add documentation...
- virtual void draw_pixel(
-
int x, int y, float r, float g, float b, float a = 1.0)
Description:
- virtual void get_pixel(
-
int x, int y, float *r, float *g, float *b, float *a)
Description:
- virtual int get_pixel(
-
int x, int y)
Description:
- virtual void fill_rect(
-
int x1, int y1, int x2, int y2, float r, float g, float b, float a = 1.0)
Parameters: x1 - Leftmost x-coordinate. y1 - Upper y-coordinate. x2 - Rightmost x-coordinate. y2 - Lower y-coordinate. r - Red component of the filled color. g - Green component of the filled color. b - Blue component of the filled color. a - Alpha component of the filled color.
Description:
Draw a filled rectangle from (x1, y1) to (x2, y2) using the color(r, g, b, a).
- virtual void draw_line(
-
int x1, int y1, int x2, int y2, float r, float g, float b, float a = 1.0)
Parameters: x1 - Leftmost x-coordinate. //FIXME y1 - Upper y-coordinate. x2 - Rightmost x-coordinate. y2 - Lower y-coordinate. r - Red component of the filled color. g - Green component of the filled color. b - Blue component of the filled color. a - Alpha component of the filled color.
Description:
Draw a line from (x1, y1) to (x2, y2) using the color(r, g, b, a).
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.