CRM32Pro SDK  v5.22
List of all members | Public Member Functions
CRM32Pro_IScreenFX Class Reference

IScreenFX. More...

Detailed Description

IScreenFX.

Screen FX interface system.

Public Member Functions

int Blur (SDL_Surface *surface, int blur_pct)
 Add blur to given surface. More...
 
int FadeToColor (unsigned char r, unsigned char g, unsigned char b, unsigned int ms, SDL_Rect *rdst=NULL)
 Fade current CRM32Pro.screen surface to given color using alpha channel in the given time. More...
 
int FadeToImage (SDL_Surface *surface, unsigned int ms, SDL_Rect *rdst=NULL, SDL_Rect *rsrc=NULL)
 Fade to given surface from CRM32Pro.screen surface using alpha channel in the given time. More...
 
SDL_Surface * Flip (SDL_Surface *src, SDL_Rect *src_rect=NULL, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Surface flip. More...
 
int GammaCorrect (SDL_Surface *surface, int r, int g, int b)
 Set gamma to given surface using RGB. More...
 
SDL_Surface * Mirror (SDL_Surface *src, SDL_Rect *src_rect=NULL, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Surface mirror. More...
 
int Noise (SDL_Surface *surface, int noise_pct)
 Add noise to given surface. More...
 
void RenderFX (SDL_Surface *src, SDL_Surface *dst, int effect)
 Render simple special fx per surface. More...
 
SDL_Surface * Resize (SDL_Surface *src, SDL_Rect *src_rect, int smooth, double fx, double fy, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Resize a surface. More...
 
SDL_Surface * Resize (SDL_Surface *src, SDL_Rect *src_rect, int smooth, int sx, int sy, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Resize a surface. More...
 
SDL_Surface * Rotate (SDL_Surface *src, SDL_Rect *src_rect, int smooth, double angle, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Rotate a surface. More...
 
SDL_Surface * RotateResize (SDL_Surface *src, SDL_Rect *src_rect, int smooth, double angle, double zoom, SDL_Surface *dst=NULL, SDL_Rect *dst_rect=NULL)
 Rotate and resize a surface. More...
 

Member Function Documentation

int CRM32Pro_IScreenFX::Blur ( SDL_Surface *  surface,
int  blur_pct 
)

Add blur to given surface.

Not supported on OpenGL modes.

Parameters
surfacesurface to apply blur effect
blur_pctvalue of noise to add (0-100)
Returns
0 Failed
1 Ok
int CRM32Pro_IScreenFX::FadeToColor ( unsigned char  r,
unsigned char  g,
unsigned char  b,
unsigned int  ms,
SDL_Rect *  rdst = NULL 
)

Fade current CRM32Pro.screen surface to given color using alpha channel in the given time.

Parameters
rred component(0-255) of the desired color to fade.
ggreen component(0-255) of the desired color to fade.
bblue component(0-255) of the desired color to fade.
msduration in milliseconds to perform the fade.
rdstoptional pointer to SDL_Rect with the area of CRM32Pro.screen where to perform the fade.By default, the whole surface.
Returns
0 Failed
1 Ok
Examples:
Example03_GUI.cpp, and SpacePong.cpp.
int CRM32Pro_IScreenFX::FadeToImage ( SDL_Surface *  surface,
unsigned int  ms,
SDL_Rect *  rdst = NULL,
SDL_Rect *  rsrc = NULL 
)

Fade to given surface from CRM32Pro.screen surface using alpha channel in the given time.

Parameters
surfacesurface to blend with screen. You can not use CRM32Pro.screen in this parameter. This surface can not have alpha per-pixel.
msduration in milliseconds to perform the fade.
rdstoptional pointer to SDL_Rect with the area of CRM32Pro.screen where to perform the fade.By default, the whole surface.
rsrcoptional pointer to SDL_Rect with the area of given surface to be used to perform the fade.By default, the whole surface.
Returns
0 Failed
1 Ok
Examples:
SpacePong.cpp.
SDL_Surface * CRM32Pro_IScreenFX::Flip ( SDL_Surface *  src,
SDL_Rect *  src_rect = NULL,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Surface flip.

All color depth are very fast.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new flipped surface.

Parameters
srcsource surface
src_rectRect to flip on the source surface. NULL to flip the whole surface.
dstDestination surface used to blit there the flipped surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together with dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new flipped surface or if dst was specified, it will return dst(just to check it worked)
int CRM32Pro_IScreenFX::GammaCorrect ( SDL_Surface *  surface,
int  r,
int  g,
int  b 
)

Set gamma to given surface using RGB.

Not supported on OpenGL modes.

Parameters
surfacesurface to apply gamma filter
rred component
ggreen component
bblue component
Returns
0 Failed
1 Ok
SDL_Surface * CRM32Pro_IScreenFX::Mirror ( SDL_Surface *  src,
SDL_Rect *  src_rect = NULL,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Surface mirror.

All color depth are fast.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new mirrored surface.

Parameters
srcsource surface
src_rectRect to mirror on the source surface. NULL to mirror the whole surface.
dstDestination surface used to blit there the mirrored surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together with dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new mirror surface or if dst was specified, it will return dst(just to check it worked)
int CRM32Pro_IScreenFX::Noise ( SDL_Surface *  surface,
int  noise_pct 
)

Add noise to given surface.

Not supported on OpenGL modes

Parameters
surfacesurface to apply noise effect
noise_pctvalue of noise to add (0-100)
Returns
0 Failed
1 Ok
void CRM32Pro_IScreenFX::RenderFX ( SDL_Surface *  src,
SDL_Surface *  dst,
int  iFX 
)

Render simple special fx per surface.

Note it needs a fast CPU.
In OpenGL modes some effects are disabled (check FXSCREEN_xx definition)

Parameters
srcsource surface to do the selected special fx
dstdestination surface to dump the selected special fx. In OpenGL modes, itīs useless as always blits to CRM32Pro.screen
iFXtype of special fx to apply. See FXSCREEN_xx definition.
SDL_Surface * CRM32Pro_IScreenFX::Resize ( SDL_Surface *  src,
SDL_Rect *  src_rect,
int  smooth,
double  fx,
double  fy,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Resize a surface.

8bits and 32bits surfaces are very fast. 16bits surfaces are fast and 24bits are slower.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new resized surface.

Parameters
srcsource surface
src_rectResize rect in the source surface. NULL to resize the whole surface.
smooth0 to do nothing. 1 to perform anti-aliasing filter(best quality and slower). It has no sense on 8bits surfaces.
fxResize factor in X axis. Example: 1.0 means to do nothing. Negative value to flip this axis(does not work with smooth filter).
fyResize factor in Y axis. Example: 2.0 means to duplicate this coordinate. Negative value to flip this axis(does not work with smooth filter).
dstDestination surface used to blit there the resized surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together with dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new resized surface or if dst was specified, it will return dst(just to check it worked)
SDL_Surface * CRM32Pro_IScreenFX::Resize ( SDL_Surface *  src,
SDL_Rect *  src_rect,
int  smooth,
int  sx,
int  sy,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Resize a surface.

8bits and 32bits surfaces are very fast. 16bits surfaces are fast and 24bits are slower.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new resized surface.

Parameters
srcsource surface
src_rectResize rect in the source surface. NULL to resize the whole surface.
smooth0 to do nothing. 1 to perform anti-aliasing filter(best quality and slower). It has no sense on 8bits surfaces.
sxDesired width in pixels for the resized surface. Negative value to flip this axis(does not work with smooth filter).
syDesired height in pixels for the resized surface. Negative value to flip this axis(does not work with smooth filter).
dstDestination surface used to blit there the resized surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together with dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new resized surface or if dst was specified, it will return dst(just to check it worked)
SDL_Surface * CRM32Pro_IScreenFX::Rotate ( SDL_Surface *  src,
SDL_Rect *  src_rect,
int  smooth,
double  angle,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Rotate a surface.

8bits and 32bits surfaces are fast. 16bits surfaces are normal speed and 24bits are slower.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new rotated surface.

Parameters
srcsource surface
src_rectRect to rotate on the source surface. NULL to rotate the whole surface.
smooth0 to do nothing. 1 to perform anti-aliasing filter(best quality and slower). It has no sense on 8bits surfaces.
angleDesired rotation on degrees
dstDestination surface used to blit there the rotated surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new rotated surface or if dst was specified, it will return dst(just to check it worked)
SDL_Surface * CRM32Pro_IScreenFX::RotateResize ( SDL_Surface *  src,
SDL_Rect *  src_rect,
int  smooth,
double  angle,
double  zoom,
SDL_Surface *  dst = NULL,
SDL_Rect *  dst_rect = NULL 
)

Rotate and resize a surface.

8bits and 32bits surfaces are fast. 16bits surfaces are normal speed and 24bits are slower.
If dst is used, it has to match the color depth of src surface. Otherwise, it will not render anything.
This method work on two different ways: with dst it will only render the output to that surface and without it, it will return a new rotated/resized surface.

Parameters
srcsource surface
src_rectRect to rotate/resize on the source surface. NULL to rotate/resize the whole surface.
smooth0 to do nothing. 1 to perform anti-aliasing filter(best quality and slower). It has no sense on 8bits surfaces.
angleDesired rotation in degrees
zoomResize factor in X and Y axes. Examples: 1.0 means to do nothing. 2.0 means to duplicate both axes.
dstDestination surface used to blit there the rotated/resized surface. It will also avoid to create a new surface. With OpenGL modes, it will always blit to CRM32Pro.screen.
dst_rectRect on the destination surface(only x and y are used) to render the result. Only has sense used together dst or OpenGL modes.
Returns
NULL Failed.
any other value, the pointer to a new rotated/resized surface or if dst was specified, it will return dst(just to check it worked)

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