deGraphicContext Class Reference

Graphics rendering class for render targets. More...

#include <deGraphicContext.h>

Inheritance diagram for deGraphicContext:
deResource deObject

List of all members.

Public Member Functions

Constructors and Destructors
 deGraphicContext (deGraphicContextManager *manager, deRenderTarget *target)
 Creates a new graphic context object.
virtual ~deGraphicContext ()
 Cleans up the graphic context.
Management
deRenderTargetGetRenderTarget () const
 Retrieves the render target this graphic context operates upon.
const decBoundaryGetViewport () const
 Retrieves viewport rect.
void SetViewport (const decBoundary &viewport)
 Sets the viewport rect.
int GetViewportWidth () const
 Retrieves the width of the viewport.
int GetViewportHeight () const
 Retrieves the height of the viewport.
const decPointGetOffset () const
 Retrieves render offset.
void SetOffset (const decPoint &offset)
 Sets the render offset.
const decColorGetColor () const
 Retrieves the drawing color.
void SetColor (const decColor &color)
 Sets the drawing color.
float GetAlpha () const
 Retrieves the drawing transparency.
void SetAlpha (float alpha)
 Sets the drawing transparency.
deFontGetFont () const
 Retrieves the font for drawing text.
float GetFontSize () const
 Retrieves the font size for drawing text height in pixels.
void SetFont (deFont *font, float size)
 Set the font for drawing text with the given font height in pixels.
Drawing
void DrawPoint (int x, int y)
 Draw point at (x,y) using current drawing color and alpha value.
void DrawLine (int x1, int y1, int x2, int y2)
 Draw line from (x1,y1) to (x2,y2) using the current drawing color and alpha value.
void DrawRect (int x1, int y1, int x2, int y2)
 Draw outlined rectangle at (x1,y1) to (x2,y2) using the current color and alpha value.
void DrawImage (deImage *image, int x, int y)
 Draw image at (x,y).
void DrawImage (deImage *image, int x, int y, int width, int height)
 Draw image at (x,y) scaled to (width,height).
void DrawImage (deImage *image, int x, int y, int width, int height, int sx, int sy, int swidth, int sheight)
 Draw area (sx,sy) size (swidth,sheight) from image at (x,y) scaled to (width,height).
void DrawTarget (deRenderTarget *target, int x, int y)
 Draw render target at (x,y).
void DrawTarget (deRenderTarget *target, int x, int y, int width, int height)
 Draw render target at (x,y) scaled to (width,height).
void DrawTarget (deRenderTarget *target, int x, int y, int width, int height, int sx, int sy, int swidth, int sheight)
 Draw area (sx,sy) size (swidth,sheight) from render target at (x,y) scaled to (width,height).
void DrawText (int x, int y, const char *text, int len)
 Draw text at (x,y) using the current font, drawing color and alpha value.
void FillRect (int x1, int y1, int x2, int y2)
 Draw filled rectangle from (x1,y1) to (x2,y2) using the current color and alpha value.
void RenderWorld (deCamera *camera)
 Render a world.
void ExtractImage (deImage *image)
 Extract entire drawable area into the given image.
void ExtractImage (deImage *image, int x, int y, int width, int height)
 Extract area (x,y) size (width,height) of context into the specified image.
void TransformColors (const decColorMatrix &matrix, int x1, int y1, int x2, int y2)
 Transform the color of all pixels in the given area using a color matrix.
System Peers
deBaseGraphicContextGetGraphicContext () const
 Retrieves the graphics system peer object.
void SetGraphicContext (deBaseGraphicContext *graContext)
 Sets the graphic system peer object.

Detailed Description

Graphics rendering class for render targets.

Whereas the render target provides the data storage for rendered images the Graphics object provides the means to draw into a render target. It does provide 2d drawing functions for geometric shapes and some 3d functions for rendering scenes. A graphics object is obtained only from a render target or by getting a viewport from an existing graphics object. Drawing on graphics objects can be done in any order as they make sure themselves that they have grabbed the underlaying hardware properly.

Viewport.
Graphic contexts can render on the entire render target or only a small portion of it. For this a graphic context has a viewport as well as an offset assigned. The viewport defines the rectangular area in which drawing is allowed. This area is not required to be withing the boundaries of the render target. The Graphic Module is responsible to adjust the viewport to the limitations of the hardware underneath. The second parameter is the offset locating the origin of all render actions. The offset is not required to be coincident with the upper left corner of the viewport. The offset is subtracted from all render calls before they are carried out. A viewport with no dimention in the x or y direction indicates no rendering to be allowed at all.
Author:
Plüss Roland
Version:
1.0
Date:
2008

