csGraphics2D Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
csGraphics2D Class Reference
Common Plugin Classes

This is the base class for 2D canvases. More...

`#include <csplugincommon/canvas/graph2d.h>`

Inheritance diagram for csGraphics2D:

List of all members.

## Public Types
enum | HWMouseMode { hwmcOff, hwmcOn, hwmcRGBAOnly }
| Hardware mouse cursor setting. More...
## Public Member Functions
virtual void | AllowResize (bool)
| Enable/disable canvas resize (Over-ride in sub classes)
virtual bool | BeginDraw ()
| This routine should be called before any draw operations.
virtual void | ChangeDepth (int d)
| Change the depth of the canvas.
virtual void | Clear (int color)
| Clear backbuffer.
virtual void | ClearAll (int color)
| Clear all video pages.
virtual bool | ClipLine (float &x1, float &y1, float &x2, float &y2, int xmin, int ymin, int xmax, int ymax)
| Clip a line against given rectangle Function returns true if line is not visible.
virtual void | Close ()
| (*) Close graphics system
| csGraphics2D (iBase *)
| Create csGraphics2D object.
virtual int | FindRGB (int r, int g, int b, int a=255)
| Find an RGB (0..255) color.
virtual void | FinishDraw ()
| This routine should be called when you finished drawing.
virtual void | GetClipRect (int &xmin, int &ymin, int &xmax, int &ymax)
| Query clipping rectangle.
int | GetColorDepth ()
| Return color depth of the framebuffer.
virtual iFontServer * | GetFontServer ()
| Gets the font server.
void | GetFramebufferDimensions (int &width, int &height)
| Get the dimensions of the framebuffer.
virtual bool | GetFullScreen ()
| Returns 'true' if the program is being run full-screen.
virtual float | GetGamma () const
| Get gamma value.
virtual int | GetHeight ()
| Return the height of the framebuffer.
const char * | GetHWGLVersion ()
| Get a string containing the OpenGL version.
const char * | GetHWRenderer ()
| Get a string containing the hardware renderer.
const char * | GetHWVendor ()
| Get a string containing the vendor info.
virtual const char * | GetName () const
| Get the name of this canvas.
virtual iNativeWindow * | GetNativeWindow ()
| Return the Native Window interface for this canvas (if it has one)
virtual void | GetRGB (int color, int &r, int &g, int &b)
| Retrieve the R,G,B tuple for a given color number.
virtual void | GetRGB (int color, int &r, int &g, int &b, int &a)
| Retrieve the R,G,B,A tuple for a given color number.
void | GetViewport (int &left, int &top, int &width, int &height)
| Get the currently set viewport.
virtual int | GetWidth ()
| Return the width of the framebuffer.
virtual bool | HandleEvent (iEvent &)
| Event handler for plugin.
virtual bool | Initialize (iObjectRegistry *)
| Initialize the plugin.
virtual bool | Open ()
| (*) Open graphics system (set videomode, open window etc)
virtual bool | PerformExtension (char const *command,...)
| Perform a system specific extension.
virtual bool | PerformExtensionV (char const *command, va_list)
| Perform a system specific extension.
virtual void | Print (csRect const *=0)
| (*) Flip video pages (or dump backbuffer into framebuffer).
virtual bool | Resize (int w, int h)
| Resize the canvas.
virtual void | SetClipRect (int xmin, int ymin, int xmax, int ymax)
| Set clipping rectangle.
virtual void | SetFullScreen (bool b)
| Change the fullscreen state of the canvas.
virtual bool | SetGamma (float)
| Set gamma value (if supported by canvas).
virtual bool | SetMouseCursor (csMouseCursorID iShape)
| Set mouse cursor to one of predefined shape classes (see csmcXXX enum above).
virtual bool | SetMouseCursor (iImage *image, const csRGBcolor *keycolor=0, int hotspot_x=0, int hotspot_y=0, csRGBcolor fg=csRGBcolor(255, 255, 255), csRGBcolor bg=csRGBcolor(0, 0, 0))
| Set mouse cursor using an image.
virtual bool | SetMousePosition (int x, int y)
| Set mouse cursor position; return success status.
void | SetViewport (int left, int top, int width, int height)
| Set the viewport (the rectangle of the framebuffer to draw to).
virtual | ~csGraphics2D ()
| Destroy csGraphics2D object.
virtual void | Write (iFont *font, int x, int y, int fg, int bg, const char *text, uint flags=0)
| Write a text string into the back buffer.
virtual void | Write (iFont *font, int x, int y, int fg, int bg, const wchar_t *text, uint flags=0)
| Write a text string into the back buffer.
## Public Attributes
bool | AllowResizing
| Whether to allow resizing.
int | ClipX1
| The clipping rectangle.
csConfigAccess | config
| The configuration file.
int | DisplayNumber
| Display number.
int | fbWidth
| The width, height and depth of visual.
csFontCache * | fontCache
| The font cache.
csWeakRef< iFontServer > | FontServer
| The font server.
int | FrameBufferLocked
| The counter that is incremented inside BeginDraw and decremented in FinishDraw().
bool | FullScreen
| True if visual is full-screen.
bool | is_open
| Open/Close state.
iObjectRegistry * | object_reg
| The object registry.
csWeakRef< iPluginManager > | plugin_mgr
| The plugin manager.
csString | win_title
| Pointer to a title.
## Protected Member Functions
virtual bool | AddWindowFrameDimensions (int &width, int &height)
| Helper function for FitSizeToWorkingArea(): compute window dimensions with the window frame included.
virtual bool | GetWorkspaceDimensions (int &width, int &height)
| Helper function for FitSizeToWorkingArea(): obtain workspace dimensions.
iNativeWindowManager implementation
virtual void | AlertV (int type, const char *title, const char *okMsg, const char *msg, va_list args)
| Show an alert.
virtual void | Alert (int type, const char *title, const char *okMsg, const char *msg,...)
| Show an alert.
virtual void | AlertV (int type, const wchar_t *title, const wchar_t *okMsg, const wchar_t *msg, va_list args)
| Show an alert.
virtual void | Alert (int type, const wchar_t *title, const wchar_t *okMsg, const wchar_t *msg,...)
| Show an alert.
iNativeWindow implementation
virtual void | SetTitle (const char *title)
| Sets the icon of this window with the provided one.
virtual void | SetTitle (const wchar_t *title)
| Sets the icon of this window with the provided one.
virtual void | SetIcon (iImage *image)
| Sets the icon of this window with the provided one.
virtual bool | IsWindowTransparencyAvailable ()
| Sets the icon of this window with the provided one.
virtual bool | SetWindowTransparent (bool transparent)
| Sets the icon of this window with the provided one.
virtual bool | GetWindowTransparent ()
| Sets the icon of this window with the provided one.
virtual bool | SetWindowDecoration (WindowDecoration decoration, bool flag)
| Sets the icon of this window with the provided one.
virtual bool | GetWindowDecoration (WindowDecoration decoration)
| Sets the icon of this window with the provided one.
virtual bool | FitSizeToWorkingArea (int &desiredWidth, int &desiredHeight)
| Sets the icon of this window with the provided one.
iPluginConfig implementation
virtual bool | GetOptionDescription (int idx, csOptionDescription *)
| Get the description of the option of index idx.
virtual bool | SetOption (int id, csVariant *value)
| Set the value of the option of index idx.
virtual bool | GetOption (int id, csVariant *value)
| Get the value of the option of index idx.
iDebugHelper implementation
virtual bool | DebugCommand (const char *cmd)
| Perform a debug command as defined by the module itself.
virtual int | GetSupportedTests () const
| Return a bit field indicating what types of functions this specific unit test implementation supports.
virtual csPtr< iString > | UnitTest ()
virtual csPtr< iString > | StateTest ()
| Perform a state test.
virtual csTicks | Benchmark (int)
| Perform a benchmark.
virtual csPtr< iString > | Dump ()
| Do a text dump of the current state of this object.
virtual void | Dump (iGraphics3D *)
| Do a graphical dump of the current state of this object.
## Protected Attributes
bool | fitToWorkingArea
| Reduce window size to fit into workspace, if necessary.
int | refreshRate
| Screen refresh rate.
bool | vsync
| Activate Vsync.

