CRM32Pro_IPrimitives Class Reference
[MODULE 5: IPrimitives v3.50, primitives interface system.]

IPrimitives. More...


Detailed Description

IPrimitives.

Primitives interface system.

List of all members.

Public Member Functions

void BoxColor (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned int color)
 Draw a filled rectangle.
void BoxRGBA (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 Draw a filled rectangle.
void CMYKtoRGB (unsigned char c, unsigned char m, unsigned char y, unsigned char k, unsigned char *r8, unsigned char *g8, unsigned char *b8)
 Color conversion: from CMYK to RGB.
void Get16Pixel (SDL_Surface *surf, short x, short y, unsigned int *arraypixels, unsigned char alock=1)
 Get a packed of 16 pixels. It only works with 32bit modes.
int GetCollisionMethod ()
 Get current collision detection method.
unsigned int GetPixel (SDL_Surface *surf, short x, short y, unsigned char alock=1)
 Get a single pixel.
void HLineColor (SDL_Surface *surf, short x1, short x2, short y, unsigned int color)
 Draw a horinzontal line with bounce checking.
void HLineRGBA (SDL_Surface *surf, short x1, short x2, short y, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 Draw a horinzontal line with bounce checking.
void HSVtoRGB (float h, float s, float v, unsigned char *r8, unsigned char *g8, unsigned char *b8)
 Color conversion: from HSV to RGB.
void LineColor (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned int color)
 Draw a line with bounce checking.
void LineRGBA (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 Draw a line with bounce checking.
unsigned char PixelCollision (SDL_Surface *s1, SDL_Rect *r1, SDL_Surface *s, SDL_Rect *r2, unsigned char debug=0, SDL_Rect *posr1=NULL, SDL_Rect *posr2=NULL)
 Customizable collision detection between two surfaces.
void Put16Pixel (SDL_Surface *surf, short x, short y, unsigned int *arraypixels, unsigned char alock=1)
 Draw a pack of 16 pixels. It only works with 32bit modes.
void PutPixelColor (SDL_Surface *surf, short x, short y, unsigned int color, unsigned char alock=1)
 Draw a single pixel with bounce checking.
void PutPixelRGBA (SDL_Surface *surf, short x, short y, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255, unsigned char alock=1)
 Draw a single pixel with bounce checking.
void RectangleColor (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned int color)
 Draw an outlined rectangle.
void RectangleRGBA (SDL_Surface *surf, short x1, short y1, short x2, short y2, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 Draw an outlined rectangle.
void RGBtoCMYK (unsigned char r8, unsigned char g8, unsigned char b8, unsigned char *c, unsigned char *m, unsigned char *y, unsigned char *k)
 Color conversion: from RGB to CMYK.
void RGBtoHSV (unsigned char r8, unsigned char g8, unsigned char b8, float *h, float *s, float *v)
 Color conversion: from RGB to HSV.
void RGBtoYUV (unsigned char r8, unsigned char g8, unsigned char b8, unsigned char *Y, unsigned char *U, unsigned char *V)
 Color conversion: from RGB to YUV.
void SetCollisionMethod (int mode)
 Set the collision detection method.
void VLineColor (SDL_Surface *surf, short x, short y1, short y2, unsigned int color)
 Draw a vertical line with bounce checking.
void VLineRGBA (SDL_Surface *surf, short x, short y1, short y2, unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
 Draw a vertical line with bounce checking.
void YUVtoRGB (unsigned char Y, unsigned char U, unsigned char V, unsigned char *r8, unsigned char *g8, unsigned char *b8)
 Color conversion: from YUV to RGB.

Member Function Documentation

void CRM32Pro_IPrimitives::BoxColor ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned int  color 
)

Draw a filled rectangle.

Tests the clipping region and has support for cursor autorestore.

Parameters:
surf surface to render the rectangle
x1 Desired start x position
y1 Desired start y
x2 Desired end x position
y2 Desired end y
color Packet(RGBA) pixel color
void CRM32Pro_IPrimitives::BoxRGBA ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Draw a filled rectangle.

Tests the clipping region and has support for cursor autorestore.

Parameters:
surf surface to render the rectangle
x1 Desired start x position
y1 Desired start y
x2 Desired end x position
y2 Desired end y
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
void CRM32Pro_IPrimitives::CMYKtoRGB ( unsigned char  c,
unsigned char  m,
unsigned char  y,
unsigned char  k,
unsigned char *  r8,
unsigned char *  g8,
unsigned char *  b8 
)

Color conversion: from CMYK to RGB.

Parameters:
c cyan component
m magenta component
y yellow component
k key(black) component
r8 pointer to Red component
g8 pointer to Green component
b8 pointer to Blue component
void CRM32Pro_IPrimitives::Get16Pixel ( SDL_Surface *  surf,
short  x,
short  y,
unsigned int *  arraypixels,
unsigned char  alock = 1 
)

Get a packed of 16 pixels. It only works with 32bit modes.

If you will access to the pixels surface to get the value of several pixels, you have to use alock=0 and
manually, before your code, call to Lock(your_surface) and after your code, call to UnLock(your_surface).
If the given surface is an OpenGL texture (glSDL mode), it does nothing.

Parameters:
surf surface to get the pixel
x x position on surface
y y position on surface
arraypixels pixel color array (packed integer with RGB)
alock by default is 1. Set to 1 means to lock the surface. Other value, means don't lock the surface.
int CRM32Pro_IPrimitives::GetCollisionMethod (  ) 

Get current collision detection method.

Returns:
Current collision detection method
unsigned int CRM32Pro_IPrimitives::GetPixel ( SDL_Surface *  surf,
short  x,
short  y,
unsigned char  alock = 1 
)

Get a single pixel.

If you will access to a few pixels, the best way is to manually manage the lock calling to Lock() and UnLock() and using alock=0
With OpenGL modes (glSDL), it works but when surf is not CRM32Pro.screen, it will be slower as it has to download the texture to the system memory.

Parameters:
surf surface to get the pixel
x x position on surface
y y position on surface
alock by default is 1. Set to 1 means to lock the surface. Other value, means don't lock the surface.
Returns:
color pixel color (packed integer with RGB).
void CRM32Pro_IPrimitives::HLineColor ( SDL_Surface *  surf,
short  x1,
short  x2,
short  y,
unsigned int  color 
)

Draw a horinzontal line with bounce checking.

Tests the clipping region.

Parameters:
surf surface to render the line
x1 Desired start x position
x2 Desired end y position
y Desired y position
color Packet(RGBA) pixel color
void CRM32Pro_IPrimitives::HLineRGBA ( SDL_Surface *  surf,
short  x1,
short  x2,
short  y,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Draw a horinzontal line with bounce checking.

Tests the clipping region.

Parameters:
surf surface to render the line
x1 Desired start x position
x2 Desired end y position
y Desired y position
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
void CRM32Pro_IPrimitives::HSVtoRGB ( float  h,
float  s,
float  v,
unsigned char *  r8,
unsigned char *  g8,
unsigned char *  b8 
)

Color conversion: from HSV to RGB.

Parameters:
h Hue component
s Saturation component
v Value component
r8 pointer to Red component
g8 pointer to Green component
b8 pointer to Blue component
void CRM32Pro_IPrimitives::LineColor ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned int  color 
)

Draw a line with bounce checking.

Tests the clipping region.
With OpenGL modes (glSDL), it only works when surf is CRM32Pro.screen

Parameters:
surf surface to render the line
x1 Desired start x position
y1 Desired start y position
x2 Desired end x position
y2 Desired end y position
color Packet(RGBA) pixel color
void CRM32Pro_IPrimitives::LineRGBA ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Draw a line with bounce checking.

Tests the clipping region.
With OpenGL modes (glSDL), it only works when surf is CRM32Pro.screen

Parameters:
surf surface to render the line
x1 Desired start x position
y1 Desired start y position
x2 Desired end x position
y2 Desired end y position
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
unsigned char CRM32Pro_IPrimitives::PixelCollision ( SDL_Surface *  surf1,
SDL_Rect *  pos1,
SDL_Surface *  surf2,
SDL_Rect *  pos2,
unsigned char  debug = 0,
SDL_Rect *  posr1 = NULL,
SDL_Rect *  posr2 = NULL 
)

Customizable collision detection between two surfaces.

You can modify the behaviour of the collision detection system using SetCollisionMethod(). First one, it tests a bounding box(BB) collision, if a collision of BB occurs, it will check for perfect pixel collision.
It could be slow if you are testing a lot of collisions. The advice is to use as less "external" colorkey around your sprite as possible to avoid to do a lot of pixel checking.

Parameters:
surf1 surface A
pos1 rect with absolute position(x,y) and size(w,h) of surface A
surf2 surface B to test collision against surface A
pos2 rect with absolute (x,y) position and size of surface B
debug by default is 0 and it won't to render any debug information. Otherwise, will show collision bounding boxes.
posr1 NULL(by default) or a rect pointer with relative position(x,y) inside the surface A.
posr2 NULL(by default) or a rect pointer with relative position(x,y) inside the surface B.
Returns:
0 There was not a surface collision
1 There was a surface collision
void CRM32Pro_IPrimitives::Put16Pixel ( SDL_Surface *  surf,
short  x,
short  y,
unsigned int *  arraypixels,
unsigned char  alock = 1 
)

Draw a pack of 16 pixels. It only works with 32bit modes.

Only supports 32bit depth color.
Also, it doesn't test the clipping region.
If you will access to the pixels surface to set the value of several pixels, you have to use alock=0 and
manually, before your code, call to Lock(your_surface) and after your code, call to UnLock(your_surface).
If the given surface is an OpenGL texture (glSDL mode), it does nothing.

Parameters:
surf surface to dump the pixel
x x position on surface
y y position on surface
arraypixels pixel color array (packed integer with RGB)
alock by default is 1. Set to 1 means to lock the surface. Other value, means don't lock the surface.
void CRM32Pro_IPrimitives::PutPixelColor ( SDL_Surface *  surf,
short  x,
short  y,
unsigned int  color,
unsigned char  alock = 1 
)

Draw a single pixel with bounce checking.

Tests the clipping region.
If you will access to the pixels surface to set the value of several pixels, you may want to use alock=0 and manually, before your code, call to Lock(your_surface) and after your code, call to UnLock(your_surface).
With OpenGL modes (glSDL), it only works when surf is CRM32Pro.screen

Parameters:
surf surface to render the pixel
x Desired x position
y Desired y position
color Packet(RGBA) pixel color
alock 1 to lock the surface. Other value, don't lock the surface. By default is 1.
void CRM32Pro_IPrimitives::PutPixelRGBA ( SDL_Surface *  surf,
short  x,
short  y,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255,
unsigned char  alock = 1 
)

Draw a single pixel with bounce checking.

Tests the clipping region.
If you will access to the pixels surface to set the value of several pixels, you may want to use alock=0 and manually, before your code, call to Lock(your_surface) and after your code, call to UnLock(your_surface).
With OpenGL modes (glSDL), it only works when surf is CRM32Pro.screen

Parameters:
surf surface to render the pixel
x Desired x position
y Desired y position
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
alock 1 to lock the surface. Other value, don't lock the surface. By default is 1.
void CRM32Pro_IPrimitives::RectangleColor ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned int  color 
)

Draw an outlined rectangle.

Tests the clipping region and has support for cursor autorestore.

Parameters:
surf surface to render the rectangle
x1 Desired start x position
y1 Desired start y
x2 Desired end x position
y2 Desired end y
color Packet(RGBA) pixel color
void CRM32Pro_IPrimitives::RectangleRGBA ( SDL_Surface *  surf,
short  x1,
short  y1,
short  x2,
short  y2,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Draw an outlined rectangle.

Tests the clipping region and has support for cursor autorestore.

Parameters:
surf surface to render the rectangle
x1 Desired start x position
y1 Desired start y
x2 Desired end x position
y2 Desired end y
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
void CRM32Pro_IPrimitives::RGBtoCMYK ( unsigned char  r8,
unsigned char  g8,
unsigned char  b8,
unsigned char *  c,
unsigned char *  m,
unsigned char *  y,
unsigned char *  k 
)

Color conversion: from RGB to CMYK.

Parameters:
r8 Red component
g8 Green component
b8 Blue component
c pointer to cyan component
m pointer to magenta component
y pointer to yellow component
k pointer to key(black) component
void CRM32Pro_IPrimitives::RGBtoHSV ( unsigned char  r8,
unsigned char  g8,
unsigned char  b8,
float *  h,
float *  s,
float *  v 
)

Color conversion: from RGB to HSV.

Parameters:
r8 Red component
g8 Green component
b8 Blue component
h pointer to Hue component
s pointer to Saturation component
v pointer to Value component
void CRM32Pro_IPrimitives::RGBtoYUV ( unsigned char  r8,
unsigned char  g8,
unsigned char  b8,
unsigned char *  Y,
unsigned char *  U,
unsigned char *  V 
)

Color conversion: from RGB to YUV.

Parameters:
r8 Red component
g8 Green component
b8 Blue component
Y pointer to luma component
U pointer to chrominance U component
V pointer to chrominance V component
void CRM32Pro_IPrimitives::SetCollisionMethod ( int  mode  ) 

Set the collision detection method.

You can adjust the kind of accuracy Vs speed of the whole collision detection system.
By default, the mode is set to 1 for a perfect pixel collision.

Parameters:
mode 0 to set a very fast boundingbox(less acurrate but extremely fast)
1 to set a perfect pixel collision(100% accurate but the slowest method)
2, 3, 4, .. to set the collision detection check each 2, 3, 4, ... pixels.
void CRM32Pro_IPrimitives::VLineColor ( SDL_Surface *  surf,
short  x,
short  y1,
short  y2,
unsigned int  color 
)

Draw a vertical line with bounce checking.

Tests the clipping region.

Parameters:
surf surface to render the line
x Desired x position
y1 Desired start y position
y2 Desired end y position
color Packet(RGBA) pixel color
void CRM32Pro_IPrimitives::VLineRGBA ( SDL_Surface *  surf,
short  x,
short  y1,
short  y2,
unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned char  a = 255 
)

Draw a vertical line with bounce checking.

Tests the clipping region.

Parameters:
surf surface to render the line
x Desired x position
y1 Desired start y position
y2 Desired end y position
r Red component
g Green component
b Blue component
a Alpha component. By default is 255.
void CRM32Pro_IPrimitives::YUVtoRGB ( unsigned char  Y,
unsigned char  U,
unsigned char  V,
unsigned char *  r8,
unsigned char *  g8,
unsigned char *  b8 
)

Color conversion: from YUV to RGB.

Parameters:
Y luma component
U chrominance U component
V chrominance V component
r8 pointer to Red component
g8 pointer to Green component
b8 pointer to Blue component

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

Generated on Mon Dec 21 17:04:40 2009 for CRM32Pro SDK v5.00 by  doxygen 1.6.1