Client Library - Image API


Detailed Description

detailed description

Example:
for further information look in demo/img/

 int x;
 int y;
 s_image_t *img;
 s_surface_t *surface;
 char *file = "file.img";

 // initialize img struct
 s_image_init(&img);

 // parse and load file to img struct
 s_image_img(file, img);

 // paste img to the surface
 s_putboxrgba(surface, x + img->x, y + img->y, img->w, img->h, img->rgba);

 // or
 s_image_get_buf(surface, img);
 s_putbox(surface, x + img->x, y + img->y, img->w, img->h, img->buf);

 // or
 s_image_get_buf(surface, img);
 s_image_get_mat(surface, img);
 s_putboxmask(surface, x + img->x, y + img->y, img->w, img->h, img->buf, img->mat);

 // or
 s_image_get_buf(surface, img);
 s_image_get_mat(surface, img);
 s_putboxalpha(surface, x + img->x, y + img->y, img->w, img->h, img->buf, img->mat);

 // when finished, uninitialize img struct
 s_image_uninit(img);


Data Structures

struct  s_image_s
 image struct More...

Functions

int s_image_hex2int (char *str)
 convert a hex str to int
int s_image_get_mat (s_image_t *img)
 generates alpha values for given image
int s_image_get_buf (s_surface_t *surface, s_image_t *img)
 generates image buffer using surface, for given image
void s_image_get_handler (s_image_t *img)
 calculates handler for given image
int s_image_init (s_image_t **img)
 initializes image struct
void s_image_free_buf (s_image_t *img)
 frees memory used for buf, and sets it to NULL.
void s_image_free_mat (s_image_t *img)
 frees memory used for mat, and sets it to NULL.
void s_image_free_rgba (s_image_t *img)
 frees memory used for rgb, and sets it to NULL.
void s_image_free_handler (s_image_t *img)
 frees memory used for handler, and sets it to NULL.
int s_image_uninit (s_image_t *img)
 uninitializes image struct
int s_image_layer_init (s_image_t **lyr)
 initializes image struct
int s_image_layer_uninit (s_image_t *lyr)
 uninitializes image struct
int s_image_layers_init (s_image_t *img)
 initializes layer list for given image
int s_image_layers_uninit (s_image_t *img)
 uninitializes layer list for given image
int s_image_img (char *file, s_image_t *img)
 fills image struct by calling the approtiated function, if the file is a supported format
int s_image_gif_is (char *file)
 checks if the file is a gif
int s_image_gif (char *file, s_image_t *img)
 fills the image struct
int s_image_png_is (char *file)
 checks if the file is a png
int s_image_png (char *file, s_image_t *img)
 fills the image struct
int s_image_xpm_is (char *file)
 checks if the file is a xpm
int s_image_xpm (char *file, s_image_t *img)
 fills the image struct


Function Documentation

void s_image_free_buf ( s_image_t img  ) 

frees memory used for buf, and sets it to NULL.

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

void s_image_free_handler ( s_image_t img  ) 

frees memory used for handler, and sets it to NULL.

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

void s_image_free_mat ( s_image_t img  ) 

frees memory used for mat, and sets it to NULL.

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

void s_image_free_rgba ( s_image_t img  ) 

frees memory used for rgb, and sets it to NULL.

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_get_buf ( s_surface_t surface,
s_image_t img 
)

generates image buffer using surface, for given image

Parameters:
*surface - pointer to a valid surface.
*img - the image
Returns:
0 on success, 1 on error.

void s_image_get_handler ( s_image_t img  ) 

calculates handler for given image

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_get_mat ( s_image_t img  ) 

generates alpha values for given image

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_gif ( char *  file,
s_image_t img 
)

fills the image struct

Parameters:
*file - exact path to the file
*img - the image
Returns:
0 on success, 1 on error.

int s_image_gif_is ( char *  file  ) 

checks if the file is a gif

Parameters:
*file - exact path to the file
Returns:
0 on success, 1 on error.

int s_image_hex2int ( char *  str  ) 

convert a hex str to int

Parameters:
*str - pointer to a buffer of chars with at least length 2
Returns:
the value.

int s_image_img ( char *  file,
s_image_t img 
)

fills image struct by calling the approtiated function, if the file is a supported format

Parameters:
*file - exact path to the file
*img - the image
Returns:
0 on success, 1 on error.

int s_image_init ( s_image_t **  img  ) 

initializes image struct

Parameters:
**img - address of the pointer to image struct
Returns:
0 on success, 1 on error.

int s_image_layer_init ( s_image_t **  lyr  ) 

initializes image struct

Parameters:
**lyr - address of the pointer to image struct
Returns:
0 on success, 1 on error.

int s_image_layer_uninit ( s_image_t lyr  ) 

uninitializes image struct

Parameters:
*lyr - the layer
Returns:
0 on success, 1 on error.

int s_image_layers_init ( s_image_t img  ) 

initializes layer list for given image

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_layers_uninit ( s_image_t img  ) 

uninitializes layer list for given image

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_png ( char *  file,
s_image_t img 
)

fills the image struct

Parameters:
*file - exact path to the file
*img - the image
Returns:
0 on success, 1 on error.

int s_image_png_is ( char *  file  ) 

checks if the file is a png

Parameters:
*file - exact path to the file
Returns:
0 on success, 1 on error.

int s_image_uninit ( s_image_t img  ) 

uninitializes image struct

Parameters:
*img - the image
Returns:
0 on success, 1 on error.

int s_image_xpm ( char *  file,
s_image_t img 
)

fills the image struct

Parameters:
*file - exact path to the file
*img - the image
Returns:
0 on success, 1 on error.

int s_image_xpm_is ( char *  file  ) 

checks if the file is a xpm

Parameters:
*file - exact path to the file
Returns:
0 on success, 1 on error.


Generated on Wed Dec 27 17:53:06 2006 for xynth-0.8.40 by  doxygen 1.4.7