CL_DisplayCard3
The display card class.
Overview
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.
Class members
- virtual const std::list<CL_VidMode*> &
get_videomodes()
- virtual std::string
get_name()
- virtual int
get_total_memory()
- virtual int
get_card_no()
- virtual
~CL_DisplayCard()
- virtual void
flip_display( -
bool sync=false)
- 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)
- 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
fill_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)
- virtual void
sync_buffers()
Members with descriptions
- virtual const std::list<CL_VidMode*> &
get_videomodes() -
Description:
Get list of videomodes available on this card.
Return value:
Returns the list of videomodes.
- virtual std::string
get_name() -
Description:
Get name of the card.
Return value:
Returns the card name.
- virtual int
get_total_memory() -
Description:
Get videomemory available.
Return value:
Videomemory available, or -1 if unknown.
- virtual int
get_card_no() -
Description:
Get card number.
Return value:
Card number.
- virtual
~CL_DisplayCard() -
Description:
- virtual void
flip_display( -
bool sync=false)
Parameters: sync - VSync on/off
Description:
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
clear_display( -
float red=0, float green=0, float blue=0, float alpha=1)
Parameters: 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.
Description:
Clears backbuffer with the specified color.
- virtual void
set_palette( -
CL_Palette *palette)
Parameters: palette - Palette to use as new system palette.
Description:
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 CL_Palette *
get_palette() -
Description:
Return the current system palette on this card.
Return value:
The system palette.
- virtual void
set_videomode( -
CL_VidMode *mode)
Parameters: mode - videomode to be changed to.
Description:
Change the display card's video mode.
- virtual void
set_videomode( -
int width, int height, int bpp, bool fullscreen = true, bool allow_resize = false)
Parameters: 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)
Description:
Change the display card's video mode.
- virtual bool
is_initialized() -
Description:
Returns true if the display card is in a video mode.
Return value:
true if initialized.
- virtual CL_Target*
get_target() -
Description:
Return either NULL or the Target that is blitted to (aka Framebuffer)!retval: NULL if Framebuffer access is not possible, CL_Target if it is
- virtual int
get_width() -
Description:
Returns the width of the current video mode.
Return value:
Width of video mode.
- virtual int
get_height() -
Description:
Returns the height of the current video mode.
Return value:
Height of video mode.
- virtual int
get_bpp() -
Description:
Returns the depth of the current video mode.
Return value:
Depth of video mode.
- 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 with the old one 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.
- virtual void
fill_rect( -
int x1, int y1, int x2, int y2, float r, float g, float b, float a)
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)
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).
- virtual void
sync_buffers() -
Description:
Copies the contents of the frontbuffer to all other buffers (usually justthe backbuffer). This ensures that all buffers contain the same image.