Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/FreeImage/PluginPNM.cpp view on Meta::CPAN
else if(image_type == FIT_RGB16) { // 48-bit RGB
if (flags == PNM_SAVE_RAW) {
for (y = 0; y < height; y++) {
// write the scanline to disc
FIRGB16 *bits = (FIRGB16*)FreeImage_GetScanLine(dib, height - 1 - y);
for (x = 0; x < width; x++) {
WriteWord(io, handle, bits[x].red); // R
WriteWord(io, handle, bits[x].green); // G
WriteWord(io, handle, bits[x].blue); // B
}
}
} else {
int length = 0;
for (y = 0; y < height; y++) {
// write the scanline to disc
FIRGB16 *bits = (FIRGB16*)FreeImage_GetScanLine(dib, height - 1 - y);
for (x = 0; x < width; x++) {
sprintf(buffer, "%5d %5d %5d ", bits[x].red, bits[x].green, bits[x].blue);
io->write_proc(&buffer, (unsigned int)strlen(buffer), 1, handle);
length += 18;
if(length > 52) {
// No line should be longer than 70 characters
sprintf(buffer, "\n");
io->write_proc(&buffer, (unsigned int)strlen(buffer), 1, handle);
length = 0;
}
}
}
}
}
return TRUE;
}
// ==========================================================
// Init
// ==========================================================
void DLL_CALLCONV
InitPNM(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 = Save;
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;
plugin->supports_no_pixels_proc = SupportsNoPixels;
}
( run in 2.297 seconds using v1.01-cache-2.11-cpan-d7f47b0818f )