libcrtxy background bitmap management
[The CRT X-Y library (libcrtxy)]


Modules

 libcrtxy bitmap positioning flags
 libcrtxy options for scaling bitmaps that don't match screen/window size

Data Structures

struct  XY_bitmap
 XY_bitmap - libcrtxy bitmap type. More...
XY_bitmapXY_load_bitmap (char *filename)
 Create a bitmap based on an image file.
XY_bitmapXY_load_bitmap_from_buffer (unsigned char *buffer, int size)
 Create a bitmap based on image data in a buffer.
void XY_free_bitmap (XY_bitmap *bitmap)
 Free a bitmap.
XY_bool XY_set_background (XY_color color, XY_bitmap *bitmap, XY_fixed x, XY_fixed y, int posflags, int scaling)
 Set the background color, and optional bitmap, its position, and options for scaling it to the screen size.
void XY_enable_background (XY_bool enable)
 Enable or disable the background bitmap (affects next frame).

Detailed Description

Todo:
Load bitmaps from an SDL_Surface
Todo:
Load bitmaps from RGBA pixel data

Function Documentation

XY_bitmap* XY_load_bitmap ( char *  filename  ) 

Create a bitmap based on an image file.

Parameters:
filename is the name of an image file to attempt to load.
Returns:
an XY_bitmap pointer on success, or NULL on failure and set error code to one of the following:

XY_bitmap* XY_load_bitmap_from_buffer ( unsigned char *  buffer,
int  size 
)

Create a bitmap based on image data in a buffer.

Parameters:
buffer is a pointer to memory containing image file data.
size is the size of the image file data.
Returns:
an XY_bitmap pointer on success, or NULL on failure and set error code to one of the following:

void XY_free_bitmap ( XY_bitmap bitmap  ) 

Free a bitmap.

Parameters:
bitmap is an XY_bitmap pointer to free. (Do not use the pointer any more! You may reuse your variable, if you create a new bitmap, of course.)

XY_bool XY_set_background ( XY_color  color,
XY_bitmap bitmap,
XY_fixed  x,
XY_fixed  y,
int  posflags,
int  scaling 
)

Set the background color, and optional bitmap, its position, and options for scaling it to the screen size.

Enables background bitmap.

Parameters:
color is an XY_color for the display's background. (The entire display will be this color, if no bitmap is provided, otherwise any part of the display not covered by the bitmap will be this color. Lines alpha-blended or anti-aliased in 'fake' rendering mode will blend against this color, as well.)
bitmap is an XY_bitmap pointer for a background image to use. It may be NULL if no background image is desired.
x represents how far right (or left, if negative) to nudge the background image after it has been positioned, in canvas units. Use 0 for no nudging.
y represents how far down (or up, if negative) to nudge the background image after it has been positioned, in canvas units. Use 0 for no nudging.
posflags determines how to position a bitmap. Use the "|" (or) bitwise operator to combine one horizontal choice (XY_POS_LEFT, XY_POS_HCENTER or XY_POS_RIGHT) with one vertical choice (XY_POS_TOP, XY_POS_VCENTER or XY_POS_BOTTOM). Use 0 as a shortcut for 'top left'.
scaling describes how the bitmap should be scaled. Use one of the following: XY_SCALE_NONE, XY_SCALE_STRETCH, XY_SCALE_KEEP_ASPECT_WIDE or XY_SCALE_KEEP_ASPECT_TALL.
Returns:
On success: XY_TRUE. On failure, XY_FALSE, and sets error code to one of the following:
Todo:
Support repeating backgrounds
Todo:
Support color overlays
Todo:
Support scaling bitmaps, relative to canvas

void XY_enable_background ( XY_bool  enable  ) 

Enable or disable the background bitmap (affects next frame).

Parameters:
enable set to XY_TRUE enables background bitmap (if any), and XY_FALSE disables it.


Generated on Tue Sep 2 23:45:36 2008 for libcrtxy by  doxygen 1.5.5