Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

PG_Draw Namespace Reference


Detailed Description

ParaGUI drawing functions.

These functions can be used for native drawing on surfaces.


Functions

SDL_Surface * RotoScaleSurface (SDL_Surface *src, double angle, double zoom, bool smooth=true)
 Rotate and scale an SDL_Surface.

SDL_Surface * ScaleSurface (SDL_Surface *src, double zoomx, double zoomy, bool smooth=true)
 Scale an SDL_Surface.

void BlitScale (SDL_Surface *src, SDL_Surface *dst, bool smooth=true)
 Scale and blit surface.

SDL_Surface * CreateGradient (const PG_Rect &r, PG_Gradient &gradient)
 Creates a surface filled with a gradient.

SDL_Surface * CreateGradient (const PG_Rect &r, const PG_Color &ul, const PG_Color &ur, const PG_Color &dl, const PG_Color &dr)
 Creates a surface filled with a gradient.

void DrawGradient (SDL_Surface *surface, const PG_Rect &r, PG_Gradient &gradient)
void DrawGradient (SDL_Surface *surface, const PG_Rect &rect, const PG_Color &ul, const PG_Color &ur, const PG_Color &dl, const PG_Color &dr)
SDL_Surface * CreateRGBSurface (Uint16 w, Uint16 h, int flags=SDL_SWSURFACE)
 Create a new SDL surface.

void DrawThemedSurface (SDL_Surface *surface, const PG_Rect &r, PG_Gradient *gradient, SDL_Surface *background, int bkmode, Uint8 blend)
 Draw a 'themed' surface.

void DrawLine (SDL_Surface *surface, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const PG_Color &color, Uint8 width=1)
 Draw a line.

void SetPixel (int x, int y, const PG_Color &c, SDL_Surface *surface)
 Set a pixel.

void BlitSurface (SDL_Surface *srf_src, const PG_Rect &rect_src, SDL_Surface *srf_dst, const PG_Rect &rect_dst)
 replacement for SDL_BlitSurface

void DrawTile (SDL_Surface *surface, const PG_Rect &ref, const PG_Rect &drawrect, SDL_Surface *tilemap)


Function Documentation

void BlitScale SDL_Surface *  src,
SDL_Surface *  dst,
bool  smooth = true
 

Scale and blit surface.

Scales a 32 bit or 8 bit SDL_Surface to the size of the destination surface dst and blits the result to the destination surface. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
src Source surface
dst destination surface
smooth whether or not to use anti-aliasing

void BlitSurface SDL_Surface *  srf_src,
const PG_Rect rect_src,
SDL_Surface *  srf_dst,
const PG_Rect rect_dst
[inline]
 

replacement for SDL_BlitSurface

Parameters:
srf_src source surface
rect_src PG_Rect of the source rectangle
srf_dst destination surface
rect_dst PG_Rect of the destination rectangle
This function simply replaces SDL_BlitSurface and uses PG_Rect instead of SDL_Rect.

SDL_Surface* CreateGradient const PG_Rect r,
const PG_Color ul,
const PG_Color ur,
const PG_Color dl,
const PG_Color dr
 

Creates a surface filled with a gradient.

Parameters:
r the dimensions of the surface to be created
ul upper/left gradient color
ur upper/right gradient color
dl lower/left gradient color
dr lower/right gradient color
Returns:
a SDL_Surface pointer to the new surface
This function creates a new surface filled with a given gradient defined by a set of colors

SDL_Surface* CreateGradient const PG_Rect r,
PG_Gradient gradient
 

Creates a surface filled with a gradient.

Parameters:
r the dimensions of the surface to be created
gradient the gradient colors to use
Returns:
a SDL_Surface pointer to the new surface
This function creates a new surface filled with a given gradient defined by a set of colors

SDL_Surface* CreateRGBSurface Uint16  w,
Uint16  h,
int  flags = SDL_SWSURFACE
 

Create a new SDL surface.

Parameters:
w width of the new surface
h height of the new surface
flags surface-flags (default = SDL_SWSURFACE)
Returns:
pointer to the new surface This function creates a new SDL surface

void DrawGradient SDL_Surface *  surface,
const PG_Rect rect,
const PG_Color ul,
const PG_Color ur,
const PG_Color dl,
const PG_Color dr
 

void DrawGradient SDL_Surface *  surface,
const PG_Rect r,
PG_Gradient gradient
 

void DrawLine SDL_Surface *  surface,
Uint32  x0,
Uint32  y0,
Uint32  x1,
Uint32  y1,
const PG_Color color,
Uint8  width = 1
 

Draw a line.

Parameters:
surface destination surface
x0 x startposition
y0 y startposition
x1 x endposition
y1 y endposition
color color of the line
width width of the line
Draws a line with given color and width onto a surface.

void DrawThemedSurface SDL_Surface *  surface,
const PG_Rect r,
PG_Gradient gradient,
SDL_Surface *  background,
int  bkmode,
Uint8  blend
 

Draw a 'themed' surface.

Parameters:
surface the surface to draw on
r the rectangle of the surface to draw in
gradient pointer to a gradient structure (may be NULL)
background pointer to a background surface (may be NULL)
bkmode the mode how to fill in the background surface (BKMODE_TILE | BKMODE_STRETCH)
blend the blend-level between gradient an background

void DrawTile SDL_Surface *  surface,
const PG_Rect ref,
const PG_Rect drawrect,
SDL_Surface *  tilemap
 

SDL_Surface* RotoScaleSurface SDL_Surface *  src,
double  angle,
double  zoom,
bool  smooth = true
 

Rotate and scale an SDL_Surface.

Rotates and scales a 32bit or 8bit SDL_Surface to newly created destination surface. If smooth is 1 the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
src source surface
angle the rotation in degrees
zoom the scaling factor
smooth whether or not to use anti-aliasing
Returns:
A new surface with the scaled, rotated original surface.

SDL_Surface* ScaleSurface SDL_Surface *  src,
double  zoomx,
double  zoomy,
bool  smooth = true
 

Scale an SDL_Surface.

Scales a 32bit or 8bit SDL_Surface to newly created destination surface. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters:
src source surface
zoomx,zoomy width and height scaling factors
smooth whether or not to enable anti-aliasing
Returns:
A newly created surface with the scaled surface

void SetPixel int  x,
int  y,
const PG_Color c,
SDL_Surface *  surface
 

Set a pixel.

Parameters:
x x position
y y position
c color
surface destination surface


The ParaGUI Project - Alexander Pipelka