ParaGUI  1.1.9
Enumerations | Functions
PG_Draw Namespace Reference

Enumerations

enum  BkMode {
  TILE, STRETCH, TILE3H, TILE3V,
  TILE9
}
 

Functions

SDL_Surface * RotoScaleSurface (SDL_Surface *src, double angle, double zoom, bool smooth=true)
 ParaGUI drawing functions. More...
 
SDL_Surface * ScaleSurface (SDL_Surface *src, double zoomx, double zoomy, bool smooth=true)
 Scale an SDL_Surface. More...
 
void BlitScale (SDL_Surface *src, SDL_Surface *dst, bool smooth=true)
 Scale and blit surface. More...
 
SDL_Surface * CreateGradient (const PG_Rect &r, PG_Gradient &gradient)
 Creates a surface filled with a gradient. More...
 
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. More...
 
void DrawGradient (SDL_Surface *surface, const PG_Rect &r, PG_Gradient &gradient)
 Draw a gradient on a surface. More...
 
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)
 Draw a gradient on a surface. More...
 
SDL_Surface * CreateRGBSurface (Uint16 w, Uint16 h, int flags=SDL_SWSURFACE)
 Create a new SDL surface. More...
 
void DrawThemedSurface (SDL_Surface *surface, const PG_Rect &r, PG_Gradient *gradient, SDL_Surface *background, BkMode bkmode, Uint8 blend)
 Draw a 'themed' surface. More...
 
void DrawLine (SDL_Surface *surface, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1, const PG_Color &color, Uint8 width=1)
 Draw a line. More...
 
void SetPixel (int x, int y, const PG_Color &c, SDL_Surface *surface)
 Set a pixel. More...
 
void BlitSurface (SDL_Surface *srf_src, const PG_Rect &rect_src, SDL_Surface *srf_dst, const PG_Rect &rect_dst)
 replacement for SDL_BlitSurface More...
 
void DrawTile (SDL_Surface *surface, const PG_Rect &ref, const PG_Rect &drawrect, SDL_Surface *tilemap)
 Tiles a surface with a given image. More...
 

Enumeration Type Documentation

Enumerator
TILE 
STRETCH 

Backgroundmode STRETCH.

Macro defining the background mode for stretching

TILE3H 

Backgroundmode 3TILEH.

Macro defining the background mode for horizontal 3 part tiling (the left part of the tile to the left, the right part to the right, the middle part repeatedly within the rest)

TILE3V 

Backgroundmode 3TILEV.

Macro defining the background mode for vertical 3 part tiling

TILE9 

Backgroundmode 9TILE.

Macro defining the background mode for 9 part tiling

Function Documentation

void PG_Draw::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
srcSource surface
dstdestination surface
smoothwhether or not to use anti-aliasing
void PG_Draw::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_srcsource surface
rect_srcPG_Rect of the source rectangle
srf_dstdestination surface
rect_dstPG_Rect of the destination rectangle

This function simply replaces SDL_BlitSurface and uses PG_Rect instead of SDL_Rect.

SDL_Surface* PG_Draw::CreateGradient ( const PG_Rect r,
PG_Gradient gradient 
)

Creates a surface filled with a gradient.

Parameters
rthe dimensions of the surface to be created
gradientthe gradient colors to use (order: ul(upper left), ur, dl, dr)
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* PG_Draw::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
rthe dimensions of the surface to be created
ulupper/left gradient color
urupper/right gradient color
dllower/left gradient color
drlower/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* PG_Draw::CreateRGBSurface ( Uint16  w,
Uint16  h,
int  flags = SDL_SWSURFACE 
)

Create a new SDL surface.

Parameters
wwidth of the new surface
hheight of the new surface
flagssurface-flags (default = SDL_SWSURFACE)
Returns
pointer to the new surface This function creates a new SDL surface
void PG_Draw::DrawGradient ( SDL_Surface *  surface,
const PG_Rect r,
PG_Gradient gradient 
)

Draw a gradient on a surface.

Parameters
surfacethe surface to draw the gradient to
rthe rectangle where the gradient should be drawn
gradientthe gradient colors (order: ul(upper left), ur, dl, dr)
Note
If the surface is clipped, the gradient is only drawn within the intersection of the clipping rect and r.
void PG_Draw::DrawGradient ( SDL_Surface *  surface,
const PG_Rect rect,
const PG_Color ul,
const PG_Color ur,
const PG_Color dl,
const PG_Color dr 
)

Draw a gradient on a surface.

Parameters
surfacethe surface to draw the gradient to
rectthe rectangle where the gradient should be drawn
ulupper/left gradient color
urupper/right gradient color
dllower/left gradient color
drlower/right gradient color

This function is the same as the other one above except that the gradient colors are the arguments instead of a gradient.

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

Draw a line.

Parameters
surfacedestination surface
x0x startposition
y0y startposition
x1x endposition
y1y endposition
colorcolor of the line
widthwidth of the line

Draws a line with given color and width onto a surface.

void PG_Draw::DrawThemedSurface ( SDL_Surface *  surface,
const PG_Rect r,
PG_Gradient gradient,
SDL_Surface *  background,
BkMode  bkmode,
Uint8  blend 
)

Draw a 'themed' surface.

Parameters
surfacethe surface to draw on
rthe rectangle of the surface to draw in
gradientpointer to a gradient structure (may be NULL)
backgroundpointer to a background surface (may be NULL)
bkmodethe mode how to fill in the background surface (BKMODE_TILE | BKMODE_STRETCH | BKMODE_3TILEH | BKMODE_3TILEV | BKMODE_9TILE)
blendthe blend-level between gradient an background; the higher the blend level the more transparent the background is.
Note
This function first draws the gradient, then the (partly transparent) background.
void PG_Draw::DrawTile ( SDL_Surface *  surface,
const PG_Rect ref,
const PG_Rect drawrect,
SDL_Surface *  tilemap 
)

Tiles a surface with a given image.

Parameters
surfacethe surface to draw to
refunused, to be removed
drawrectthe area on the surface you want to draw to
tilemapthe image you want to tile the surface with

This function takes the tilemap and repeatedly blits it on the surface. If drawrect->w is not a multiple of tilemap->w (the same with the height), the tiles on the right or lower border are cut off appropriately.

SDL_Surface* PG_Draw::RotoScaleSurface ( SDL_Surface *  src,
double  angle,
double  zoom,
bool  smooth = true 
)

ParaGUI drawing functions.

These functions can be used for native drawing on surfaces.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
srcsource surface
anglethe rotation in degrees
zoomthe scaling factor
smoothwhether or not to use anti-aliasing
Returns
A new surface with the scaled, rotated original surface.
SDL_Surface* PG_Draw::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
srcsource surface
zoomx,zoomywidth and height scaling factors
smoothwhether or not to enable anti-aliasing
Returns
A newly created surface with the scaled surface
void PG_Draw::SetPixel ( int  x,
int  y,
const PG_Color c,
SDL_Surface *  surface 
)

Set a pixel.

Parameters
xx position
yy position
ccolor
surfacedestination surface
Note
This function assumes that the surface has already been locked if neccessary.