void fnCopyLine(void* dst, void* src, int count, int pixelFormat, int transparentColor) { int x; u8 *p_dest1 = (u8*)dst; u16 *p_dest2 = (u16*)dst; u32 *p_dest4 = (u32*)dst; u8 *p_src = (u8*)src; u32 pixel_value; for (x=0;x<count;x++) { //Next pixel palette entry pixel_value = p_src[x]; //True color mode => convert the temporary color to destination format if (osl_pixelWidth[pixelFormat] > 8) pixel_value = oslConvertColor(pixelFormat, OSL_PF_8888, osl_gifTempPalette[pixel_value]); if (osl_pixelWidth[pixelFormat] == 32) { p_dest4[x] = pixel_value; } else if (osl_pixelWidth[pixelFormat] == 16) p_dest2[x] = pixel_value; else if (osl_pixelWidth[pixelFormat] == 8) p_dest1[x] = pixel_value; else if (osl_pixelWidth[pixelFormat] == 4) { p_dest1[x >> 1] &= ~(15 << ((x & 1) << 2)); p_dest1[x >> 1] |= (pixel_value & 15) << ((x & 1) << 2); } }
void Buffer::setPixel(int x, int y, OSL_COLOR col) { oslSetImagePixel(img, x, y, oslConvertColor(img->pixelFormat, OSL_PF_8888, col)); }
OSL_COLOR Buffer::getPixel(int x, int y) { return oslConvertColor(OSL_PF_8888, img->pixelFormat, oslGetImagePixel(img, x, y)); }