Constructor & Destructor Documentation

deGraphicContext::deGraphicContext ( deGraphicContextManager manager,
deRenderTarget target 
)

Creates a new graphic context object.

virtual deGraphicContext::~deGraphicContext (  ) [virtual]

Cleans up the graphic context.


Member Function Documentation

void deGraphicContext::DrawImage ( deImage image,
int  x,
int  y 
)

Draw image at (x,y).

void deGraphicContext::DrawImage ( deImage image,
int  x,
int  y,
int  width,
int  height 
)

Draw image at (x,y) scaled to (width,height).

void deGraphicContext::DrawImage ( deImage image,
int  x,
int  y,
int  width,
int  height,
int  sx,
int  sy,
int  swidth,
int  sheight 
)

Draw area (sx,sy) size (swidth,sheight) from image at (x,y) scaled to (width,height).

void deGraphicContext::DrawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw line from (x1,y1) to (x2,y2) using the current drawing color and alpha value.

void deGraphicContext::DrawPoint ( int  x,
int  y 
)

Draw point at (x,y) using current drawing color and alpha value.

void deGraphicContext::DrawRect ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw outlined rectangle at (x1,y1) to (x2,y2) using the current color and alpha value.

void deGraphicContext::DrawTarget ( deRenderTarget target,
int  x,
int  y 
)

Draw render target at (x,y).

void deGraphicContext::DrawTarget ( deRenderTarget target,
int  x,
int  y,
int  width,
int  height 
)

Draw render target at (x,y) scaled to (width,height).

void deGraphicContext::DrawTarget ( deRenderTarget target,
int  x,
int  y,
int  width,
int  height,
int  sx,
int  sy,
int  swidth,
int  sheight 
)

Draw area (sx,sy) size (swidth,sheight) from render target at (x,y) scaled to (width,height).

void deGraphicContext::DrawText ( int  x,
int  y,
const char *  text,
int  len 
)

Draw text at (x,y) using the current font, drawing color and alpha value.

void deGraphicContext::ExtractImage ( deImage image )

Extract entire drawable area into the given image.

void deGraphicContext::ExtractImage ( deImage image,
int  x,
int  y,
int  width,
int  height 
)

Extract area (x,y) size (width,height) of context into the specified image.

void deGraphicContext::FillRect ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw filled rectangle from (x1,y1) to (x2,y2) using the current color and alpha value.

float deGraphicContext::GetAlpha (  ) const [inline]

Retrieves the drawing transparency.

const decColor& deGraphicContext::GetColor (  ) const [inline]

Retrieves the drawing color.

deFont* deGraphicContext::GetFont (  ) const [inline]

Retrieves the font for drawing text.

float deGraphicContext::GetFontSize (  ) const [inline]

Retrieves the font size for drawing text height in pixels.

deBaseGraphicContext* deGraphicContext::GetGraphicContext (  ) const [inline]

Retrieves the graphics system peer object.

const decPoint& deGraphicContext::GetOffset (  ) const [inline]

Retrieves render offset.

deRenderTarget* deGraphicContext::GetRenderTarget (  ) const [inline]

Retrieves the render target this graphic context operates upon.

const decBoundary& deGraphicContext::GetViewport (  ) const [inline]

Retrieves viewport rect.

int deGraphicContext::GetViewportHeight (  ) const

Retrieves the height of the viewport.

int deGraphicContext::GetViewportWidth (  ) const

Retrieves the width of the viewport.

void deGraphicContext::RenderWorld ( deCamera camera )

Render a world.

void deGraphicContext::SetAlpha ( float  alpha )

Sets the drawing transparency.

void deGraphicContext::SetColor ( const decColor color )

Sets the drawing color.

void deGraphicContext::SetFont ( deFont font,
float  size 
)

Set the font for drawing text with the given font height in pixels.

void deGraphicContext::SetGraphicContext ( deBaseGraphicContext graContext )

Sets the graphic system peer object.

void deGraphicContext::SetOffset ( const decPoint offset )

Sets the render offset.

void deGraphicContext::SetViewport ( const decBoundary viewport )

Sets the viewport rect.

void deGraphicContext::TransformColors ( const decColorMatrix matrix,
int  x1,
int  y1,
int  x2,
int  y2 
)

Transform the color of all pixels in the given area using a color matrix.


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