Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/FreeImage/PluginKOALA.cpp view on Meta::CPAN
int pixel, index, colourindex;
unsigned char found_color = 0;
for (int y = 0; y < 200; y++) {
for (int x = 0; x < 160; x++) {
// Get value of pixel at (x,y)
index = (x / 4) * 8 + (y % 8) + (y / 8) * CBM_WIDTH;
colourindex = (x / 4) + (y / 8) * 40;
pixel = (image.image[index] & pixel_mask[x % 4]) >> pixel_displacement[x % 4];
// Retrieve RGB values
switch (pixel) {
case 0: // Background
found_color = image.background;
break;
case 1: // Colour 1
found_color = image.colour1[colourindex] >> 4;
break;
case 2: // Colour 2
found_color = image.colour1[colourindex] & 0xf;
break;
case 3: // Colour 3
found_color = image.colour2[colourindex] & 0xf;
break;
};
*(FreeImage_GetScanLine(dib, CBM_HEIGHT - y - 1) + x) = (found_color << 4) | found_color;
}
}
return dib;
}
}
return NULL;
}
// ==========================================================
// Init
// ==========================================================
void DLL_CALLCONV
InitKOALA(Plugin *plugin, int format_id) {
s_format_id = format_id;
plugin->format_proc = Format;
plugin->description_proc = Description;
plugin->extension_proc = Extension;
plugin->regexpr_proc = RegExpr;
plugin->open_proc = NULL;
plugin->close_proc = NULL;
plugin->pagecount_proc = NULL;
plugin->pagecapability_proc = NULL;
plugin->load_proc = Load;
plugin->save_proc = NULL;
plugin->validate_proc = Validate;
plugin->mime_proc = MimeType;
plugin->supports_export_bpp_proc = SupportsExportDepth;
plugin->supports_export_type_proc = SupportsExportType;
plugin->supports_icc_profiles_proc = NULL;
}
( run in 2.305 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )