Example #1
0
void	Surface_FormatExt(FREE_IMAGE_FORMAT f)
{
	LPCSTR n=FreeImage_GetFIFExtensionList(f);
    if (n){
        LPSTR base = xr_strdup(n);
        LPSTR ext = base;
        LPSTR cur = ext;
        for	(; ext[0]; ext++){
        if (ext[0]==','){
                ext[0] = 0;
                formats.format_register(cur);
                cur = ++ext;
            }
        }
        if (cur&&cur[0]) formats.format_register(cur);
        xr_free(base);
    }
}
Example #2
0
/**
	Print plugins import capabilities
*/
void PrintImportFormats(iostream& ios) {
	int count = FreeImage_GetFIFCount();
	if(count)
		ios << "FORMAT;DESCRIPTION;EXTENSIONS;ICC PROFILES\n";
	for(int i = 0; i < count; i++) {
		FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i;

		if(FreeImage_FIFSupportsReading(fif)) {
			const char * format = FreeImage_GetFormatFromFIF(fif);
			const char * description = FreeImage_GetFIFDescription(fif);
			const char * ext = FreeImage_GetFIFExtensionList(fif);
			const char * icc = "*";
			if(FreeImage_FIFSupportsICCProfiles(fif)) {
				ios << format << ";" << description << ";" << ext << ";" << icc << "\n";
			} else {
				ios << format << ";" << description << ";" << ext << "; \n";
			}
		}
	}
}
Example #3
0
FreeImageImageCodec::FreeImageImageCodec()
    : ImageCodec("FreeImageCodec - FreeImage based image codec")
{
    FreeImage_Initialise(true);
    FreeImage_SetOutputMessage(&FreeImageErrorHandler);

    // Getting extensions
    for (int i = 0; i < FreeImage_GetFIFCount(); ++i)
    {
        String exts(FreeImage_GetFIFExtensionList((FREE_IMAGE_FORMAT)i));

        // Replace commas with spaces
        for (size_t i = 0; i < exts.length(); ++i)
            if (exts[i] == ',')
                exts[i] = ' ';

        // Add space after existing extensions
        if (!d_supportedFormat.empty())
            d_supportedFormat += ' ';

        d_supportedFormat += exts;
    }
}