ClanSoft logo
ClanSoft logo
Entire Class Index Main Class Index Cross Index Global Index

Class CL_DisplayCard

The display card class.
Contained in: global
Derived from: none
Derived by: none
Group: Display (Display 2D)

#include <ClanLib/display.h>


public function member index:

Construction:

virtual ~CL_DisplayCard();

Operations (Display Functions):

virtual void flip_display(bool sync=false);
virtual void put_display(const class CL_Rect& rect);
virtual void sync_buffers();
virtual void clear_display(float red=0, float green=0, float blue=0, float alpha=1);
virtual void set_palette(CL_Palette* palette);
virtual CL_Palette* get_palette();
virtual void set_videomode(CL_VidMode* mode);
virtual void set_videomode(int width, int height, int bpp, bool fullscreen = true, bool allow_resize = false, bool video_memory = true);

Attributes:

virtual const std::list<CL_VidMode*>& get_videomodes();
virtual std::string get_name();
virtual int get_total_memory();
virtual int get_card_no();
virtual bool is_initialized();
virtual CL_Target* get_target();
virtual int get_width();
virtual int get_height();
virtual int get_bpp();
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();
virtual void push_translate_offset();
virtual void push_translate_offset(int x, int y);
virtual int get_translate_offset_x();
virtual int get_translate_offset_y();
virtual void set_translate_offset(int x, int y);
virtual void pop_translate_offset();

Operations (Draw Functions):

virtual void fill_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a);
virtual void draw_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a);
virtual void draw_line(int x1, int y1, int x2, int y2, float r, float g, float b, float a);

Signals:

virtual CL_Signal_v2<int, int>& sig_resized();
virtual CL_Signal_v1<const CL_Rect& >& sig_paint();
 

Description:

This class represents a display card in ClanLib. It is mainly used to set the videomode, flip the display and do simple graphics operations such as filled rectangles or drawing lines.

If you're always only using one display card at the time, you may want to consider using the static functions in CL_Display instead. They do exactly the same, but operates on a selected display card instead (default the primary card). This saves you from passing around a pointer to the displaycard.


Function Member Descriptions:

CL_DisplayCard::clear_display - Clears backbuffer with the specified color.
virtual void clear_display(float red=0, float green=0, float blue=0, float alpha=1);
red - red component of the color.
green - green component of the color.
blue - blue component of the color.
alpha - alpha (transparency) component of the color.



CL_DisplayCard::draw_line - Draw a line 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);
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.



CL_DisplayCard::draw_rect - Draw a rectangle from ('x1', 'y1') to ('x2', 'y2') using the color ('r', 'g', 'b', 'a').
virtual void draw_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a);
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.



CL_DisplayCard::fill_rect - Draw a filled rectangle from ('x1', 'y1') to ('x2', 'y2') using the color ('r', 'g', 'b', 'a').
virtual void fill_rect(int x1, int y1, int x2, int y2, float r, float g, float b, float a);
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.



CL_DisplayCard::flip_display - Flips the front and backbuffer. Everything is normally drawn to the backbuffer, and flip_display() needs to be called before it can be seen onto the screen.
virtual void flip_display(bool sync=false);
sync - VSync on/off



CL_DisplayCard::get_bpp - Returns the depth of the current video mode.
virtual int get_bpp();
Returns - Depth of video mode.



CL_DisplayCard::get_card_no - Get card number.
virtual int get_card_no();
Returns - Card number.



CL_DisplayCard::get_clip_rect - Returns the current clipping rectangle.
virtual CL_ClipRect get_clip_rect();
Returns - The current clipping rectangle.



CL_DisplayCard::get_height - Returns the height of the current video mode.
virtual int get_height();
Returns - Height of video mode.



CL_DisplayCard::get_name - Get name of the card.
virtual std::string get_name();
Returns - Returns the card name.



CL_DisplayCard::get_palette - Return the current system palette on this card.
virtual CL_Palette* get_palette();
Returns - The system palette.



CL_DisplayCard::get_target - Return either NULL or the Target that is blitted to (aka Framebuffer)
virtual CL_Target* get_target();
Returns - NULL if Framebuffer access is not possible, CL_Target if it is



CL_DisplayCard::get_total_memory - Get videomemory available.
virtual int get_total_memory();
Returns - Videomemory available, or -1 if unknown.



