Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/FreeImage/PluginPCX.cpp view on Meta::CPAN
bits[x * 3 + FI_RGBA_RED] = pline[x];
}
pline += header.bytes_per_line;
for (x = 0; x < width; x++) {
bits[x * 3 + FI_RGBA_GREEN] = pline[x];
}
pline += header.bytes_per_line;
for (x = 0; x < width; x++) {
bits[x * 3 + FI_RGBA_BLUE] = pline[x];
}
pline += header.bytes_per_line;
bits -= pitch;
}
} else {
throw FI_MSG_ERROR_UNSUPPORTED_FORMAT;
}
free(line);
free(ReadBuf);
return dib;
} catch (const char *text) {
// free allocated memory
if (dib != NULL) {
FreeImage_Unload(dib);
}
if (line != NULL) {
free(line);
}
if (ReadBuf != NULL) {
free(ReadBuf);
}
FreeImage_OutputMessageProc(s_format_id, text);
}
return NULL;
}
// ==========================================================
// Init
// ==========================================================
/*!
Initialises the plugin. The first parameter (Plugin *plugin)
contains a pointer to a pre-allocated Plugin structure
wherein pointers to the available plugin functions
has to be stored. The second parameter (int format_id) is an identification
number that the plugin may use to show plugin specific warning messages
or other information to the user. The plugin number
is generated by FreeImage and can differ everytime the plugin is
initialised.
If you want to create your own plugin you have to take some
rules into account. Plugin functions have to be compiled
__stdcall using the multithreaded c runtime libraries. Throwing
exceptions in plugin functions is allowed, as long as those exceptions
are being caught inside the same plugin. It is forbidden for a plugin
function to directly call FreeImage functions or to allocate memory
and pass it to the main DLL. Exception to this rule is the special file data
block that may be allocated the Open function. Allocating a FIBITMAP inside a
plugin can be using the function allocate_proc in the FreeImage structure,
which will allocate the memory using the DLL's c runtime library.
*/
void DLL_CALLCONV
InitPCX(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;
plugin->supports_no_pixels_proc = SupportsNoPixels;
}
( run in 1.179 second using v1.01-cache-2.11-cpan-5a3173703d6 )