Working with images
[Images]

Some basic useful routines when working with your images. More...

Defines

#define ulSetImageTint(img, tint)   (img->tint1 = img->tint2 = img->tint3 = img->tint4 = tint)
#define ulSetImageTile(img, x0, y0, x1, y1)   ({ (img)->offsetX0 = x0; (img)->offsetY0 = y0; (img)->offsetX1 = x1; (img)->offsetY1 = y1; (img)->stretchX = (x1) - (x0); (img)->stretchY = (y1) - (y0); })
#define ulSetImageTileSize(img, x0, y0, x1, y1)   ({ (img)->offsetX0 = x0; (img)->offsetY0 = y0; (img)->offsetX1 = (x0) + (x1); (img)->offsetY1 = (y0) + (y1); (img)->stretchX = x1; (img)->stretchY = y1; })
#define ulResetImageTile(img)   ({ (img)->offsetX0 = 0; (img)->offsetY0 = 0; (img)->offsetX1 = (img)->sizeX; (img)->offsetY1 = (img)->sizeY; (img)->stretchX = (img)->sizeX; (img)->stretchY = (img)->sizeY; })

Functions

void ulResetImageProperties (UL_IMAGE *img)
void ulMirrorImageH (UL_IMAGE *img, int mirrorState)
void ulMirrorImageV (UL_IMAGE *img, int mirrorState)

Detailed Description

Some basic useful routines when working with your images.


Define Documentation

#define ulSetImageTint ( img,
tint   )     (img->tint1 = img->tint2 = img->tint3 = img->tint4 = tint)

Defines the uniform tint of an image.

#define ulSetImageTile ( img,
x0,
y0,
x1,
y1   )     ({ (img)->offsetX0 = x0; (img)->offsetY0 = y0; (img)->offsetX1 = x1; (img)->offsetY1 = y1; (img)->stretchX = (x1) - (x0); (img)->stretchY = (y1) - (y0); })

Defines the coordinates of the image part to display. You can for example have a "sprite sheet" (very big image containing several sprites) and choose between them by selecting a small rectangular area as an image tile and draw it.

Important: This command will reset the stretch factors of the image to the size of the tile. So, if you want your image to be zoomed, you need to stretch it again after having called this.

#define ulSetImageTileSize ( img,
x0,
y0,
x1,
y1   )     ({ (img)->offsetX0 = x0; (img)->offsetY0 = y0; (img)->offsetX1 = (x0) + (x1); (img)->offsetY1 = (y0) + (y1); (img)->stretchX = x1; (img)->stretchY = y1; })

Same as ulSetImageTile, except that you pass the tile size instead of bottom-right coordinates.

#define ulResetImageTile ( img   )     ({ (img)->offsetX0 = 0; (img)->offsetY0 = 0; (img)->offsetX1 = (img)->sizeX; (img)->offsetY1 = (img)->sizeY; (img)->stretchX = (img)->sizeX; (img)->stretchY = (img)->sizeY; })

Resets the internal tile coordinates so that the full image will be drawn on the screen.


Function Documentation

void ulResetImageProperties ( UL_IMAGE img  ) 

Resets all properties of an image to the default. Useful if you do a lot of transformations to your image and you want to be sure they will not be left for the next drawing.

void ulMirrorImageH ( UL_IMAGE img,
int  mirrorState 
)

Mirrors the image horizontally.

Parameters:
img Image you want to flip.
mirrorState Set to 1 (true) to mirror horizontally, 0 (false) to disable mirroring.

void ulMirrorImageV ( UL_IMAGE img,
int  mirrorState 
)

Mirrors the image vertically.

Parameters:
img Image you want to flip.
mirrorState Set to 1 (true) to mirror horizontally, 0 (false) to disable mirroring.


Generated on Sat Jul 14 23:39:33 2007 by  doxygen 1.5.2