## Detailed Description

This is the base class for 2D canvases.

Plugins should derive their own class from this one and implement required (marked with an asterisk (*)) functions. Functions not marked with an asterisk are optional, but possibly slow since they are too general.

Definition at line 62 of file graph2d.h.

## Member Enumeration Documentation

enum csGraphics2D::HWMouseMode

Hardware mouse cursor setting.

Enumerator:

  hwmcOff | Never use hardware cursor.
  hwmcOn | Always use hardware cursor, if possible.
  hwmcRGBAOnly | Only use hardware cursor if true RGBA cursor is available.

Definition at line 120 of file graph2d.h.

## Constructor & Destructor Documentation

csGraphics2D::csGraphics2D | ( | iBase * |  | ) |

Create csGraphics2D object.

virtual csGraphics2D::~csGraphics2D | ( |  | ) | `[virtual]`

Destroy csGraphics2D object.

## Member Function Documentation

virtual bool csGraphics2D::AddWindowFrameDimensions | ( | int & | width,
|  | int & | height
| ) |  | `[protected, virtual]`

Helper function for FitSizeToWorkingArea(): compute window dimensions with the window frame included.

virtual void csGraphics2D::Alert | ( | int | type,
|  | const char * | title,
|  | const char * | okMsg,
|  | const char * | msg,
|  |  | ...
| ) |  | `[protected, virtual]`

