GRRLIB__inline.h File Reference

GRRLIB inline function prototypes. More...

#include <grrlib/GRRLIB_cExtn.h>
#include <grrlib/GRRLIB_clipping.h>
#include <grrlib/GRRLIB_collision.h>
#include <grrlib/GRRLIB_fbComplex.h>
#include <grrlib/GRRLIB_fbGX.h>
#include <grrlib/GRRLIB_fbSimple.h>
#include <grrlib/GRRLIB_handle.h>
#include <grrlib/GRRLIB_pixel.h>
#include <grrlib/GRRLIB_settings.h>
#include <grrlib/GRRLIB_texSetup.h>

Functions

INLINE u8 GRRLIB_ClampVar8 (f32 Value)
 A helper function for the YCbCr -> RGB conversion.
INLINE void GRRLIB_ClipReset (void)
 Reset the clipping to normal.
INLINE void GRRLIB_ClipDrawing (const int x, const int y, const int width, const int height)
 Clip the drawing area to an rectangle.
INLINE bool GRRLIB_PtInRect (const int hotx, const int hoty, const int hotw, const int hoth, const int wpadx, const int wpady)
 Determine whether the specified point lies within the specified rectangle.
INLINE bool GRRLIB_RectInRect (const int rect1x, const int rect1y, const int rect1w, const int rect1h, const int rect2x, const int rect2y, const int rect2w, const int rect2h)
 Determine whether a specified rectangle lies within another rectangle.
INLINE bool GRRLIB_RectOnRect (const int rect1x, const int rect1y, const int rect1w, const int rect1h, const int rect2x, const int rect2y, const int rect2w, const int rect2h)
 Determine whether a part of a specified rectangle lies on another rectangle.
INLINE void GRRLIB_NPlot (const guVector v[], const u32 color[], const long n)
 Draw an array of points.
INLINE void GRRLIB_NGone (const guVector v[], const u32 color[], const long n)
 Draw a polygon.
INLINE void GRRLIB_NGoneFilled (const guVector v[], const u32 color[], const long n)
 Draw a filled polygon.
INLINE void GRRLIB_GXEngine (const guVector v[], const u32 color[], const long n, const u8 fmt)
 Draws a vector.
INLINE void GRRLIB_FillScreen (const u32 color)
 Clear screen with a specific color.
INLINE void GRRLIB_Plot (const f32 x, const f32 y, const u32 color)
 Draw a dot.
INLINE void GRRLIB_Line (const f32 x1, const f32 y1, const f32 x2, const f32 y2, const u32 color)
 Draw a line.
INLINE void GRRLIB_Rectangle (const f32 x, const f32 y, const f32 width, const f32 height, const u32 color, const u8 filled)
 Draw a rectangle.
INLINE void GRRLIB_SetHandle (GRRLIB_texImg *tex, const int x, const int y)
 Set a texture's X and Y handles.
INLINE void GRRLIB_SetMidHandle (GRRLIB_texImg *tex, const bool enabled)
 Center a texture's handles.
INLINE u32 GRRLIB_GetPixelFromtexImg (const int x, const int y, const GRRLIB_texImg *tex)
 Return the color value of a pixel from a GRRLIB_texImg.
INLINE void GRRLIB_SetPixelTotexImg (const int x, const int y, GRRLIB_texImg *tex, const u32 color)
 Set the color value of a pixel to a GRRLIB_texImg.
INLINE u32 GRRLIB_GetColor (const u8 r, const u8 g, const u8 b, const u8 a)
 Converts RGBA values to u32 color.
INLINE void GRRLIB_GetPixelFromFB (int x, int y, u8 *R1, u8 *G1, u8 *B1, u8 *R2, u8 *G2, u8 *B2)
 Reads a pixel directly from the FrontBuffer.
INLINE void GRRLIB_SetBlend (const GRRLIB_blendMode blendmode)
 Set a blending mode.
INLINE GRRLIB_blendMode GRRLIB_GetBlend (void)
 Get the current blending mode.
INLINE void GRRLIB_SetAntiAliasing (const bool aa)
 Turn AntiAliasing on/off.
INLINE bool GRRLIB_GetAntiAliasing (void)
 Get current AntiAliasing setting.
INLINE GRRLIB_texImgGRRLIB_CreateEmptyTexture (const uint w, const uint h)
 Create an empty texture.
INLINE void GRRLIB_ClearTex (GRRLIB_texImg *tex)
 Clear a texture to transparent black.
INLINE void GRRLIB_FlushTex (GRRLIB_texImg *tex)
 Write the contents of a texture in the data cache down to main memory.
INLINE void GRRLIB_FreeTexture (GRRLIB_texImg *tex)
 Free memory allocated for texture.

