-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitmap.h
43 lines (33 loc) · 1.26 KB
/
bitmap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef BITMAP_H
#define BITMAP_H
struct bitmap * bitmap_create( int w, int h );
void bitmap_delete( struct bitmap *b );
struct bitmap * bitmap_load( const char *file );
int bitmap_save( struct bitmap *b, const char *file );
int bitmap_get( struct bitmap *b, int x, int y );
void bitmap_set( struct bitmap *b, int x, int y, int value );
int bitmap_width( struct bitmap *b );
int bitmap_height( struct bitmap *b );
void bitmap_reset( struct bitmap *b, int value );
int *bitmap_data( struct bitmap *b );
#ifndef MAKE_RGBA
/** Create a 32-bit RGBA value from 8-bit red, green, blue, and alpha values */
#define MAKE_RGBA(r,g,b,a) ( (((int)(a))<<24) | (((int)(r))<<16) | (((int)(g))<<8) | (((int)(b))<<0) )
#endif
#ifndef GET_RED
/** Extract an 8-bit red value from a 32-bit RGBA value. */
#define GET_RED(rgba) (( (rgba)>>16 ) & 0xff )
#endif
#ifndef GET_GREEN
/** Extract an 8-bit green value from a 32-bit RGBA value. */
#define GET_GREEN(rgba) (( (rgba)>>8 ) & 0xff )
#endif
#ifndef GET_BLUE
/** Extract an 8-bit blue value from a 32-bit RGBA value. */
#define GET_BLUE(rgba) (( (rgba)>>0 ) & 0xff )
#endif
#ifndef GET_ALPHA
/** Extract an 8-bit alpha value from a 32-bit RGBA value. */
#define GET_ALPHA(rgba) (( (rgba)>>24 ) & 0xff)
#endif
#endif