CL_DisplayCard::get_translate_offset_x - Returns the current effective x-axis translation offset.
virtual int get_translate_offset_x();


CL_DisplayCard::get_translate_offset_y - Returns the current effective y-axis translation offset.
virtual int get_translate_offset_y();


CL_DisplayCard::get_videomodes - Get list of videomodes available on this card.
virtual const std::list<CL_VidMode*>& get_videomodes();
Returns - Returns the list of videomodes.



CL_DisplayCard::get_width - Returns the width of the current video mode.
virtual int get_width();
Returns - Width of video mode.



CL_DisplayCard::is_initialized - Returns true if the display card is in a video mode.
virtual bool is_initialized();
Returns - true if initialized.



CL_DisplayCard::pop_clip_rect - Pop the clipping rectangle last pushed onto the stack.
virtual void pop_clip_rect();


CL_DisplayCard::pop_translate_offset - Pops the last pushed translation offset from the translation offset stack. If the stack is empty, nothing will happen, and if the last translation offset is popped, the translation offset will be set to 0,0
virtual void pop_translate_offset();


CL_DisplayCard::push_clip_rect - Pushes the current clipping rectangle onto the cliprect stack.
virtual void push_clip_rect();


CL_DisplayCard::push_clip_rect - 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 void push_clip_rect(const CL_ClipRect& rect);
rect - The new clipping rectangle to be with the old one and then used.



CL_DisplayCard::push_translate_offset - Pushes the current translation rectangle onto the cliprect stack.
virtual void push_translate_offset();


CL_DisplayCard::push_translate_offset - Push translation offset onto translation stack. This offset will affect any subsequent display operations on the displaycard, by translating the position of the display operation with the offset. The offset will be offset by any previous offsets pushed onto the stack, eg. it inherits the previous offset.
virtual void push_translate_offset(int x, int y);


CL_DisplayCard::put_display - Copies the specified area of the backbuffer to the front buffer. This is in particular useful if you only want to update a limited region, and not do a full-blown flipping.
virtual void put_display(const class CL_Rect& rect);


CL_DisplayCard::set_clip_rect - Sets the current clipping rectangle. This is an absolute set, so it doesn't get clipped with the previous one.
virtual void set_clip_rect(const CL_ClipRect& rect);


CL_DisplayCard::set_palette - Set system palette on this card.

If the display card is in a non-palettelized mode, this will be the palette used when surfaceproviders doesn't specify a palette themself.
virtual void set_palette(CL_Palette* palette);
palette - Palette to use as new system palette.



CL_DisplayCard::set_translate_offset - Sets the translation offset as a new absolute translation offset. The new offset will disregard any previous offset's, but will not empty the translation stack. The new translation offset will affect any subsequent display operations on the displaycard, by translating the position of the display operation with the offset
virtual void set_translate_offset(int x, int y);


CL_DisplayCard::set_videomode - Change the display card's video mode.
virtual void set_videomode(int width, int height, int bpp, bool fullscreen = true, bool allow_resize = false, bool video_memory = true);
width - width in pixels of the new video mode.
height - height in pixels of the new video mode.
bpp - Bits per pixel. The depth of the new video mode. (8, 16, 24, 32)
video_memory - Use video memory if possible. System memory may be faster if alpha blending is used a lot.



CL_DisplayCard::set_videomode - Change the display card's video mode.
virtual void set_videomode(CL_VidMode* mode);
mode - videomode to be changed to.



CL_DisplayCard::sig_paint - Returns the paint signal for the display card.
Use this signal to listen for invalidated screen areas that need to be repainted.
The parameter passed by the signal is the area that need a repaint.
virtual CL_Signal_v1<const CL_Rect& >& sig_paint();


CL_DisplayCard::sig_resized - Returns the resize signal for the display card.
You can use this signal to listen for window resize events.
The parameters passed by the signal are the new width and height of the window.
virtual CL_Signal_v2<int, int>& sig_resized();


CL_DisplayCard::sync_buffers - Copies the contents of the frontbuffer to all other buffers (usually just the backbuffer). This ensures that all buffers contain the same image.
virtual void sync_buffers();


CL_DisplayCard::~CL_DisplayCard - Display Card Destructor
virtual ~CL_DisplayCard();