Detailed Description

GRRLIB inline function prototypes.


Function Documentation

INLINE u8 GRRLIB_ClampVar8 ( f32  Value  ) 

A helper function for the YCbCr -> RGB conversion.

Clamps the given value into a range of 0 - 255 and thus preventing an overflow.

Parameters:
Value The value to clamp.
Returns:
Returns a clean, clamped unsigned char.
INLINE void GRRLIB_ClearTex ( GRRLIB_texImg tex  ) 

Clear a texture to transparent black.

Parameters:
tex Texture to clear.
INLINE void GRRLIB_ClipDrawing ( const int  x,
const int  y,
const int  width,
const int  height 
)

Clip the drawing area to an rectangle.

Parameters:
x The x-coordinate of the rectangle.
y The y-coordinate of the rectangle.
width The width of the rectangle.
height The height of the rectangle.
INLINE GRRLIB_texImg* GRRLIB_CreateEmptyTexture ( const uint  w,
const uint  h 
)

Create an empty texture.

Parameters:
w Width of the new texture to create.
h Height of the new texture to create.
Returns:
A GRRLIB_texImg structure newly created.
INLINE void GRRLIB_FillScreen ( const u32  color  ) 

Clear screen with a specific color.

Parameters:
color The color to use to fill the screen.
INLINE void GRRLIB_FlushTex ( GRRLIB_texImg tex  ) 

Write the contents of a texture in the data cache down to main memory.

For performance the CPU holds a data cache where modifications are stored before they get written down to mainmemory.

Parameters:
tex The texture to flush.
INLINE void GRRLIB_FreeTexture ( GRRLIB_texImg tex  ) 

Free memory allocated for texture.

Parameters:
tex A GRRLIB_texImg structure.
INLINE bool GRRLIB_GetAntiAliasing ( void   ) 

Get current AntiAliasing setting.

Returns:
True if AntiAliasing is enabled.
INLINE GRRLIB_blendMode GRRLIB_GetBlend ( void   ) 

Get the current blending mode.

Returns:
The current blending mode.
INLINE u32 GRRLIB_GetColor ( const u8  r,
const u8  g,
const u8  b,
const u8  a 
)

Converts RGBA values to u32 color.

Parameters:
r Amount of red (0 - 255).
g Amount of green (0 - 255).
b Amount of blue (0 - 255).
a Amount of alpha (0 - 255).
Returns:
Returns the color in u32 format.
INLINE void GRRLIB_GetPixelFromFB ( int  x,
int  y,
u8 *  R1,
u8 *  G1,
u8 *  B1,
u8 *  R2,
u8 *  G2,
u8 *  B2 
)

Reads a pixel directly from the FrontBuffer.

Since the FB is stored in YCbCr,

Parameters:
x The x-coordinate within the FB.
y The y-coordinate within the FB.
R1 A pointer to a variable receiving the first Red value.
G1 A pointer to a variable receiving the first Green value.
B1 A pointer to a variable receiving the first Blue value.
R2 A pointer to a variable receiving the second Red value.
G2 A pointer to a variable receiving the second Green value.
B2 A pointer to a variable receiving the second Blue value.

Color channel: Colors[0] = Y1 Colors[1] = Cb Colors[2] = Y2 Colors[3] = Cr

INLINE u32 GRRLIB_GetPixelFromtexImg ( const int  x,
const int  y,
const GRRLIB_texImg tex 
)

Return the color value of a pixel from a GRRLIB_texImg.

Parameters:
x Specifies the x-coordinate of the pixel in the texture.
y Specifies the y-coordinate of the pixel in the texture.
tex The texture to get the color from.
Returns:
The color of a pixel in RGBA format.
INLINE void GRRLIB_Line ( const f32  x1,
const f32  y1,
const f32  x2,
const f32  y2,
const u32  color 
)

Draw a line.

Parameters:
x1 Starting point for line for the x coordinate.
y1 Starting point for line for the y coordinate.
x2 Ending point for line for the x coordinate.
y2 Ending point for line for the x coordinate.
color Line color in RGBA format.
Author:
JESPA
INLINE void GRRLIB_NGone ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw a polygon.

Parameters:
v The vector containing the coordinates of the polygon.
color The color of the filled polygon in RGBA format.
n Number of points in the vector.
INLINE void GRRLIB_NGoneFilled ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw a filled polygon.

Parameters:
v The vector containing the coordinates of the polygon.
color The color of the filled polygon in RGBA format.
n Number of points in the vector.
INLINE void GRRLIB_NPlot ( const guVector  v[],
const u32  color[],
const long  n 
)

Draw an array of points.

Parameters:
v Array containing the points.
color The color of the points in RGBA format.
n Number of points in the vector array.
INLINE void GRRLIB_Plot ( const f32  x,
const f32  y,
const u32  color 
)

