32 #ifndef ImageTools_INCLUDE_ONCE 33 #define ImageTools_INCLUDE_ONCE 43 inline void convertRGBToRGBA(
void* buf,
int w,
int h,
unsigned char alpha,
int bytealign = 1)
46 int pitch = (xbytes / bytealign * bytealign) + ((xbytes % bytealign)? bytealign : 0);
52 unsigned char *pxl1 = (
unsigned char *)buf;
53 unsigned char *pxl2 = (
unsigned char *)buf;
55 for(
int i=0; i<pitch*h; ++i, count++)
69 unsigned char * px32 = (
unsigned char*)buf + w * h * 4 - 4;
70 unsigned char * px24 = (
unsigned char*)buf + w * h * 3 - 3;
71 for(
int i=0; i<w * h; ++i)
84 unsigned char* px32 = (
unsigned char*)buf + size * 4 - 4;
85 unsigned char* px8 = (
unsigned char*)buf + size * 1 - 1;
86 for(
int i=0; i<size; ++i)
99 unsigned char* px32 = (
unsigned char*)buf + size * 4 - 4;
100 unsigned char* px8 = (
unsigned char*)buf + size * 2 - 2;
101 for(
int i=0; i<size; ++i)
103 unsigned char r = (px8[1] << 1) & ~0x03;
104 unsigned char g = ((px8[1] << 6) | (px8[0] >> 2)) & ~0x03;
105 unsigned char b = (px8[0] << 3) & ~0x03;
117 inline void convert8ToRGBA(
const TPalette3x256 & palette,
void* buf,
int w,
int h,
unsigned char alpha,
int bytealign = 1)
121 int pitch = (xbytes / bytealign * bytealign) + ((xbytes % bytealign)? bytealign : 0);
127 unsigned char *pxl1 = (
unsigned char *)buf;
128 unsigned char *pxl2 = (
unsigned char *)buf;
130 for(
int i=0; i<pitch*h; ++i, count++)
144 unsigned char* px32 = (
unsigned char*)buf + w * h * 4 - 4;
145 unsigned char* px8 = (
unsigned char*)buf + w * h * 1 - 1;
146 for(
int i=0; i<w * h; ++i)
148 px32[0] = palette[*px8*3+0];
149 px32[1] = palette[*px8*3+1];
150 px32[2] = palette[*px8*3+2];
157 inline void convert8ToRGBA(
const TPalette4x256 & palette,
void* buf,
int w,
int h,
int bytealign = 1)
161 int pitch = (xbytes / bytealign * bytealign) + ((xbytes % bytealign)? bytealign : 0);
167 unsigned char *pxl1 = (
unsigned char *)buf;
168 unsigned char *pxl2 = (
unsigned char *)buf;
170 for(
int i=0; i<pitch*h; ++i, count++)
184 unsigned char * px32 = (
unsigned char*)buf + w * h * 4 - 4;
185 unsigned char * px8 = (
unsigned char*)buf + w * h * 1 - 1;
186 for(
int i=0; i<w * h; ++i)
188 px32[0] = palette[*px8*4+0];
189 px32[1] = palette[*px8*4+1];
190 px32[2] = palette[*px8*4+2];
191 px32[3] = palette[*px8*4+3];
199 unsigned char* p = (
unsigned char*)buf;
201 for(
int i=0; i<size; i+=4, p+=4)
213 unsigned char* p = (
unsigned char*)buf;
215 for(
int i=0; i<bytecount; i+=4, p+=4)
225 unsigned char* p = (
unsigned char*)buf;
227 int pxl = bytecount / 3;
228 for(
int i=0; i<pxl; ++i, p+=3)
238 unsigned char* pxl = (
unsigned char*)buf;
239 for(
int i=0; i<bytecount; i+=4)
247 unsigned char* pxl = (
unsigned char*)buf;
248 for(
int i=0; i<bytecount; i+=2)
void swapBytes32(void *buf, int size)
void convert8ToRGBA(const TPalette3x256 &palette, void *buf, int w, int h, unsigned char alpha, int bytealign=1)
void swapBytes32_BGRA_RGBA(void *buf, int bytecount)
void fillRGBA32_Alpha(void *buf, int bytecount, unsigned char alpha)
void convertA1R5G5B5ToRGBA(void *buf, int size, unsigned char alpha)
Visualization Library main namespace.
void fillGray8Alpha8_Alpha(void *buf, int bytecount, unsigned char alpha)
void convertRGBToRGBA(void *buf, int w, int h, unsigned char alpha, int bytealign=1)
void convertGrayscaleToRGBA(void *buf, int size, unsigned char alpha)
unsigned char TPalette3x256[256 *3]
void swapBytes24_BGR_RGB(void *buf, int bytecount)
unsigned char TPalette4x256[256 *4]