Show an alert.

Type is one of CS_ALERT_???.

Remarks:
  All strings are expected to be UTF-8 encoded.

See also:
  CS_ALERT_ERROR
  Notes about string formatting in Crystal Space

Implements iNativeWindowManager.

virtual void csGraphics2D::Alert | ( | int | type,
|  | const wchar_t * | title,
|  | const wchar_t * | okMsg,
|  | const wchar_t * | msg,
|  |  | ...
| ) |  | `[protected, virtual]`

Show an alert.

Type is one of CS_ALERT_???.

See also:
  CS_ALERT_ERROR
  Notes about string formatting in Crystal Space

Reimplemented from iNativeWindowManager.

virtual void csGraphics2D::AlertV | ( | int | type,
|  | const char * | title,
|  | const char * | okMsg,
|  | const char * | msg,
|  | va_list | arg
| ) |  | `[protected, virtual]`

Show an alert.

Type is one of CS_ALERT_???.

Remarks:
  All strings are expected to be UTF-8 encoded.

See also:
  CS_ALERT_ERROR
  Notes about string formatting in Crystal Space

Implements iNativeWindowManager.

virtual void csGraphics2D::AlertV | ( | int | type,
|  | const wchar_t * | title,
|  | const wchar_t * | okMsg,
|  | const wchar_t * | msg,
|  | va_list | arg
| ) |  | `[protected, virtual]`

Show an alert.

Type is one of CS_ALERT_???.

See also:
  CS_ALERT_ERROR
  Notes about string formatting in Crystal Space

Reimplemented from iNativeWindowManager.

virtual void csGraphics2D::AllowResize | ( | bool |  | ) | `[inline, virtual]`

Enable/disable canvas resize (Over-ride in sub classes)

Implements iGraphics2D.

Definition at line 256 of file graph2d.h.

virtual bool csGraphics2D::BeginDraw | ( |  | ) | `[virtual]`

This routine should be called before any draw operations.

It should return true if graphics context is ready.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual csTicks csGraphics2D::Benchmark | ( | int | num_iterations | ) | `[inline, protected, virtual]`

Perform a benchmark.

