csGraphics2D Class Reference
[Common Plugin Classes]
This is the base class for 2D canvases.
More...
#include <csplugincommon/canvas/graph2d.h>
Inheritance diagram for csGraphics2D:

Public Member Functions | |
virtual void | ChangeDepth (int d) |
Change the depth of the canvas. | |
csGraphics2D (iBase *) | |
Create csGraphics2D object. | |
virtual | ~csGraphics2D () |
Destroy csGraphics2D object. | |
virtual bool | Initialize (iObjectRegistry *) |
Initialize the plugin. | |
virtual bool | HandleEvent (iEvent &) |
Event handler for plugin. | |
virtual bool | Open () |
(*) Open graphics system (set videomode, open window etc) | |
virtual void | Close () |
(*) Close graphics system | |
virtual void | SetClipRect (int xmin, int ymin, int xmax, int ymax) |
Set clipping rectangle. | |
virtual void | GetClipRect (int &xmin, int &ymin, int &xmax, int &ymax) |
Query clipping rectangle. | |
virtual bool | BeginDraw () |
This routine should be called before any draw operations. | |
virtual void | FinishDraw () |
This routine should be called when you finished drawing. | |
virtual void | Print (csRect const *area=0) |
(*) Flip video pages (or dump backbuffer into framebuffer). | |
virtual int | GetPage () |
Get active videopage number (starting from zero). | |
virtual bool | DoubleBuffer (bool Enable) |
Enable or disable double buffering; return TRUE if supported. | |
virtual bool | GetDoubleBufferState () |
Return current double buffering state. | |
virtual void | Clear (int color) |
Clear backbuffer. | |
virtual void | ClearAll (int color) |
Clear all video pages. | |
virtual void | DrawPixel (int x, int y, int color) |
Same but exposed through iGraphics2D interface. | |
virtual void | DrawPixels (csPixelCoord const *pixels, int num_pixels, int color) |
Draw an array of pixel coordinates with the given color. | |
virtual void | Blit (int x, int y, int width, int height, unsigned char const *data) |
Blit a memory block. Format of the image is RGBA in bytes. Row by row. | |
virtual void | DrawLine (float x1, float y1, float x2, float y2, int color) |
Draw a line. | |
virtual void | DrawBox (int x, int y, int w, int h, int color) |
Draw a box of given width and height. | |
virtual void | SetRGB (int i, int r, int g, int b) |
(*) Set a color index to given R,G,B (0..255) values | |
virtual int | FindRGB (int r, int g, int b, int a=255) |
Find an RGB (0..255) color. | |
virtual void | GetRGB (int color, int &r, int &g, int &b) |
Retrieve the R,G,B tuple for a given color index. | |
virtual void | GetRGB (int color, int &r, int &g, int &b, int &a) |
Retrieve the R,G,B,A tuple for a given color index. | |
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 | WriteBaseline (iFont *font, int x, int y, int fg, int bg, const char *text) |
Write a text string into the back buffer. | |
virtual unsigned char * | GetPixelAt (int x, int y) |
Same but exposed through iGraphics2D interface. | |
virtual int | GetPalEntryCount () |
Return the number of palette entries that can be modified. | |
virtual int | GetPixelBytes () |
Return the number of bytes for every pixel. | |
virtual csPixelFormat const * | GetPixelFormat () |
Return information about about the pixel format. | |
virtual csImageArea * | SaveArea (int x, int y, int w, int h) |
Save a subarea of screen area into the variable Data. | |
virtual void | RestoreArea (csImageArea *Area, bool Free=true) |
Restore a subarea of screen saved with SaveArea(). | |
virtual void | FreeArea (csImageArea *Area) |
Free storage allocated for a subarea of screen. | |
virtual bool | SetGamma (float) |
Set gamma value (if supported by canvas). | |
virtual float | GetGamma () const |
Get gamma value. | |
virtual csPtr< iGraphics2D > | CreateOffscreenCanvas (void *memory, int width, int height, int depth, iOffscreenCanvasCallback *ofscb) |
Create an off-screen canvas so you can render on a given memory area. | |
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 iFontServer * | GetFontServer () |
Gets the font server. | |
virtual int | GetWidth () |
Return the width of the framebuffer. | |
virtual int | GetHeight () |
Return the height of the framebuffer. | |
virtual csRGBpixel * | GetPalette () |
Get the palette (if there is one). | |
virtual void | GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB) |
Query pixel R,G,B at given screen location. | |
virtual void | GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB, uint8 &oA) |
As GetPixel() above, but with alpha. | |
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 csPtr< iImage > | ScreenShot () |
Do a screenshot: return a new iImage object. | |
virtual void | AllowResize (bool) |
Enable/disable canvas resize (Over-ride in sub classes). | |
virtual bool | Resize (int w, int h) |
Resize the canvas. | |
virtual iNativeWindow * | GetNativeWindow () |
Return the Native Window interface for this canvas (if it has one). | |
virtual bool | GetFullScreen () |
Returns 'true' if the program is being run full-screen. | |
virtual void | SetFullScreen (bool b) |
Change the fullscreen state of the canvas. | |
virtual bool | SetMousePosition (int x, int y) |
Set mouse cursor position; return success status. | |
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. | |
Public Attributes | |
csConfigAccess | config |
The configuration file. | |
int | ClipX1 |
The clipping rectangle. | |
int | ClipX2 |
The clipping rectangle. | |
int | ClipY1 |
The clipping rectangle. | |
int | ClipY2 |
The clipping rectangle. | |
csPixelFormat | pfmt |
The pixel format. | |
unsigned char * | Memory |
Most systems have a pointer to (real or pseudo) video RAM. | |
bool | is_open |
Open/Close state. | |
int * | LineAddress |
Keep a array of Y*width to avoid multiplications. | |
iObjectRegistry * | object_reg |
The object registry. | |
csWeakRef< iPluginManager > | plugin_mgr |
The plugin manager. | |
csRef< iOffscreenCanvasCallback > | ofscb |
Callback to use for informing an external agent when several canvas operations have occured. | |
csWeakRef< iFontServer > | FontServer |
The font server. | |
csFontCache * | fontCache |
The font cache. | |
char * | win_title |
Pointer to a title. | |
int | Width |
The width, height and depth of visual. | |
int | Height |
The width, height and depth of visual. | |
int | Depth |
The width, height and depth of visual. | |
int | DisplayNumber |
Display number. | |
bool | FullScreen |
True if visual is full-screen. | |
bool | AllowResizing |
Whether to allow resizing. | |
csRGBpixel * | Palette |
256-color palette. | |
bool | PaletteAlloc [256] |
true if some palette entry is already allocated. | |
int | FrameBufferLocked |
The counter that is incremented inside BeginDraw and decremented in FinishDraw(). | |
void(* | _DrawPixel )(csGraphics2D *This, int x, int y, int color) |
Draw a pixel. | |
unsigned char *(* | _GetPixelAt )(csGraphics2D *This, int x, int y) |
(*) Get address of video RAM at given x,y coordinates | |
Protected Member Functions | |
virtual bool | DebugCommand (const char *cmd) |
Execute a debug command. | |
Static Protected Member Functions | |
void | DrawPixel8 (csGraphics2D *This, int x, int y, int color) |
Draw a pixel in 8-bit modes. | |
unsigned char * | GetPixelAt8 (csGraphics2D *This, int x, int y) |
Return address of a 8-bit pixel. | |
void | DrawPixel16 (csGraphics2D *This, int x, int y, int color) |
Draw a pixel in 16-bit modes. | |
unsigned char * | GetPixelAt16 (csGraphics2D *This, int x, int y) |
Return address of a 16-bit pixel. | |
void | DrawPixel32 (csGraphics2D *This, int x, int y, int color) |
Draw a pixel in 32-bit modes. | |
unsigned char * | GetPixelAt32 (csGraphics2D *This, int x, int y) |
Return address of a 32-bit pixel. | |
Protected Attributes | |
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 55 of file graph2d.h.
Constructor & Destructor Documentation
|
Create csGraphics2D object.
|
|
Destroy csGraphics2D object.
|
Member Function Documentation
|
Enable/disable canvas resize (Over-ride in sub classes).
Implements iGraphics2D. |
|
This routine should be called before any draw operations. It should return true if graphics context is ready. Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Blit a memory block. Format of the image is RGBA in bytes. Row by row.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Change the depth of the canvas.
|
|
Clear backbuffer.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Clear all video pages.
Implements iGraphics2D. |
|
Clip a line against given rectangle Function returns true if line is not visible.
Implements iGraphics2D. |
|
(*) Close graphics system
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Create an off-screen canvas so you can render on a given memory area. If depth==8 then the canvas will use palette mode. In that case you can do SetRGB() to initialize the palette. The callback interface (if given) is used to communicate from the canvas back to the caller. You can use this to detect when the texture data has changed for example. Implements iGraphics2D. |
|
Execute a debug command.
Reimplemented in csGraphics2DGLCommon. |
|
Enable or disable double buffering; return TRUE if supported.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Draw a box of given width and height.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Draw a line.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Same but exposed through iGraphics2D interface.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Draw a pixel in 16-bit modes.
|
|
Draw a pixel in 32-bit modes.
|
|
Draw a pixel in 8-bit modes.
|
|
Draw an array of pixel coordinates with the given color.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Find an RGB (0..255) color. If there is a palette, this returns an entry index set with SetRGB(). If the returned value is -1, a suitable palette entry was not found. Without a palette, the actual color bytes are returned. Use returned value for color arguments in iGraphics2D. Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
This routine should be called when you finished drawing.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Free storage allocated for a subarea of screen.
Implements iGraphics2D. |
|
Query clipping rectangle.
Implements iGraphics2D. |
|
Return current double buffering state.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Gets the font server.
Implements iGraphics2D. |
|
Returns 'true' if the program is being run full-screen.
Implements iGraphics2D. |
|
Get gamma value.
Implements iGraphics2D. |
|
Return the height of the framebuffer.
Implements iGraphics2D. |
|
Return the Native Window interface for this canvas (if it has one).
Implements iGraphics2D. |
|
Get active videopage number (starting from zero).
Implements iGraphics2D. |
|
Return the number of palette entries that can be modified. This should return 0 if there is no palette (true color displays). This function is equivalent to the PalEntries field that you get from GetPixelFormat(). It is just a little bit easier to obtain this way. Implements iGraphics2D. |
|
Get the palette (if there is one).
Implements iGraphics2D. |
|
As GetPixel() above, but with alpha.
Implements iGraphics2D. |
|
Query pixel R,G,B at given screen location.
Implements iGraphics2D. |
|
Same but exposed through iGraphics2D interface.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. Definition at line 234 of file graph2d.h. Referenced by csG2DDrawBox< Tpixel, Tpixmixer >::DrawBox(), and csG2DDrawLine< Tpixel, Tpixmixer >::DrawLine(). |
|
Return address of a 16-bit pixel.
|
|
Return address of a 32-bit pixel.
|
|
Return address of a 8-bit pixel.
|
|
Return the number of bytes for every pixel. This function is equivalent to the PixelBytes field that you get from GetPixelFormat(). Implements iGraphics2D. |
|
Return information about about the pixel format.
Implements iGraphics2D. |
|
Retrieve the R,G,B,A tuple for a given color index.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Retrieve the R,G,B tuple for a given color index.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. Referenced by csGraphics2DGLCommon::GetRGB(). |
|
Return the width of the framebuffer.
Implements iGraphics2D. |
|
Event handler for plugin.
|
|
Initialize the plugin.
Reimplemented in csGraphics2DGLCommon. |
|
(*) Open graphics system (set videomode, open window etc)
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Perform a system specific extension. Return false if extension not supported. Implements iGraphics2D. |
|
Perform a system specific extension. Return false if extension not supported. Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
(*) Flip video pages (or dump backbuffer into framebuffer).
Implements iGraphics2D. |
|
Resize the canvas.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Restore a subarea of screen saved with SaveArea().
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Save a subarea of screen area into the variable Data. Storage is allocated in this call, you should either FreeArea() it after usage or RestoreArea() it. Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Do a screenshot: return a new iImage object.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Set clipping rectangle.
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Change the fullscreen state of the canvas.
Implements iGraphics2D. |
|
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. |
|
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. |
|
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. |
|
Set mouse cursor position; return success status.
Implements iGraphics2D. |
|
(*) Set a color index to given R,G,B (0..255) values
Implements iGraphics2D. Reimplemented in csGraphics2DGLCommon. |
|
Write a text string into the back buffer.
Implements iGraphics2D. |
|
Write a text string into the back buffer.
A value of -1 for
Implements iGraphics2D. |
Member Data Documentation
|
Draw a pixel. This allows deciding at run-time which function we will choose. |
|
(*) Get address of video RAM at given x,y coordinates
|
|
Whether to allow resizing.
|
|
The clipping rectangle.
|
|
The clipping rectangle.
|
|
The clipping rectangle.
|
|
The clipping rectangle.
|
|
The configuration file.
|
|
The width, height and depth of visual.
|
|
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. |
|
The font cache.
|
|
The font server.
|
|
The counter that is incremented inside BeginDraw and decremented in FinishDraw().
|
|
True if visual is full-screen.
|
|
The width, height and depth of visual.
|
|
Open/Close state.
|
|
Keep a array of Y*width to avoid multiplications.
Definition at line 74 of file graph2d.h. Referenced by csG2DDrawLine< Tpixel, Tpixmixer >::DrawLine(). |
|
Most systems have a pointer to (real or pseudo) video RAM.
Definition at line 68 of file graph2d.h. Referenced by csG2DDrawLine< Tpixel, Tpixmixer >::DrawLine(). |
|
The object registry.
|
|
Callback to use for informing an external agent when several canvas operations have occured.
|
|
256-color palette.
|
|
true if some palette entry is already allocated.
|
|
The pixel format.
|
|
The plugin manager.
|
|
Screen refresh rate.
|
|
Activate Vsync.
|
|
The width, height and depth of visual.
|
|
Pointer to a title.
|
The documentation for this class was generated from the following file:
- csplugincommon/canvas/graph2d.h
Generated for Crystal Space by doxygen 1.3.9.1