cctools
|
00001 /* 00002 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin 00003 Copyright (C) 2005- The University of Notre Dame 00004 This software is distributed under the GNU General Public License. 00005 See the file COPYING for details. 00006 */ 00007 00008 #ifndef BITMAP_H 00009 #define BITMAP_H 00010 00011 struct bitmap *bitmap_create(int w, int h); 00012 void bitmap_delete(struct bitmap *b); 00013 00014 int bitmap_get(struct bitmap *b, int x, int y); 00015 void bitmap_set(struct bitmap *b, int x, int y, int value); 00016 int bitmap_width(struct bitmap *b); 00017 int bitmap_height(struct bitmap *b); 00018 void bitmap_reset(struct bitmap *b, int value); 00019 int *bitmap_data(struct bitmap *b); 00020 00021 void bitmap_rotate_clockwise(struct bitmap *s, struct bitmap *t); 00022 void bitmap_rotate_counterclockwise(struct bitmap *s, struct bitmap *t); 00023 00024 int bitmap_average(struct bitmap *s); 00025 void bitmap_smooth(struct bitmap *s, struct bitmap *t, int msize); 00026 void bitmap_subset(struct bitmap *s, int x, int y, struct bitmap *t); 00027 void bitmap_convolve(struct bitmap *s, struct bitmap *t, int (*f) (int x)); 00028 void bitmap_copy(struct bitmap *s, struct bitmap *t); 00029 00030 struct bitmap *bitmap_load_any(const char *path); 00031 00032 struct bitmap *bitmap_load_raw(const char *file); 00033 struct bitmap *bitmap_load_bmp(const char *file); 00034 struct bitmap *bitmap_load_pcx(const char *file); 00035 struct bitmap *bitmap_load_sgi_rgb(const char *file); 00036 struct bitmap *bitmap_load_jpeg(const char *file); 00037 00038 int bitmap_save_raw(struct bitmap *b, const char *file); 00039 int bitmap_save_bmp(struct bitmap *b, const char *file); 00040 int bitmap_save_jpeg(struct bitmap *b, const char *file); 00041 00042 #ifndef MAKE_RGBA 00043 00044 #define MAKE_RGBA(r,g,b,a) ( (((int)(a))<<24) | (((int)(r))<<16) | (((int)(g))<<8) | (((int)(b))<<0) ) 00045 #endif 00046 00047 #ifndef GET_RED 00048 00049 #define GET_RED(rgba) (( (rgba)>>16 ) & 0xff ) 00050 #endif 00051 00052 #ifndef GET_GREEN 00053 00054 #define GET_GREEN(rgba) (( (rgba)>>8 ) & 0xff ) 00055 #endif 00056 00057 #ifndef GET_BLUE 00058 00059 #define GET_BLUE(rgba) (( (rgba)>>0 ) & 0xff ) 00060 #endif 00061 00062 #ifndef GET_ALPHA 00063 00064 #define GET_ALPHA(rgba) (( (rgba)>>24 ) & 0xff) 00065 #endif 00066 00067 #endif