This function will return a number indicating how long the benchmark lasted in milliseconds.

Implements iDebugHelper.

Definition at line 371 of file graph2d.h.

virtual void csGraphics2D::ChangeDepth | ( | int | d | ) | `[virtual]`

Change the depth of the canvas.

virtual void csGraphics2D::Clear | ( | int | color | ) | `[virtual]`

Clear backbuffer.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual void csGraphics2D::ClearAll | ( | int | color | ) | `[virtual]`

Clear all video pages.

Implements iGraphics2D.

virtual bool csGraphics2D::ClipLine | ( | float & | x1,
|  | float & | y1,
|  | float & | x2,
|  | float & | y2,
|  | int | xmin,
|  | int | ymin,
|  | int | xmax,
|  | int | ymax
| ) |  | `[virtual]`

Clip a line against given rectangle Function returns true if line is not visible.

Implements iGraphics2D.

virtual void csGraphics2D::Close | ( |  | ) | `[virtual]`

(*) Close graphics system

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual bool csGraphics2D::DebugCommand | ( | const char * | cmd | ) | `[protected, virtual]`

Perform a debug command as defined by the module itself.

Returns 'false' if the command was not recognized.

Implements iDebugHelper.

Reimplemented in csGraphics2DGLCommon.

virtual csPtr<iString> csGraphics2D::Dump | ( |  | ) | `[inline, protected, virtual]`

Do a text dump of the current state of this object.

Returns 0 if not supported or else a string which you should DecRef() after use.

Implements iDebugHelper.

Definition at line 372 of file graph2d.h.

virtual void csGraphics2D::Dump | ( | iGraphics3D * | g3d | ) | `[inline, protected, virtual]`

Do a graphical dump of the current state of this object.

Implements iDebugHelper.

Definition at line 373 of file graph2d.h.

virtual int csGraphics2D::FindRGB | ( | int | r,
|  | int | g,
|  | int | b,
|  | int | a = `255`
| ) |  | `[inline, virtual]`

Find an RGB (0..255) color.

The actual color bytes are returned.

Use returned value for color arguments in iGraphics2D.

Implements iGraphics2D.

Definition at line 188 of file graph2d.h.

virtual void csGraphics2D::FinishDraw | ( |  | ) | `[virtual]`

