Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/FreeImage/PluginPCD.cpp view on Meta::CPAN
// read the data
for (unsigned y = 0; y < height / 2; y++) {
io->read_proc(y1, width, 1, handle);
io->read_proc(y2, width, 1, handle);
io->read_proc(cbcr, width, 1, handle);
for (int i = 0; i < 2; i++) {
BYTE *bits = FreeImage_GetScanLine(dib, start_scan_line);
for (unsigned x = 0; x < width; x++) {
int r, g, b;
YUV2RGB(yl[i][x], cbcr[x / 2], cbcr[(width / 2) + (x / 2)], r, g, b);
bits[FI_RGBA_BLUE] = (BYTE)b;
bits[FI_RGBA_GREEN] = (BYTE)g;
bits[FI_RGBA_RED] = (BYTE)r;
bits += 3;
}
start_scan_line += scan_line_add;
}
}
free(cbcr);
free(y2);
free(y1);
return dib;
} catch(const char *text) {
if(dib) FreeImage_Unload(dib);
if(cbcr) free(cbcr);
if(y2) free(y2);
if(y1) free(y1);
FreeImage_OutputMessageProc(s_format_id, text);
return NULL;
}
}
// ==========================================================
// Init
// ==========================================================
void DLL_CALLCONV
InitPCD(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 = NULL;
plugin->mime_proc = MimeType;
plugin->supports_export_bpp_proc = SupportsExportDepth;
plugin->supports_export_type_proc = SupportsExportType;
plugin->supports_icc_profiles_proc = NULL;
plugin->supports_no_pixels_proc = SupportsNoPixels;
}
( run in 1.028 second using v1.01-cache-2.11-cpan-d7f47b0818f )