00001 // Filename : OBITMAP.CPP 00002 00003 #include <OBITMAP.H> 00004 #include <ALL.H> 00005 00006 // ------ begin of function Bitmap::init ------// 00007 00008 void Bitmap::init(short w, short h) { 00009 width_field = w; 00010 height_field = h; 00011 } 00012 00013 // ------ end of function Bitmap::init ------// 00014 00015 // ------ begin of function Bitmap::get_pitch ------// 00016 00017 short Bitmap::get_pitch() { 00018 return width_field; 00019 } 00020 00021 // ------ end of function Bitmap::get_pitch ------// 00022 00023 // ------ begin of function Bitmap::get_true_pitch ------// 00024 00025 short Bitmap::get_true_pitch() { 00026 return width_field; 00027 } 00028 00029 // ------ end of function Bitmap::get_true_pitch ------// 00030 00031 // ------ begin of function Bitmap::get_ptr -------// 00032 unsigned char *Bitmap::get_ptr(short x, short y) { 00033 return bitmap + y * width_field + x; 00034 } 00035 00036 // ------ end of function Bitmap::get_ptr -------// 00037 00038 // ------ begin of function Bitmap::size ------// 00039 00040 long Bitmap::size() { 00041 return sizeof(width_field)+sizeof(height_field)+ width_field*height_field*sizeof(*bitmap); 00042 } 00043 00044 // ------ end of function Bitmap::size ------// 00045 00046 // ------ begin of function Bitmap::size ------// 00047 00048 long Bitmap::size(short w, short h) { 00049 return sizeof(short)+sizeof(short)+ w*h; 00050 } 00051 00052 // ------ end of function Bitmap::size ------// 00053 00054 // ------ begin of function Bitmap::mem_add_bitmap ------// 00055 00056 Bitmap *Bitmap::mem_add_bitmap(short w, short h) { 00057 Bitmap *bitmap = (Bitmap *)mem_add(size(w,h)); 00058 bitmap->init(w,h); 00059 return bitmap; 00060 } 00061 00062 // ------ end of function Bitmap::mem_add_bitmap ------//