Drawing Functions
Primitives
Polygon
Transform
Surface
Drawing
Dirty Rect
Palette
Control
Misc
Defines
Types
Extended

Arguments

Index
Credits

Return Name Arguments
Uint32 SPG_GetPixel SDL_Surface* surface, Sint16 x, Sint16 y
int SPG_Blit SDL_Surface* Src, SDL_Rect* srcRect,
SDL_Surface* Dest, SDL_Rect* destRect
void SPG_SetBlit void (*Blit_Fn)(SDL_Surface*, SDL_Rect*, SDL_Surface*, SDL_Rect*)
<Blit_Fn> SPG_GetBlit none
SDL_Surface*SPG_ReplaceColorSDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dest, SDL_Rect* destrect, Uint32 color
void SPG_Draw SDL_Surface* source, SDL_Surface* dest, Sint16 x, Sint16 y
voidSPG_DrawCenterSDL_Surface* source, SDL_Surface* dest, Sint16 x, Sint16 y
void SPG_DrawBlit SDL_Surface* img, SDL_Surface* dest, Sint16 x, Sint16 y
void SPG_PixelPattern SDL_Surface* surface, SDL_Rect target,
SPG_bool* pattern, Uint32* colors
void SPG_PixelPatternBlend SDL_Surface* surface, SDL_Rect target,
SPG_bool* pattern, Uint32* colors, Uint8* pixelAlpha
void SPG_Fill SDL_Surface* surface, Uint32 color
void SPG_FillAlpha SDL_Surface* surface, Uint32 color, Uint8 alpha
void SPG_FloodFill SDL_Surface* dst, Sint16 x, Sint16 y, Uint32 color
void SPG_BlockRead8 SDL_Surface* Surface, Uint8* block, Sint16 y
void SPG_BlockRead16 SDL_Surface* Surface, Uint16* block, Sint16 y
void SPG_BlockRead32 SDL_Surface* Surface, Uint32* block, Sint16 y
void SPG_BlockWrite8 SDL_Surface* Surface, Uint8* block, Sint16 y
void SPG_BlockWrite16 SDL_Surface* Surface, Uint16* block, Sint16 y
void SPG_BlockWrite32 SDL_Surface* Surface, Uint32* block, Sint16 y


Uint32 SPG_GetPixel(SDL_Surface *surface, Sint16 x, Sint16 y)
- Returns the pixel's color value at (x,y) in the given surface's format.

int SPG_Blit(SDL_Surface *Src, SDL_Rect* srcRect, SDL_Surface *Dest, SDL_Rect* destRect)
- Draws the data from Src within the area defined by srcRect to destRect on Dest.  Performs the alpha-blending modes, can combine per-pixel and per-surface alpha, and is non-destructive of the given SDL_Rects.  Alpha-blending modes will only work on 32-bit RGBA surfaces.
The available blitting modes are:
Name RGB AlphaDescription
SPG_DEST_ALPHA Blend DestBlends colors normally and keeps the destination per-pixel alpha.  This is the same as SDL_BlitSurface's blending.
SPG_SRC_ALPHA Blend SrcBlends colors and copies the source alpha.
SPG_COMBINE_ALPHA Blend BlendBlends colors and blends the alpha.  This is "True" blending and lends well to some neat compositing effects.
SPG_COPY_NO_ALPHA Src OpaqueCopies the source color, sets the dest alpha to opaque.
SPG_COPY_DEST_ALPHA Src DestCopies the source color, keeps the dest alpha.
SPG_COPY_SRC_ALPHA Src SrcCopies the source color and alpha.
SPG_COPY_COMBINE_ALPHA Src BlendCopies the source color and blends the alpha.
SPG_COPY_ALPHA_ONLY Dest SrcKeeps the dest color, but copies the source alpha.
SPG_COMBINE_ALPHA_ONLY Dest BlendKeeps the dest color, but blends the alpha.
SPG_REPLACE_COLORKEY Src SrcIf the destination surface has the SDL_SRCCOLORKEY flag, this replaces the dest colorkey color in the image with the source color and alpha.  This is similar to palette-swapping, but can be used with gradients and other images.



void SPG_SetBlit(void (*blitfn)(SDL_Surface*, SDL_Rect*, SDL_Surface*, SDL_Rect*))
- Sets the custom blitting function used by SPG_Blit to the given function.

<Blit_Fn> SPG_GetBlit()
- Returns the current blitting function.

SDL_Surface* SPG_ReplaceColor(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dest, SDL_Rect* destrect, Uint32 color)
- Returns a new surface with the given color replaced by the corresponding pixels from the src surface.  This is an effect similar to palette-swapping on 8-bit surfaces, but allows for images and gradients to replace the color.

void SPG_Draw(SDL_Surface* source, SDL_Surface* dest, Sint16 x, Sint16 y)
- Quick convenience call for SDL_BlitSurface.

void SPG_DrawCenter(SDL_Surface* source, SDL_Surface* dest, Sint16 x, Sint16 y)
- Blits an image centered on the given coordinates.

void SPG_DrawBlit(SDL_Surface* img, SDL_Surface* dest, Sint16 x, Sint16 y)
- Quick convenience call for SPG_Blit.

void SPG_PixelPattern(SDL_Surface *surface, SDL_Rect target, SPG_bool* pattern, Uint32* colors)
- Draws a pattern of pixels defined by the given bit pattern to the area represented by 'target' on the given surface.  You provide an array of 1's and 0's that tell the function where to draw, and an array of colors to tell it what to draw.

void SPG_PixelPatternBlend(SDL_Surface *surface, SDL_Rect target, SPG_bool* pattern, Uint32* colors, Uint8* pixelAlpha)
- Alpha-blends a pattern of pixels defined by the given bit pattern to the area represented by 'target' on the given surface.  You provide an array of 1's and 0's that tell the function where to draw, an array of colors to tell it what to draw, and an array of alpha values to tell it how to blend.

void SPG_Fill(SDL_Surface *surface, Uint32 color)
- Changes every pixel on the surface to the given color value.

void SPG_FillAlpha(SDL_Surface *surface, Uint32 color, Uint8 alpha)
- Changes every pixel on the surface to the given color value (includes alpha value).

void SPG_FloodFill(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
- Changes the color of all pixels contiguous to (x,y) to the given color.

void SPG_BlockRead8(SDL_Surface *Surface, Uint8 *block, Sint16 y)
- Reads an entire scanline of 8-bit data from the surface

void SPG_BlockRead16(SDL_Surface *Surface, Uint16 *block, Sint16 y)
- Reads an entire scanline of 16-bit data from the surface

void SPG_BlockRead32(SDL_Surface *Surface, Uint32 *block, Sint16 y)
- Reads an entire scanline of 32-bit data from the surface

void SPG_BlockWrite8(SDL_Surface *Surface, Uint8 *block, Sint16 y)
- Writes an entire scanline of data to target 8-bit surface

void SPG_BlockWrite16(SDL_Surface *Surface, Uint16 *block, Sint16 y)
- Writes an entire scanline of data to target 16-bit surface

void SPG_BlockWrite32(SDL_Surface *Surface, Uint32 *block, Sint16 y)
- Writes an entire scanline of data to target 32-bit surface


SPriG v1.0.0 Documentation by Jonathan Dearborn 2008