Re: Minutes: Foreign OSes BoF
- From: "Tor Lillqvist" <tml iki fi>
- To: "Dominic Lachowicz" <domlachowicz gmail com>
- Cc: GTK Devel List <gtk-devel-list gnome org>
- Subject: Re: Minutes: Foreign OSes BoF
- Date: Tue, 18 Mar 2008 03:41:44 +0200
> Hmm, there are the ImageCodecFlagsSupportBitmap and
> ImageCodecFlagsSupportVector bits in the ImageCodecInfo::Flags field,
> is that enough?
Apparently not. Running the attached test program (from the Plaform
SDK docs, with some additions) prints for me on XP:
Decoders:
image/bmp: *.BMP;*.DIB;*.RLE: Built-in BMP Codec
BMP
Encoder Decoder SupportBitmap Builtin
image/jpeg: *.JPG;*.JPEG;*.JPE;*.JFIF: Built-in JPEG Codec
JPEG
Encoder Decoder SupportBitmap Builtin
image/gif: *.GIF: Built-in GIF Codec
GIF
Encoder Decoder SupportBitmap Builtin
image/x-emf: *.EMF: Built-in EMF Codec
EMF
Decoder SupportBitmap Builtin
image/x-wmf: *.WMF: Built-in WMF Codec
WMF
Decoder SupportBitmap Builtin
image/tiff: *.TIF;*.TIFF: Built-in TIFF Codec
TIFF
Encoder Decoder SupportBitmap Builtin
image/png: *.PNG: Built-in PNG Codec
PNG
Encoder Decoder SupportBitmap Builtin
image/x-icon: *.ICO: Built-in ICO Codec
ICO
Decoder SupportBitmap Builtin
Encoders:
image/bmp
image/jpeg
image/gif
image/tiff
image/png
Note that for EMF and WMF it just says "SupportBitmap" like for the
true bitmap formats. Sigh.
--tml
#include <windows.h>
#include <GdiPlus.h>
#include <stdio.h>
using namespace Gdiplus;
int
main (int argc, char **argv)
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
UINT num; // number of image decoders
UINT size; // size, in bytes, of the image decoder array
ImageCodecInfo* pImageCodecInfo;
// How many decoders are there?
// How big (in bytes) is the array of all ImageCodecInfo objects?
GetImageDecodersSize(&num, &size);
// Create a buffer large enough to hold the array of ImageCodecInfo
// objects that will be returned by GetImageDecoders.
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
// GetImageDecoders creates an array of ImageCodecInfo objects
// and copies that array into a previously allocated buffer.
// The third argument, imageCodecInfos, is a pointer to that buffer.
GetImageDecoders(num, size, pImageCodecInfo);
// Display the graphics file format (MimeType)
// for each ImageCodecInfo object.
printf("Decoders:\n");
for(UINT j = 0; j < num; ++j)
{
printf (" %S: %S: %S\n"
" %S\n",
pImageCodecInfo[j].MimeType,
pImageCodecInfo[j].FilenameExtension,
pImageCodecInfo[j].CodecName,
pImageCodecInfo[j].FormatDescription);
printf (" ");
#define BIT(x) if (pImageCodecInfo[j].Flags & ImageCodecFlags ## x) printf (" %s", #x)
BIT (Encoder);
BIT (Decoder);
BIT (SupportBitmap);
BIT (SupportVector);
BIT (SeekableEncode);
BIT (BlockingDecode);
BIT (Builtin);
BIT (System);
BIT (User);
#undef BIT
printf ("\n");
}
// Ditto for encoders
GetImageEncodersSize(&num, &size);
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
GetImageEncoders(num, size, pImageCodecInfo);
printf("Encoders:\n");
for(UINT j = 0; j < num; ++j)
{
printf(" %S\n", pImageCodecInfo[j].MimeType);
}
free(pImageCodecInfo);
GdiplusShutdown(gdiplusToken);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]