Draw a dot.

Parameters:
x Specifies the x-coordinate of the dot.
y Specifies the y-coordinate of the dot.
color The color of the dot in RGBA format.
Author:
Jespa
INLINE bool GRRLIB_PtInRect ( const int  hotx,
const int  hoty,
const int  hotw,
const int  hoth,
const int  wpadx,
const int  wpady 
)

Determine whether the specified point lies within the specified rectangle.

Parameters:
hotx Specifies the x-coordinate of the upper-left corner of the rectangle.
hoty Specifies the y-coordinate of the upper-left corner of the rectangle.
hotw The width of the rectangle.
hoth The height of the rectangle.
wpadx Specifies the x-coordinate of the point.
wpady Specifies the y-coordinate of the point.
Returns:
If the specified point lies within the rectangle, the return value is true otherwise it's false.
INLINE void GRRLIB_Rectangle ( const f32  x,
const f32  y,
const f32  width,
const f32  height,
const u32  color,
const u8  filled 
)

Draw a rectangle.

Parameters:
x Specifies the x-coordinate of the upper-left corner of the rectangle.
y Specifies the y-coordinate of the upper-left corner of the rectangle.
width The width of the rectangle.
height The height of the rectangle.
color The color of the rectangle in RGBA format.
filled Set to true to fill the rectangle.
INLINE bool GRRLIB_RectInRect ( const int  rect1x,
const int  rect1y,
const int  rect1w,
const int  rect1h,
const int  rect2x,
const int  rect2y,
const int  rect2w,
const int  rect2h 
)

Determine whether a specified rectangle lies within another rectangle.

Parameters:
rect1x Specifies the x-coordinate of the upper-left corner of the rectangle.
rect1y Specifies the y-coordinate of the upper-left corner of the rectangle.
rect1w Specifies the width of the rectangle.
rect1h Specifies the height of the rectangle.
rect2x Specifies the x-coordinate of the upper-left corner of the rectangle.
rect2y Specifies the y-coordinate of the upper-left corner of the rectangle.
rect2w Specifies the width of the rectangle.
rect2h Specifies the height of the rectangle.
Returns:
If the specified rectangle lies within the other rectangle, the return value is true otherwise it's false.
INLINE bool GRRLIB_RectOnRect ( const int  rect1x,
const int  rect1y,
const int  rect1w,
const int  rect1h,
const int  rect2x,
const int  rect2y,
const int  rect2w,
const int  rect2h 
)

Determine whether a part of a specified rectangle lies on another rectangle.

Parameters:
rect1x Specifies the x-coordinate of the upper-left corner of the first rectangle.
rect1y Specifies the y-coordinate of the upper-left corner of the first rectangle.
rect1w Specifies the width of the first rectangle.
rect1h Specifies the height of the first rectangle.
rect2x Specifies the x-coordinate of the upper-left corner of the second rectangle.
rect2y Specifies the y-coordinate of the upper-left corner of the second rectangle.
rect2w Specifies the width of the second rectangle.
rect2h Specifies the height of the second rectangle.
Returns:
If the specified rectangle lies on the other rectangle, the return value is true otherwise it's false.
INLINE void GRRLIB_SetAntiAliasing ( const bool  aa  ) 

Turn AntiAliasing on/off.

Parameters:
aa Set to true to enable AntiAliasing (Default: Enabled).
INLINE void GRRLIB_SetBlend ( const GRRLIB_blendMode  blendmode  ) 

Set a blending mode.

Parameters:
blendmode The blending mode to use (Default: GRRLIB_BLEND_ALPHA).
INLINE void GRRLIB_SetHandle ( GRRLIB_texImg tex,
const int  x,
const int  y 
)

Set a texture's X and Y handles.

e.g. for rotation.

Parameters:
tex The texture to set the handle on.
x The x-coordinate of the handle.
y The y-coordinate of the handle.
INLINE void GRRLIB_SetMidHandle ( GRRLIB_texImg tex,
const bool  enabled 
)

Center a texture's handles.

e.g. for rotation.

Parameters:
tex The texture to center.
enabled 
INLINE void GRRLIB_SetPixelTotexImg ( const int  x,
const int  y,
GRRLIB_texImg tex,
const u32  color 
)

Set the color value of a pixel to a GRRLIB_texImg.

See also:
GRRLIB_FlushTex
Parameters:
x Specifies the x-coordinate of the pixel in the texture.
y Specifies the y-coordinate of the pixel in the texture.
tex The texture to set the color to.
color The color of the pixel in RGBA format.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Fri Sep 25 14:44:35 2009 for GRRLIB by  doxygen 1.6.1