This routine should be called when you finished drawing.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual bool csGraphics2D::FitSizeToWorkingArea | ( | int & | desiredWidth,
|  | int & | desiredHeight
| ) |  | `[protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual void csGraphics2D::GetClipRect | ( | int & | xmin,
|  | int & | ymin,
|  | int & | xmax,
|  | int & | ymax
| ) |  | `[virtual]`

Query clipping rectangle.

Implements iGraphics2D.

int csGraphics2D::GetColorDepth | ( |  | ) | `[inline, virtual]`

Return color depth of the framebuffer.

Implements iGraphics2D.

Definition at line 241 of file graph2d.h.

virtual iFontServer* csGraphics2D::GetFontServer | ( |  | ) | `[inline, virtual]`

Gets the font server.

Implements iGraphics2D.

Definition at line 236 of file graph2d.h.

void csGraphics2D::GetFramebufferDimensions | ( | int & | width,
|  | int & | height
| ) |  | `[inline, virtual]`

Get the dimensions of the framebuffer.

Implements iGraphics2D.

Definition at line 303 of file graph2d.h.

virtual bool csGraphics2D::GetFullScreen | ( |  | ) | `[inline, virtual]`

Returns 'true' if the program is being run full-screen.

Implements iGraphics2D.

Definition at line 265 of file graph2d.h.

virtual float csGraphics2D::GetGamma | ( |  | ) | const`[inline, virtual]`

Get gamma value.

Implements iGraphics2D.

Definition at line 221 of file graph2d.h.

virtual int csGraphics2D::GetHeight | ( |  | ) | `[inline, virtual]`

Return the height of the framebuffer.

Implements iGraphics2D.

Definition at line 240 of file graph2d.h.

const char* csGraphics2D::GetHWGLVersion | ( |  | ) | `[inline, virtual]`

Get a string containing the OpenGL version.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

Definition at line 308 of file graph2d.h.

const char* csGraphics2D::GetHWRenderer | ( |  | ) | `[inline, virtual]`

Get a string containing the hardware renderer.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

Definition at line 306 of file graph2d.h.

const char* csGraphics2D::GetHWVendor | ( |  | ) | `[inline, virtual]`

Get a string containing the vendor info.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

Definition at line 310 of file graph2d.h.

virtual const char* csGraphics2D::GetName | ( |  | ) | const`[virtual]`

Get the name of this canvas.

Implements iGraphics2D.

virtual iNativeWindow* csGraphics2D::GetNativeWindow | ( |  | ) | `[virtual]`

Return the Native Window interface for this canvas (if it has one)

Implements iGraphics2D.

virtual bool csGraphics2D::GetOption | ( | int | index,
|  | csVariant * | value
| ) |  | `[protected, virtual]`

Get the value of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:

  index | The index of the option
  value | A variant where to store the value of the option

Implements iPluginConfig.

virtual bool csGraphics2D::GetOptionDescription | ( | int | index,
|  | csOptionDescription * | option
| ) |  | `[protected, virtual]`

Get the description of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:

  index | The index of the option
  option | The returned description of the option

Implements iPluginConfig.

virtual void csGraphics2D::GetRGB | ( | int | color,
|  | int & | r,
|  | int & | g,
|  | int & | b
| ) |  | `[inline, virtual]`

Retrieve the R,G,B tuple for a given color number.

Implements iGraphics2D.

Definition at line 200 of file graph2d.h.

virtual void csGraphics2D::GetRGB | ( | int | color,
|  | int & | r,
|  | int & | g,
|  | int & | b,
|  | int & | a
| ) |  | `[inline, virtual]`

Retrieve the R,G,B,A tuple for a given color number.

Implements iGraphics2D.

Definition at line 206 of file graph2d.h.

virtual int csGraphics2D::GetSupportedTests | ( |  | ) | const`[inline, protected, virtual]`

Return a bit field indicating what types of functions this specific unit test implementation supports.

This will return a combination of the CS_DBGHELP_... flags:

- CS_DBGHELP_BENCHMARK
- CS_DBGHELP_TXTDUMP
- CS_DBGHELP_GFXDUMP
- CS_DBGHELP_STATETEST

Implements iDebugHelper.

Definition at line 368 of file graph2d.h.

void csGraphics2D::GetViewport | ( | int & | left,
|  | int & | top,
|  | int & | width,
|  | int & | height
| ) |  | `[inline, virtual]`

Get the currently set viewport.

Implements iGraphics2D.

Definition at line 300 of file graph2d.h.

virtual int csGraphics2D::GetWidth | ( |  | ) | `[inline, virtual]`

Return the width of the framebuffer.

Implements iGraphics2D.

Definition at line 239 of file graph2d.h.

virtual bool csGraphics2D::GetWindowDecoration | ( | WindowDecoration | decoration | ) | `[protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual bool csGraphics2D::GetWindowTransparent | ( |  | ) | `[inline, protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 348 of file graph2d.h.

virtual bool csGraphics2D::GetWorkspaceDimensions | ( | int & | width,
|  | int & | height
| ) |  | `[protected, virtual]`

Helper function for FitSizeToWorkingArea(): obtain workspace dimensions.

virtual bool csGraphics2D::HandleEvent | ( | iEvent & |  | ) | `[virtual]`

Event handler for plugin.

Implements iEventHandler.

virtual bool csGraphics2D::Initialize | ( | iObjectRegistry * |  | ) | `[virtual]`

Initialize the plugin.

Implements iComponent.

Reimplemented in csGraphics2DGLCommon.

virtual bool csGraphics2D::IsWindowTransparencyAvailable | ( |  | ) | `[inline, protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 346 of file graph2d.h.

virtual bool csGraphics2D::Open | ( |  | ) | `[virtual]`

(*) Open graphics system (set videomode, open window etc)

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual bool csGraphics2D::PerformExtension | ( | char const * | command,
|  |  | ...
| ) |  | `[virtual]`

Perform a system specific extension.

Return false if extension not supported.

Implements iGraphics2D.

virtual bool csGraphics2D::PerformExtensionV | ( | char const * | command,
|  | va_list |
| ) |  | `[virtual]`

Perform a system specific extension.

Return false if extension not supported.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual void csGraphics2D::Print | ( | csRect const * | = `0` | ) | `[inline, virtual]`

(*) Flip video pages (or dump backbuffer into framebuffer).

Implements iGraphics2D.

Definition at line 181 of file graph2d.h.

virtual bool csGraphics2D::Resize | ( | int | w,
|  | int | h
| ) |  | `[virtual]`

Resize the canvas.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual void csGraphics2D::SetClipRect | ( | int | xmin,
|  | int | ymin,
|  | int | xmax,
|  | int | ymax
| ) |  | `[virtual]`

Set clipping rectangle.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual void csGraphics2D::SetFullScreen | ( | bool | b | ) | `[virtual]`

Change the fullscreen state of the canvas.

Implements iGraphics2D.

virtual bool csGraphics2D::SetGamma | ( | float | gamma | ) | `[inline, virtual]`

Set gamma value (if supported by canvas).

By default this is 1. Smaller values are darker. If the canvas doesn't support gamma then this function will return false.

Implements iGraphics2D.

Definition at line 220 of file graph2d.h.

virtual void csGraphics2D::SetIcon | ( | iImage * | image | ) | `[protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual bool csGraphics2D::SetMouseCursor | ( | csMouseCursorID | iShape | ) | `[virtual]`

Set mouse cursor to one of predefined shape classes (see csmcXXX enum above).

If a specific mouse cursor shape is not supported, return 'false'; otherwise return 'true'. If system supports it and iBitmap != 0, shape should be set to the bitmap passed as second argument; otherwise cursor should be set to its nearest system equivalent depending on iShape argument.

Implements iGraphics2D.

virtual bool csGraphics2D::SetMouseCursor | ( | iImage * | image,
|  | const csRGBcolor * | keycolor = `0`,
|  | int | hotspot_x = `0`,
|  | int | hotspot_y = `0`,
|  | csRGBcolor | fg = `csRGBcolor(255, 255, 255)`,
|  | csRGBcolor | bg = `csRGBcolor(0, 0, 0)`
| ) |  | `[virtual]`

Set mouse cursor using an image.

If the operation is unsupported, return 'false' otherwise return 'true'. On some platforms there is only monochrome pointers available. In this all black colors in the image will become the value of 'bg' and all non-black colors will become 'fg'

Implements iGraphics2D.

virtual bool csGraphics2D::SetMousePosition | ( | int | x,
|  | int | y
| ) |  | `[virtual]`

Set mouse cursor position; return success status.

Implements iGraphics2D.

virtual bool csGraphics2D::SetOption | ( | int | index,
|  | csVariant * | value
| ) |  | `[protected, virtual]`

Set the value of the option of index idx.

Return false if this option does not exist, true otherwise.

Parameters:

  index | The index of the option
  value | The new value to be set for the option

Implements iPluginConfig.

virtual void csGraphics2D::SetTitle | ( | const char * | title | ) | `[protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

virtual void csGraphics2D::SetTitle | ( | const wchar_t * | title | ) | `[inline, protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 336 of file graph2d.h.

void csGraphics2D::SetViewport | ( | int | left,
|  | int | top,
|  | int | width,
|  | int | height
| ) |  | `[virtual]`

Set the viewport (the rectangle of the framebuffer to draw to).

Parameters:

  left | Left of the viewport. X=0 will map to this.
  top | Right of the viewport. Y=0 will map to this.
  width | Width of the viewport.
  height | Height of the viewport.

Implements iGraphics2D.

Reimplemented in csGraphics2DGLCommon.

virtual bool csGraphics2D::SetWindowDecoration | ( | WindowDecoration | decoration,
|  | bool | flag
| ) |  | `[inline, protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 350 of file graph2d.h.

virtual bool csGraphics2D::SetWindowTransparent | ( | bool | transparent | ) | `[inline, protected, virtual]`

Sets the icon of this window with the provided one.

Note:
  Virtual SetIcon function so it can be overridden by subclasses of csGraphics2D.

Parameters:

  image | the iImage to set as the icon of this window.

Implements iNativeWindow.

Definition at line 347 of file graph2d.h.

virtual csPtr<iString> csGraphics2D::StateTest | ( |  | ) | `[inline, protected, virtual]`

Perform a state test.

This function will test if the current state of the object is ok. It will return 0 if it is ok. Otherwise an iString is returned containing some information about the errors. DecRef() this returned string after using it.

Implements iDebugHelper.

Definition at line 370 of file graph2d.h.

virtual void csGraphics2D::Write | ( | iFont * | font,
|  | int | x,
|  | int | y,
|  | int | fg,
|  | int | bg,
|  | const char * | text,
|  | uint | flags = `0`
| ) |  | `[virtual]`

Write a text string into the back buffer.

Implements iGraphics2D.

virtual void csGraphics2D::Write | ( | iFont * | font,
|  | int | x,
|  | int | y,
|  | int | fg,
|  | int | bg,
|  | const wchar_t * | text,
|  | uint | flags = `0`
| ) |  | `[virtual]`

Write a text string into the back buffer.

Implements iGraphics2D.

## Member Data Documentation

bool csGraphics2D::AllowResizing

Whether to allow resizing.

Definition at line 104 of file graph2d.h.

int csGraphics2D::ClipX1

The clipping rectangle.

Definition at line 72 of file graph2d.h.

csConfigAccess csGraphics2D::config

The configuration file.

Definition at line 69 of file graph2d.h.

int csGraphics2D::DisplayNumber

Display number.

If 0, use primary display; else if greater than 0, use that display number. If that display number is not present, use primary display.

Definition at line 100 of file graph2d.h.

int csGraphics2D::fbWidth

The width, height and depth of visual.

Definition at line 91 of file graph2d.h.

bool csGraphics2D::fitToWorkingArea`[protected]`

Reduce window size to fit into workspace, if necessary.

Definition at line 136 of file graph2d.h.

csFontCache* csGraphics2D::fontCache

The font cache.

Definition at line 85 of file graph2d.h.

csWeakRef<iFontServer> csGraphics2D::FontServer

The font server.

Definition at line 83 of file graph2d.h.

int csGraphics2D::FrameBufferLocked

The counter that is incremented inside BeginDraw and decremented in FinishDraw().

Definition at line 109 of file graph2d.h.

bool csGraphics2D::FullScreen

True if visual is full-screen.

Definition at line 102 of file graph2d.h.

bool csGraphics2D::is_open

Open/Close state.

Definition at line 75 of file graph2d.h.

iObjectRegistry* csGraphics2D::object_reg

The object registry.

Definition at line 78 of file graph2d.h.

csWeakRef<iPluginManager> csGraphics2D::plugin_mgr

The plugin manager.

Definition at line 80 of file graph2d.h.

int csGraphics2D::refreshRate`[protected]`

Screen refresh rate.

Definition at line 132 of file graph2d.h.

bool csGraphics2D::vsync`[protected]`

Activate Vsync.

Definition at line 134 of file graph2d.h.

csString csGraphics2D::win_title

Pointer to a title.

Definition at line 88 of file graph2d.h.

The documentation for this class was generated from the following file:

- csplugincommon/canvas/graph2d.h