Bitmap functions
This module implements bitmap functions for DEGFX. (../include/degfx/bitmap.h)
Part of the degfx library.
MX_BITMAP
A bitmap type
MX_BITMAP* mx_bitmap(int x2, int y2)
Create a bitmap
(../include/degfx/bitmap.h)
Bitmap is derived from MX_ATOM so it must be destroyed with mx_delete().
(../include/degfx/bitmap/bitmap.c)
MX_BITMAP* mx_bitmap_tga(const char* filename)
Load a bitmap from a TGA file
(../include/degfx/bitmap.h)
Source taken from the TGA reader from Allegro and extensively modified.
(../include/degfx/bitmap/loadtga.c)
MX_BITMAP* mx_bitmap_gif(const char* filename)
Load a bitmap from a GIF file
MX_BITMAP* mx_bitmap_pcx(const char* filename)
Load a bitmap from a PCX file
(../include/degfx/bitmap.h)
PCX loading source taken from Allegro source and extensively modified.
(../include/degfx/bitmap/loadpcx.c)
MX_BITMAP* mx_bitmap_pcx_greyscale(const char* filename)
Load a bitmap from a PCX file and convert it to greyscale
(../include/degfx/bitmap.h)
This function is primarily intended as a helper by font loading.
(../include/degfx/bitmap/loadpcx.c)
MX_BITMAP* mx_bitmap_clone(const MX_BITMAP* other)
Make a complete copy of a bitmap
unsigned mx_bitmap_clip(MX_BITMAP* bitmap, const MX_RECT* newclip)
Set a bitmaps clipping area
const MX_RECT* mx_bitmap_clip_get(const MX_BITMAP* bitmap)
Return a bitmaps clipping area
void mx_bitmap_offset(MX_BITMAP* bitmap, int x1, int y1)
Offset a bitmap
Subsequent drawing on the bitmap will be offset. (../include/degfx/bitmap.h)
typedef MX_PIXEL* MX_BITMAP_ITER;
Fast pixel-level iterator for a bitmap
MX_BITMAP_ITER mx_bitmap_iter(const MX_BITMAP* bitmap, int x1, int y1)
Return pixel-level iterator at a given position
MX_BITMAP_ITER mx_bitmap_begin(const MX_BITMAP* bitmap)
Return pixel-level iterator at the top left position
MX_BITMAP_ITER mx_bitmap_end(const MX_BITMAP* bitmap)
Return pixel-level iterator at the lower right position
MX_PIXEL mx_bitmap_getpixel(const MX_BITMAP* bitmap, int x1, int y1)
Return pixel a a given position
(../include/degfx/bitmap.h)
If the coordinates are outside the bitmap area then 0 is returned.
(../include/degfx/bitmap/getpixel.c)
void mx_bitmap_pixel(MX_BITMAP* bitmap, int x1, int y1, MX_PIXEL color)
Draw a pixel on a bitmap
(../include/degfx/bitmap.h)
If the specified coordinates are outside the area of the bitmap then
this function does nothing.
(../include/degfx/bitmap/pixel.c)
void mx_bitmap_vline(MX_BITMAP* bitmap, int x1, int y1, int y2, MX_PIXEL color)
Draw a vertical line on a bitmap
void mx_bitmap_hline(MX_BITMAP* bitmap, int x1, int y1, int x2, MX_PIXEL color)
Draw a horizontal line on a bitmap
void mx_bitmap_line(MX_BITMAP* bitmap, int x1, int y1, int x2, int y2, MX_PIXEL color)
Draw a line on a bitmap
void mx_bitmap_rectfill(MX_BITMAP* bitmap, int x1, int y1, int x2, int y2, MX_PIXEL color)
Draw a filled rectangle on a bitmap
(../include/degfx/bitmap.h)
The current implementation uses horizontal lines to fill the rectangle.
(../include/degfx/bitmap/rectfill.c)
void mx_bitmap_clear(MX_BITMAP* bitmap, MX_PIXEL color)
Clear a bitmap to a solid color
void mx_bitmap_blit(const MX_BITMAP* src, MX_BITMAP* dest, int sx, int sy, int dx, int dy, int w, int h)
Blit a bitmap onto another bitmap
This function uses the pixel transparency of the source bitmap
(../include/degfx/bitmap.h)
If the w or h parameter is set to MXDEFAULT the source bitmap width
(or height) will be used.
(../include/degfx/bitmap/blit.c)
The curent implementation requires that the source and destination bitmaps be different. (../include/degfx/bitmap/blit.c)
If either of the w or h parameters is less than zer this function does nothing. (../include/degfx/bitmap/blit.c)
The transparency is handeled per pixel and the source determines the transparency. (../include/degfx/bitmap/blit.c)
void mx_bitmap_blitcopy(const MX_BITMAP* src, MX_BITMAP* dest, int sx, int sy, int dx, int dy, int w, int h)
Blit a bitmap onto another bitmap
This function uses no transparency
(../include/degfx/bitmap.h)
The curent implementation requires that the source and destination
bitmaps be different.
(../include/degfx/bitmap/blitcopy.c)
If the w or h parameter is set to MXDEFAULT the source bitmap width (or height) will be used. (../include/degfx/bitmap/blitcopy.c)
void mx_bitmap_blittrans(const MX_BITMAP* src, MX_BITMAP* dest, int sx, int sy, int dx, int dy, int w, int h, unsigned long trans)
Blit a bitmap onto another bitmap
This function uses the a single transparency level
(../include/degfx/bitmap.h)
The w and h parameters may be MXDEFAULT and the width of the source
bitmap will be used.
(../include/degfx/bitmap/trans.c)
The current implementation requires that the source and destination bitmaps not refer to the same bitmap. (../include/degfx/bitmap/trans.c)
void mx_bitmap_blitstretch(const MX_BITMAP* src, MX_BITMAP* dest, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
Stretch-blit a bitmap onto another bitmap
This function uses the pixel transparency of the source bitmap
(../include/degfx/bitmap.h)
The default source poisition is 0,0.
(../include/degfx/bitmap/stretch.c)
The default source height and width is the height and width of the source bitmap. (../include/degfx/bitmap/stretch.c)
The default destination poisition is 0,0. (../include/degfx/bitmap/stretch.c)
The default destinantion height and width is the height and width of the destination bitmap. (../include/degfx/bitmap/stretch.c)
Bitmap stretch algorithm is very simple and could definetly be improved. (../include/degfx/bitmap/stretch.c)
void mx_bitmap_box(MX_BITMAP* bitmap, int x1, int y1, int x2, int y2, int width, MX_PIXEL light, MX_PIXEL dark)
Draw a box on a bitmap
void mx_bitmap_frame(MX_BITMAP* bitmap, int x1, int y1, int x2, int y2, int width, MX_PIXEL light, MX_PIXEL dark, MX_PIXEL fill)
Draw a frame on a bitmap
void mx_bitmap_decorate(const MX_BITMAP* src, MX_BITMAP* dest, int x, int y, int x1, int y1, int x2, int y2)
Blitting function for drawing gui objects
unsigned mx_bitmap_collision(const MX_BITMAP* src, const MX_BITMAP* dest, int sx, int sy, int dx, int dy, unsigned int thresh)
Check if two bitmaps overlap on any pixels
Pixel level transparency is taken into account (../include/degfx/bitmap.h)
#define mx_iter(x,y)
Get an iterator to a given position on the screen
#define mx_getpixel(x,y)
Return the pixel at a given position on the screen
#define mx_pixel(x,y,c)
Draw a pixel on the screen
#define mx_vline(x,y1,y2,c)
Draw a vertical line on the screen
#define mx_hline(x1,y,x2,c)
Draw a horizontal line on the screen
#define mx_line(x1,y1,x2,y2,c)
Draw a line on the screen
#define mx_rectfill(x1,y1,x2,y2,c)
Draw a filled rectangle on the screen
#define mx_clear(c)
Clear the screen to a solid color
#define mx_blit(s,sx,sy,dx,dy,w,h)
Blit a bitmap onto the screen
This function uses the pixel transparency of the source bitmap (../include/degfx/bitmap.h)
#define mx_blitcopy(s,sx,sy,dx,dy,w,h)
Blit a bitmap onto the screen
This function uses no transparency (../include/degfx/bitmap.h)
#define mx_blittrans(s,sx,sy,dx,dy,w,h,t)
Blit a bitmap onto the screen
This function uses the a single transparency level (../include/degfx/bitmap.h)
#define mx_blitstretch(s,sx,sy,sw,sh,dx,dy,dw,dh)
Stretch-blit a bitmap onto the screen
This function uses the pixel transparency of the source bitmap (../include/degfx/bitmap.h)
#define mx_box(x1,y1,x2,y2,w,l,d)
Draw a box on the screen
#define mx_frame(x1,y1,x2,y2,w,l,d,f)
Draw a frame on the screen
#define mx_decorate(s,x,y,x1,y1,x2,y2)
Blitting function for drawing gui objects on the screen
bitmap.h" unsigned mx_bitmap_collision(const MX_BITMAP* src, const MX_BITMAP* dest, int sx, int sy, int dx, int dy, unsigned int thresh)
Collision is defined by both bitmaps having a transparency less than the threshold on overlapping pixels. (../include/degfx/bitmap/collisio.c)
bitmap.h" void mx_bitmap_decorate(const MX_BITMAP* src, MX_BITMAP* dest, int x, int y, int x1, int y1, int x2, int y2)
The corners of the source bitmap are copied as normal. (../include/degfx/bitmap/decorate.c)
bitmap.h" MX_BITMAP_ITER mx_bitmap_iter(const MX_BITMAP* bitmap, int x1, int y1)
If the pixel position is outside the area of the bitmap then 0 is returned. (../include/degfx/bitmap/iter.c)
Generated by MXDOC 2.2 on Sun Feb 4 15:16:26 2007