Alien-FreeImage
view release on metacpan or search on metacpan
src/Source/FreeImage/PluginPCX.cpp view on Meta::CPAN
static const char * DLL_CALLCONV
Format() {
return "PCX";
}
/*!
Returns a description string for the plugin. Though a
description is not necessary per-se,
it is advised to return an unique string in order to tell the
user what type of bitmaps this plugin will read and/or write.
*/
static const char * DLL_CALLCONV
Description() {
return "Zsoft Paintbrush";
}
/*!
Returns a comma separated list of file
extensions indicating what files this plugin can open. The
list, being used by FreeImage_GetFIFFromFilename, is usually
used as a last resort in finding the type of the bitmap we
are dealing with. Best is to check the first few bytes on
the low-level bits level first and compare them with a known
signature . If this fails, FreeImage_GetFIFFromFilename can be
used.
*/
static const char * DLL_CALLCONV
Extension() {
return "pcx";
}
/*!
Returns an (optional) regular expression to help
software identifying a bitmap type. The
expression can be applied to the first few bytes (header) of
the bitmap. FreeImage is not capable of processing regular expression itself,
but FreeImageQt, the FreeImage Trolltech support library, can. If RegExpr
returns NULL, FreeImageQt will automatically bypass Trolltech's regular
expression support and use its internal functions to find the bitmap type.
*/
static const char * DLL_CALLCONV
RegExpr() {
return NULL;
}
static const char * DLL_CALLCONV
MimeType() {
return "image/x-pcx";
}
/*!
Validates a bitmap by reading the first few bytes
and comparing them with a known bitmap signature.
TRUE is returned if the bytes match the signature, FALSE otherwise.
The Validate function is used by using FreeImage_GetFileType.
Note: a plugin can safely read data any data from the bitmap without seeking back
to the original entry point; the entry point is stored prior to calling this
function and restored after.
Note: because of FreeImage's io redirection support, the header for the bitmap
must be on the start of the bitmap or at least on a known part in the bitmap. It is
forbidden to seek to the end of the bitmap or to a point relative to the end of a bitmap,
because the end of the bitmap is not always known.
*/
static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
return pcx_validate(io, handle);
}
/*!
This function is used to 'ask' the plugin if it can write
a bitmap in a certain bitdepth. Different bitmap types have different
capabilities, for example not all formats allow writing in palettized mode.
This function is there provide an uniform interface to the plugin's
capabilities. SupportsExportDepth returns TRUE if the plugin support writing
in the asked bitdepth, or FALSE if it doesn't. The function also
returns FALSE if bitmap saving is not supported by the plugin at all.
*/
static BOOL DLL_CALLCONV
SupportsExportDepth(int depth) {
return FALSE;
}
static BOOL DLL_CALLCONV
SupportsExportType(FREE_IMAGE_TYPE type) {
return FALSE;
}
static BOOL DLL_CALLCONV
SupportsNoPixels() {
return TRUE;
}
// ----------------------------------------------------------
/*!
Loads a bitmap into memory. On entry it is assumed that
the bitmap to be loaded is of the correct type. If the bitmap
is of an incorrect type, the plugin might not gracefully fail but
crash or enter an endless loop. It is also assumed that all
the bitmap data is available at one time. If the bitmap is not complete,
for example because it is being downloaded while loaded, the plugin
might also not gracefully fail.
The Load function has the following parameters:
The first parameter (FreeImageIO *io) is a structure providing
function pointers in order to make use of FreeImage's IO redirection. Using
FreeImage's file i/o functions instead of standard ones it is garantueed
that all bitmap types, both current and future ones, can be loaded from
memory, file cabinets, the internet and more. The second parameter (fi_handle handle)
is a companion of FreeImageIO and can be best compared with the standard FILE* type,
in a generalized form.
The third parameter (int page) indicates wether we will be loading a certain page
( run in 0.509 second using v1.01-cache-2.11-cpan-5623c5533a1 )