---
name: "CL_DisplayCard"
section: "3"
platform: "linux"
package: "clanlib0-common-dev"
version: "0.4.4-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/CL_DisplayCard"
---

# CL\_DisplayCard(3)

The display card class.

## NAME

CL\_DisplayCard - The display card class.

## 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.

## 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.

## SEE ALSO

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

## AUTHORS

Originally written by Magnus Norddahl \<*mbn@dark.x.dtu.dk*\> and Martin Starch \<*starch@dark.x.dtu.dk*\>. 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.
