#include "basetype.h"#include "bitmap.h"Go to the source code of this file.
Typedefs | |
| typedef geBitmap_Palette *(* | paletteCreater )(const geBitmap_Info *Info, const void *Bits) |
Functions | |
| geBitmap_Palette * | createPaletteGood (const geBitmap_Info *Info, const void *Bits) |
| geBitmap_Palette * | createPaletteFast (const geBitmap_Info *Info, const void *Bits) |
| void | setCreatePaletteFunc (paletteCreater func) |
| geBitmap_Palette * | createPalette (const geBitmap_Info *Info, const void *Bits) |
| geBitmap_Palette * | createPaletteFromBitmap (const geBitmap *Bitmap, geBoolean Optimize) |
| void | PalCreate_Start (void) |
| void | PalCreate_Stop (void) |
|
|
Definition at line 36 of file palcreate.h. |
|
||||||||||||
|
Definition at line 112 of file palcreate.c. References geBitmap_Info::Format, GE_PIXELFORMAT_8BIT_GRAY, GE_PIXELFORMAT_8BIT_PAL, geBitmap_Palette_Create(), geBitmap_Palette_SetData(), myPaletteCreater, NULL, geBitmap_Info::Palette, and uint8. Referenced by createPaletteFromBitmap(), and geBitmap_BlitData_Sub().
00113 {
00114 assert(Info && Bits);
00115 switch(Info->Format)
00116 {
00117 case GE_PIXELFORMAT_8BIT_PAL :
00118 return Info->Palette;
00119 case GE_PIXELFORMAT_8BIT_GRAY :
00120 {
00121 geBitmap_Palette * Pal;
00122 uint8 GrayPal[256];
00123 int i;
00124 Pal = geBitmap_Palette_Create(GE_PIXELFORMAT_8BIT_GRAY,256);
00125 if ( ! Pal ) return NULL;
00126 for(i=0;i<256;i++) GrayPal[i] = i;
00127 geBitmap_Palette_SetData(Pal,GrayPal,GE_PIXELFORMAT_8BIT_GRAY,256);
00128 return Pal;
00129 }
00130 default:
00131 return myPaletteCreater(Info,Bits);
00132 }
00133 }
|
|
||||||||||||
|
|
|
||||||||||||
|
Definition at line 135 of file palcreate.c. References createPalette(), GE_FALSE, GE_PIXELFORMAT_24BIT_RGB, geBitmap_GetBits(), geBitmap_GetInfo(), geBitmap_LockForRead(), geBitmap_Palette_GetData(), geBitmap_Palette_SetData(), geBitmap_UnLock(), NULL, paletteOptimize(), and uint8. Referenced by geBitmap_Palette_CreateFromBitmap().
00136 {
00137 geBitmap * Lock;
00138 geBitmap_Info Info;
00139 const void * Bits;
00140 geBitmap_Palette * Pal;
00141
00142 if ( ! geBitmap_GetInfo(Bitmap,&Info,NULL) )
00143 return NULL;
00144
00145 if ( ! geBitmap_LockForRead((geBitmap *)Bitmap,&Lock,0,0,GE_PIXELFORMAT_24BIT_RGB,GE_FALSE,0) )
00146 return NULL;
00147
00148 if ( ! geBitmap_GetInfo(Lock,&Info,NULL) )
00149 return NULL;
00150
00151 Bits = (const void *) geBitmap_GetBits(Lock);
00152
00153 Pal = createPalette(&Info,Bits);
00154
00155 if ( Pal && Optimize )
00156 {
00157 uint8 paldata[768];
00158
00159 if ( ! geBitmap_Palette_GetData(Pal,paldata,GE_PIXELFORMAT_24BIT_RGB,256) )
00160 assert(0);
00161
00162 paletteOptimize(&Info,Bits,paldata,256,0);
00163
00164 if ( ! geBitmap_Palette_SetData(Pal,paldata,GE_PIXELFORMAT_24BIT_RGB,256) )
00165 assert(0);
00166 }
00167
00168 geBitmap_UnLock(Lock);
00169
00170 return Pal;
00171 }
|
|
||||||||||||
|
|
|
|
Definition at line 212 of file palcreate.c. References MemPool_Create(), octNode, octNodePool, and PoolRefs. Referenced by geBitmap_Start().
00213 {
00214 if ( PoolRefs == 0 )
00215 {
00216 int num;
00217 // we do addOctNode, one for each unique color
00218 // make the poolhunks 64k
00219 num = (1<<16) / sizeof(octNode);
00220 octNodePool = MemPool_Create(sizeof(octNode),num,num);
00221 assert(octNodePool);
00222 }
00223 PoolRefs ++;
00224 }
|
|
|
Definition at line 226 of file palcreate.c. References MemPool_Destroy(), octNodePool, and PoolRefs. Referenced by geBitmap_Stop().
00227 {
00228 PoolRefs --;
00229 if ( PoolRefs == 0 )
00230 {
00231 MemPool_Destroy(&octNodePool);
00232 }
00233 }
|
|
|
Definition at line 106 of file palcreate.c. References createPaletteFast(), createPaletteGood(), and myPaletteCreater.
00107 {
00108 assert( func == createPaletteGood || func == createPaletteFast );
00109 myPaletteCreater = func;
00110 }
|
1.3.2