Public Member Functions

CRM32Pro_IImage Class Reference
[MODULE 4: IImage v3.13, Image Package Format interface.]

IImage. More...


Detailed Description

IImage.

Interface to manage images.

List of all members.

Public Member Functions

int isBMP (const char *file)
 Check if the given file is a BMP.
int isPNG (const char *file)
 Check if the given file is a PNG.
SDL_Surface * Load (int idDPF, char *imgname, sHeaderIPF *header=NULL)
 Load an IPF from a DPF(using an idDPF).
SDL_Surface * Load (char *fileDPF, char *imgname, sHeaderIPF *header=NULL)
 Load an IPF from a DPF(using a filename).
SDL_Surface * LoadBMP (const char *filename)
 Load a BMP.
SDL_Surface * LoadIMG (const char *filename)
 Load an image (BMP or PNG).
SDL_Surface * LoadPNG (const char *filename)
 Load a PNG from an external file.
SDL_Surface * LoadPNG (void *mem, int size)
 Load a PNG from a memory block.
int Save (int idDPF, char *imgname, SDL_Surface *image)
 Save a surface into a DPF.
int Save (char *fileDPF, char *imgname, SDL_Surface *image)
 Save a surface into a DPF.
int SaveBMP (char *filename, SDL_Surface *surface)
 Save a given surface in an external BMP file.
int SavePNG (char *filename, SDL_Surface *surface, int compression=IIMAGE_PNGCOMPRESS_DEFAULT)
 Save a given surface in an external PNG file.

Member Function Documentation

int CRM32Pro_IImage::isBMP ( const char *  filename  ) 

Check if the given file is a BMP.

Parameters:
filename Name of the BMP
Returns:
0 It is not a BMP
1 It is a BMP
int CRM32Pro_IImage::isPNG ( const char *  filename  ) 

Check if the given file is a PNG.

Parameters:
filename Name of the PNG
Returns:
0 It is not a PNG
1 It is a PNG
SDL_Surface * CRM32Pro_IImage::Load ( int  idDPF,
char *  imgname,
sHeaderIPF header = NULL 
)

Load an IPF from a DPF(using an idDPF).

Parameters:
idDPF ID of the opened DPF
imgname Image name stored in the DPF
header Deprecated. NULL by default. Pointer to an IPF header which will be filled up with the image info.
Returns:
NULL Failed
Any other value, a pointer to the converted surface to the screen format(if available)
SDL_Surface * CRM32Pro_IImage::Load ( char *  fileDPF,
char *  imgname,
sHeaderIPF header = NULL 
)

Load an IPF from a DPF(using a filename).

Parameters:
fileDPF Name of the DPF
imgname Image name stored in the DPF
header Deprecated. NULL by default. Pointer to an IPF header which will be filled up with the image info.
Returns:
NULL Failed
Any other value, a pointer to the converted surface to the screen format(if available)
Examples:
Example01_BasicCode.cpp, Example03_GUI.cpp, Example05_VideoPlayer.cpp, Example08_SpriteCollision.cpp, Example09_LogicRenderRates.cpp, Example12_DRTS.cpp, and SpacePong.cpp.
SDL_Surface * CRM32Pro_IImage::LoadBMP ( const char *  filename  ) 

Load a BMP.

If you do not want to auto convert the BMP surface to current screen format, you must use SDL_LoadBMP().

Parameters:
filename Name of the BMP
Returns:
a converted surface to the screen format(if available)
SDL_Surface * CRM32Pro_IImage::LoadIMG ( const char *  filename  ) 

Load an image (BMP or PNG).

It will try to open a BMP or a PNG and will convert the surface to the current screen format(if any).
It fully supports alpha per pixel PNGs.

Parameters:
filename Name of the BMP or PNG
Returns:
a converted surface to the screen format(if available)
SDL_Surface * CRM32Pro_IImage::LoadPNG ( void *  mem,
int  size 
)

Load a PNG from a memory block.

It will try to convert the surface to the current screen format(if any). It fully supports alpha per pixel PNGs.

Parameters:
mem Pointer to the memory block that contains the PNG
size Size of the memory block
Returns:
a converted surface to the screen format(if available)
SDL_Surface * CRM32Pro_IImage::LoadPNG ( const char *  filename  ) 

Load a PNG from an external file.

It will try to convert the surface to the current screen format(if any). It fully supports alpha per pixel PNGs.

Parameters:
filename Name of the PNG
Returns:
a converted surface to the screen format(if available)
int CRM32Pro_IImage::Save ( char *  fileDPF,
char *  imgname,
SDL_Surface *  image 
)

Save a surface into a DPF.

Parameters:
fileDPF name and optional path of a DPF to store this image
imgname Desired name to store your image in the DPF
image Pointer to a SDL_surface with your surface
Returns:
-1 Image already exists.
0 Failed.
any other positive value, Ok and packed size of the added image
int CRM32Pro_IImage::Save ( int  idDPF,
char *  imgname,
SDL_Surface *  srcimage 
)

Save a surface into a DPF.

Parameters:
idDPF ID of the opened DPF
imgname Desired name to store your image in the DPF
srcimage Pointer to a SDL_surface with your surface
Returns:
-1 Image already exists.
0 Failed.
any other positive value, Ok and packed size of the added image
int CRM32Pro_IImage::SaveBMP ( char *  filename,
SDL_Surface *  surface 
)

Save a given surface in an external BMP file.

If a BMP already exists, it will be replaced with the new one.

Parameters:
filename Name and optional path of the BMP
surface Pointer to a SDL_surface with your surface
Returns:
0 Failed
1 Ok
int CRM32Pro_IImage::SavePNG ( char *  filename,
SDL_Surface *  surface,
int  compression = IIMAGE_PNGCOMPRESS_DEFAULT 
)

Save a given surface in an external PNG file.

If a PNG already exists, it will be replaced with the new one.

Parameters:
filename Name of the PNG
surface Pointer to a SDL_surface with your surface
compression Set desired compression value. From 0(minimum) to 9(maximum). By default, it is -1 (let pnglib chooses the level).
Returns:
0 Failed
1 Ok

The documentation for this class was generated from the following files:
 All Classes Functions Variables