home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 May / CMCD0504.ISO / Software / Freeware / Programare / gdiplusdelphi / pas / GDIPUTIL.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2002-02-15  |  25.0 KB  |  379 lines

  1.       {******************************************************************}
  2.       { GDI+ Util                                                         }
  3.       {                                                                  }
  4.       { home page : http://www.progdigy.com                              }
  5.       { email     : hgourvest@progdigy.com                               }
  6.       {                                                                  }
  7.       { date      : 15-02-2002                                           }
  8.       {                                                                  }
  9.       { The contents of this file are used with permission, subject to   }
  10.       { the Mozilla Public License Version 1.1 (the "License"); you may  }
  11.       { not use this file except in compliance with the License. You may }
  12.       { obtain a copy of the License at                                  }
  13.       { http://www.mozilla.org/MPL/MPL-1.1.html                          }
  14.       {                                                                  }
  15.       { Software distributed under the License is distributed on an      }
  16.       { "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or   }
  17.       { implied. See the License for the specific language governing     }
  18.       { rights and limitations under the License.                        }
  19.       {                                                                  }
  20.       { *****************************************************************}
  21.  
  22. unit GDIPUTIL;
  23.  
  24. interface
  25. uses
  26.   Windows,
  27.   GDIPAPI,
  28.   GDIPOBJ;
  29.  
  30. function ValueTypeFromULONG(Type_: ULONG): String;
  31. function GetMetaDataIDString(id: ULONG): string;
  32. function GetEncoderClsid(format: String; out pClsid: TGUID): integer;
  33. function GetStatus(Stat: TStatus): string;
  34. function PixelFormatString(PixelFormat: TPixelFormat): string;
  35.  
  36. {from WinNT.h}
  37. // creates a language identifier from a primary language identifier and a
  38. // sublanguage identifier for the TStringFormat & TFontFamily class.
  39. function MakeLangID(PrimaryLanguage, SubLanguage: LANGID): WORD;
  40.  
  41. implementation
  42.  
  43. function ValueTypeFromULONG(Type_: ULONG): String;
  44. begin
  45.   case Type_ of
  46.     0 : result := 'Nothing';
  47.     1 : result := 'PropertyTagTypeByte';
  48.     2 : result := 'PropertyTagTypeASCII';
  49.     3 : result := 'PropertyTagTypeShort';
  50.     4 : result := 'PropertyTagTypeLong';
  51.     5 : result := 'PropertyTagTypeRational';
  52.     6 : result := 'Nothing';
  53.     7 : result := 'PropertyTagTypeUndefined';
  54.     8 : result := 'Nothing';
  55.     9 : result := 'PropertyTagTypeSLONG';
  56.     10: result := 'PropertyTagTypeSRational';
  57.   else
  58.     result := '<UnKnown>';
  59.   end;
  60. end;
  61.  
  62. function GetMetaDataIDString(id: ULONG): string;
  63. begin
  64.   case id of
  65.     PropertyTagExifIFD                        : result := 'PropertyTagExifIFD';
  66.     PropertyTagGpsIFD                         : result := 'PropertyTagGpsIFD';
  67.     PropertyTagNewSubfileType                 : result := 'PropertyTagNewSubfileType';
  68.     PropertyTagSubfileType                    : result := 'PropertyTagSubfileType';
  69.     PropertyTagImageWidth                     : result := 'PropertyTagImageWidth';
  70.     PropertyTagImageHeight                    : result := 'PropertyTagImageHeight';
  71.     PropertyTagBitsPerSample                  : result := 'PropertyTagBitsPerSample';
  72.     PropertyTagCompression                    : result := 'PropertyTagCompression';
  73.     PropertyTagPhotometricInterp              : result := 'PropertyTagPhotometricInterp';
  74.     PropertyTagThreshHolding                  : result := 'PropertyTagThreshHolding';
  75.     PropertyTagCellWidth                      : result := 'PropertyTagCellWidth';
  76.     PropertyTagCellHeight                     : result := 'PropertyTagCellHeight';
  77.     PropertyTagFillOrder                      : result := 'PropertyTagFillOrder';
  78.     PropertyTagDocumentName                   : result := 'PropertyTagDocumentName';
  79.     PropertyTagImageDescription               : result := 'PropertyTagImageDescription';
  80.     PropertyTagEquipMake                      : result := 'PropertyTagEquipMake';
  81.     PropertyTagEquipModel                     : result := 'PropertyTagEquipModel';
  82.     PropertyTagStripOffsets                   : result := 'PropertyTagStripOffsets';
  83.     PropertyTagOrientation                    : result := 'PropertyTagOrientation';
  84.     PropertyTagSamplesPerPixel                : result := 'PropertyTagSamplesPerPixel';
  85.     PropertyTagRowsPerStrip                   : result := 'PropertyTagRowsPerStrip';
  86.     PropertyTagStripBytesCount                : result := 'PropertyTagStripBytesCount';
  87.     PropertyTagMinSampleValue                 : result := 'PropertyTagMinSampleValue';
  88.     PropertyTagMaxSampleValue                 : result := 'PropertyTagMaxSampleValue';
  89.     PropertyTagXResolution                    : result := 'PropertyTagXResolution';
  90.     PropertyTagYResolution                    : result := 'PropertyTagYResolution';
  91.     PropertyTagPlanarConfig                   : result := 'PropertyTagPlanarConfig';
  92.     PropertyTagPageName                       : result := 'PropertyTagPageName';
  93.     PropertyTagXPosition                      : result := 'PropertyTagXPosition';
  94.     PropertyTagYPosition                      : result := 'PropertyTagYPosition';
  95.     PropertyTagFreeOffset                     : result := 'PropertyTagFreeOffset';
  96.     PropertyTagFreeByteCounts                 : result := 'PropertyTagFreeByteCounts';
  97.     PropertyTagGrayResponseUnit               : result := 'PropertyTagGrayResponseUnit';
  98.     PropertyTagGrayResponseCurve              : result := 'PropertyTagGrayResponseCurve';
  99.     PropertyTagT4Option                       : result := 'PropertyTagT4Option';
  100.     PropertyTagT6Option                       : result := 'PropertyTagT6Option';
  101.     PropertyTagResolutionUnit                 : result := 'PropertyTagResolutionUnit';
  102.     PropertyTagPageNumber                     : result := 'PropertyTagPageNumber';
  103.     PropertyTagTransferFuncition              : result := 'PropertyTagTransferFuncition';
  104.     PropertyTagSoftwareUsed                   : result := 'PropertyTagSoftwareUsed';
  105.     PropertyTagDateTime                       : result := 'PropertyTagDateTime';
  106.     PropertyTagArtist                         : result := 'PropertyTagArtist';
  107.     PropertyTagHostComputer                   : result := 'PropertyTagHostComputer';
  108.     PropertyTagPredictor                      : result := 'PropertyTagPredictor';
  109.     PropertyTagWhitePoint                     : result := 'PropertyTagWhitePoint';
  110.     PropertyTagPrimaryChromaticities          : result := 'PropertyTagPrimaryChromaticities';
  111.     PropertyTagColorMap                       : result := 'PropertyTagColorMap';
  112.     PropertyTagHalftoneHints                  : result := 'PropertyTagHalftoneHints';
  113.     PropertyTagTileWidth                      : result := 'PropertyTagTileWidth';
  114.     PropertyTagTileLength                     : result := 'PropertyTagTileLength';
  115.     PropertyTagTileOffset                     : result := 'PropertyTagTileOffset';
  116.     PropertyTagTileByteCounts                 : result := 'PropertyTagTileByteCounts';
  117.     PropertyTagInkSet                         : result := 'PropertyTagInkSet';
  118.     PropertyTagInkNames                       : result := 'PropertyTagInkNames';
  119.     PropertyTagNumberOfInks                   : result := 'PropertyTagNumberOfInks';
  120.     PropertyTagDotRange                       : result := 'PropertyTagDotRange';
  121.     PropertyTagTargetPrinter                  : result := 'PropertyTagTargetPrinter';
  122.     PropertyTagExtraSamples                   : result := 'PropertyTagExtraSamples';
  123.     PropertyTagSampleFormat                   : result := 'PropertyTagSampleFormat';
  124.     PropertyTagSMinSampleValue                : result := 'PropertyTagSMinSampleValue';
  125.     PropertyTagSMaxSampleValue                : result := 'PropertyTagSMaxSampleValue';
  126.     PropertyTagTransferRange                  : result := 'PropertyTagTransferRange';
  127.     PropertyTagJPEGProc                       : result := 'PropertyTagJPEGProc';
  128.     PropertyTagJPEGInterFormat                : result := 'PropertyTagJPEGInterFormat';
  129.     PropertyTagJPEGInterLength                : result := 'PropertyTagJPEGInterLength';
  130.     PropertyTagJPEGRestartInterval            : result := 'PropertyTagJPEGRestartInterval';
  131.     PropertyTagJPEGLosslessPredictors         : result := 'PropertyTagJPEGLosslessPredictors';
  132.     PropertyTagJPEGPointTransforms            : result := 'PropertyTagJPEGPointTransforms';
  133.     PropertyTagJPEGQTables                    : result := 'PropertyTagJPEGQTables';
  134.     PropertyTagJPEGDCTables                   : result := 'PropertyTagJPEGDCTables';
  135.     PropertyTagJPEGACTables                   : result := 'PropertyTagJPEGACTables';
  136.     PropertyTagYCbCrCoefficients              : result := 'PropertyTagYCbCrCoefficients';
  137.     PropertyTagYCbCrSubsampling               : result := 'PropertyTagYCbCrSubsampling';
  138.     PropertyTagYCbCrPositioning               : result := 'PropertyTagYCbCrPositioning';
  139.     PropertyTagREFBlackWhite                  : result := 'PropertyTagREFBlackWhite';
  140.     PropertyTagICCProfile                     : result := 'PropertyTagICCProfile';
  141.     PropertyTagGamma                          : result := 'PropertyTagGamma';
  142.     PropertyTagICCProfileDescriptor           : result := 'PropertyTagICCProfileDescriptor';
  143.     PropertyTagSRGBRenderingIntent            : result := 'PropertyTagSRGBRenderingIntent';
  144.     PropertyTagImageTitle                     : result := 'PropertyTagImageTitle';
  145.     PropertyTagCopyright                      : result := 'PropertyTagCopyright';
  146.     PropertyTagResolutionXUnit                : result := 'PropertyTagResolutionXUnit';
  147.     PropertyTagResolutionYUnit                : result := 'PropertyTagResolutionYUnit';
  148.     PropertyTagResolutionXLengthUnit          : result := 'PropertyTagResolutionXLengthUnit';
  149.     PropertyTagResolutionYLengthUnit          : result := 'PropertyTagResolutionYLengthUnit';
  150.     PropertyTagPrintFlags                     : result := 'PropertyTagPrintFlags';
  151.     PropertyTagPrintFlagsVersion              : result := 'PropertyTagPrintFlagsVersion';
  152.     PropertyTagPrintFlagsCrop                 : result := 'PropertyTagPrintFlagsCrop';
  153.     PropertyTagPrintFlagsBleedWidth           : result := 'PropertyTagPrintFlagsBleedWidth';
  154.     PropertyTagPrintFlagsBleedWidthScale      : result := 'PropertyTagPrintFlagsBleedWidthScale';
  155.     PropertyTagHalftoneLPI                    : result := 'PropertyTagHalftoneLPI';
  156.     PropertyTagHalftoneLPIUnit                : result := 'PropertyTagHalftoneLPIUnit';
  157.     PropertyTagHalftoneDegree                 : result := 'PropertyTagHalftoneDegree';
  158.     PropertyTagHalftoneShape                  : result := 'PropertyTagHalftoneShape';
  159.     PropertyTagHalftoneMisc                   : result := 'PropertyTagHalftoneMisc';
  160.     PropertyTagHalftoneScreen                 : result := 'PropertyTagHalftoneScreen';
  161.     PropertyTagJPEGQuality                    : result := 'PropertyTagJPEGQuality';
  162.     PropertyTagGridSize                       : result := 'PropertyTagGridSize';
  163.     PropertyTagThumbnailFormat                : result := 'PropertyTagThumbnailFormat';
  164.     PropertyTagThumbnailWidth                 : result := 'PropertyTagThumbnailWidth';
  165.     PropertyTagThumbnailHeight                : result := 'PropertyTagThumbnailHeight';
  166.     PropertyTagThumbnailColorDepth            : result := 'PropertyTagThumbnailColorDepth';
  167.     PropertyTagThumbnailPlanes                : result := 'PropertyTagThumbnailPlanes';
  168.     PropertyTagThumbnailRawBytes              : result := 'PropertyTagThumbnailRawBytes';
  169.     PropertyTagThumbnailSize                  : result := 'PropertyTagThumbnailSize';
  170.     PropertyTagThumbnailCompressedSize        : result := 'PropertyTagThumbnailCompressedSize';
  171.     PropertyTagColorTransferFunction          : result := 'PropertyTagColorTransferFunction';
  172.     PropertyTagThumbnailData                  : result := 'PropertyTagThumbnailData';
  173.     PropertyTagThumbnailImageWidth            : result := 'PropertyTagThumbnailImageWidth';
  174.     PropertyTagThumbnailImageHeight           : result := 'PropertyTagThumbnailImageHeight';
  175.     PropertyTagThumbnailBitsPerSample         : result := 'PropertyTagThumbnailBitsPerSample';
  176.     PropertyTagThumbnailCompression           : result := 'PropertyTagThumbnailCompression';
  177.     PropertyTagThumbnailPhotometricInterp     : result := 'PropertyTagThumbnailPhotometricInterp';
  178.     PropertyTagThumbnailImageDescription      : result := 'PropertyTagThumbnailImageDescription';
  179.     PropertyTagThumbnailEquipMake             : result := 'PropertyTagThumbnailEquipMake';
  180.     PropertyTagThumbnailEquipModel            : result := 'PropertyTagThumbnailEquipModel';
  181.     PropertyTagThumbnailStripOffsets          : result := 'PropertyTagThumbnailStripOffsets';
  182.     PropertyTagThumbnailOrientation           : result := 'PropertyTagThumbnailOrientation';
  183.     PropertyTagThumbnailSamplesPerPixel       : result := 'PropertyTagThumbnailSamplesPerPixel';
  184.     PropertyTagThumbnailRowsPerStrip          : result := 'PropertyTagThumbnailRowsPerStrip';
  185.     PropertyTagThumbnailStripBytesCount       : result := 'PropertyTagThumbnailStripBytesCount';
  186.     PropertyTagThumbnailResolutionX           : result := 'PropertyTagThumbnailResolutionX';
  187.     PropertyTagThumbnailResolutionY           : result := 'PropertyTagThumbnailResolutionY';
  188.     PropertyTagThumbnailPlanarConfig          : result := 'PropertyTagThumbnailPlanarConfig';
  189.     PropertyTagThumbnailResolutionUnit        : result := 'PropertyTagThumbnailResolutionUnit';
  190.     PropertyTagThumbnailTransferFunction      : result := 'PropertyTagThumbnailTransferFunction';
  191.     PropertyTagThumbnailSoftwareUsed          : result := 'PropertyTagThumbnailSoftwareUsed';
  192.     PropertyTagThumbnailDateTime              : result := 'PropertyTagThumbnailDateTime';
  193.     PropertyTagThumbnailArtist                : result := 'PropertyTagThumbnailArtist';
  194.     PropertyTagThumbnailWhitePoint            : result := 'PropertyTagThumbnailWhitePoint';
  195.     PropertyTagThumbnailPrimaryChromaticities : result := 'PropertyTagThumbnailPrimaryChromaticities';
  196.     PropertyTagThumbnailYCbCrCoefficients     : result := 'PropertyTagThumbnailYCbCrCoefficients';
  197.     PropertyTagThumbnailYCbCrSubsampling      : result := 'PropertyTagThumbnailYCbCrSubsampling';
  198.     PropertyTagThumbnailYCbCrPositioning      : result := 'PropertyTagThumbnailYCbCrPositioning';
  199.     PropertyTagThumbnailRefBlackWhite         : result := 'PropertyTagThumbnailRefBlackWhite';
  200.     PropertyTagThumbnailCopyRight             : result := 'PropertyTagThumbnailCopyRight';
  201.     PropertyTagLuminanceTable                 : result := 'PropertyTagLuminanceTable';
  202.     PropertyTagChrominanceTable               : result := 'PropertyTagChrominanceTable';
  203.     PropertyTagFrameDelay                     : result := 'PropertyTagFrameDelay';
  204.     PropertyTagLoopCount                      : result := 'PropertyTagLoopCount';
  205.     PropertyTagPixelUnit                      : result := 'PropertyTagPixelUnit';
  206.     PropertyTagPixelPerUnitX                  : result := 'PropertyTagPixelPerUnitX';
  207.     PropertyTagPixelPerUnitY                  : result := 'PropertyTagPixelPerUnitY';
  208.     PropertyTagPaletteHistogram               : result := 'PropertyTagPaletteHistogram';
  209.     PropertyTagExifExposureTime               : result := 'PropertyTagExifExposureTime';
  210.     PropertyTagExifFNumber                    : result := 'PropertyTagExifFNumber';
  211.     PropertyTagExifExposureProg               : result := 'PropertyTagExifExposureProg';
  212.     PropertyTagExifSpectralSense              : result := 'PropertyTagExifSpectralSense';
  213.     PropertyTagExifISOSpeed                   : result := 'PropertyTagExifISOSpeed';
  214.     PropertyTagExifOECF                       : result := 'PropertyTagExifOECF';
  215.     PropertyTagExifVer                        : result := 'PropertyTagExifVer';
  216.     PropertyTagExifDTOrig                     : result := 'PropertyTagExifDTOrig';
  217.     PropertyTagExifDTDigitized                : result := 'PropertyTagExifDTDigitized';
  218.     PropertyTagExifCompConfig                 : result := 'PropertyTagExifCompConfig';
  219.     PropertyTagExifCompBPP                    : result := 'PropertyTagExifCompBPP';
  220.     PropertyTagExifShutterSpeed               : result := 'PropertyTagExifShutterSpeed';
  221.     PropertyTagExifAperture                   : result := 'PropertyTagExifAperture';
  222.     PropertyTagExifBrightness                 : result := 'PropertyTagExifBrightness';
  223.     PropertyTagExifExposureBias               : result := 'PropertyTagExifExposureBias';
  224.     PropertyTagExifMaxAperture                : result := 'PropertyTagExifMaxAperture';
  225.     PropertyTagExifSubjectDist                : result := 'PropertyTagExifSubjectDist';
  226.     PropertyTagExifMeteringMode               : result := 'PropertyTagExifMeteringMode';
  227.     PropertyTagExifLightSource                : result := 'PropertyTagExifLightSource';
  228.     PropertyTagExifFlash                      : result := 'PropertyTagExifFlash';
  229.     PropertyTagExifFocalLength                : result := 'PropertyTagExifFocalLength';
  230.     PropertyTagExifMakerNote                  : result := 'PropertyTagExifMakerNote';
  231.     PropertyTagExifUserComment                : result := 'PropertyTagExifUserComment';
  232.     PropertyTagExifDTSubsec                   : result := 'PropertyTagExifDTSubsec';
  233.     PropertyTagExifDTOrigSS                   : result := 'PropertyTagExifDTOrigSS';
  234.     PropertyTagExifDTDigSS                    : result := 'PropertyTagExifDTDigSS';
  235.     PropertyTagExifFPXVer                     : result := 'PropertyTagExifFPXVer';
  236.     PropertyTagExifColorSpace                 : result := 'PropertyTagExifColorSpace';
  237.     PropertyTagExifPixXDim                    : result := 'PropertyTagExifPixXDim';
  238.     PropertyTagExifPixYDim                    : result := 'PropertyTagExifPixYDim';
  239.     PropertyTagExifRelatedWav                 : result := 'PropertyTagExifRelatedWav';
  240.     PropertyTagExifInterop                    : result := 'PropertyTagExifInterop';
  241.     PropertyTagExifFlashEnergy                : result := 'PropertyTagExifFlashEnergy';
  242.     PropertyTagExifSpatialFR                  : result := 'PropertyTagExifSpatialFR';
  243.     PropertyTagExifFocalXRes                  : result := 'PropertyTagExifFocalXRes';
  244.     PropertyTagExifFocalYRes                  : result := 'PropertyTagExifFocalYRes';
  245.     PropertyTagExifFocalResUnit               : result := 'PropertyTagExifFocalResUnit';
  246.     PropertyTagExifSubjectLoc                 : result := 'PropertyTagExifSubjectLoc';
  247.     PropertyTagExifExposureIndex              : result := 'PropertyTagExifExposureIndex';
  248.     PropertyTagExifSensingMethod              : result := 'PropertyTagExifSensingMethod';
  249.     PropertyTagExifFileSource                 : result := 'PropertyTagExifFileSource';
  250.     PropertyTagExifSceneType                  : result := 'PropertyTagExifSceneType';
  251.     PropertyTagExifCfaPattern                 : result := 'PropertyTagExifCfaPattern';
  252.     PropertyTagGpsVer                         : result := 'PropertyTagGpsVer';
  253.     PropertyTagGpsLatitudeRef                 : result := 'PropertyTagGpsLatitudeRef';
  254.     PropertyTagGpsLatitude                    : result := 'PropertyTagGpsLatitude';
  255.     PropertyTagGpsLongitudeRef                : result := 'PropertyTagGpsLongitudeRef';
  256.     PropertyTagGpsLongitude                   : result := 'PropertyTagGpsLongitude';
  257.     PropertyTagGpsAltitudeRef                 : result := 'PropertyTagGpsAltitudeRef';
  258.     PropertyTagGpsAltitude                    : result := 'PropertyTagGpsAltitude';
  259.     PropertyTagGpsGpsTime                     : result := 'PropertyTagGpsGpsTime';
  260.     PropertyTagGpsGpsSatellites               : result := 'PropertyTagGpsGpsSatellites';
  261.     PropertyTagGpsGpsStatus                   : result := 'PropertyTagGpsGpsStatus';
  262.     PropertyTagGpsGpsMeasureMode              : result := 'PropertyTagGpsGpsMeasureMode';
  263.     PropertyTagGpsGpsDop                      : result := 'PropertyTagGpsGpsDop';
  264.     PropertyTagGpsSpeedRef                    : result := 'PropertyTagGpsSpeedRef';
  265.     PropertyTagGpsSpeed                       : result := 'PropertyTagGpsSpeed';
  266.     PropertyTagGpsTrackRef                    : result := 'PropertyTagGpsTrackRef';
  267.     PropertyTagGpsTrack                       : result := 'PropertyTagGpsTrack';
  268.     PropertyTagGpsImgDirRef                   : result := 'PropertyTagGpsImgDirRef';
  269.     PropertyTagGpsImgDir                      : result := 'PropertyTagGpsImgDir';
  270.     PropertyTagGpsMapDatum                    : result := 'PropertyTagGpsMapDatum';
  271.     PropertyTagGpsDestLatRef                  : result := 'PropertyTagGpsDestLatRef';
  272.     PropertyTagGpsDestLat                     : result := 'PropertyTagGpsDestLat';
  273.     PropertyTagGpsDestLongRef                 : result := 'PropertyTagGpsDestLongRef';
  274.     PropertyTagGpsDestLong                    : result := 'PropertyTagGpsDestLong';
  275.     PropertyTagGpsDestBearRef                 : result := 'PropertyTagGpsDestBearRef';
  276.     PropertyTagGpsDestBear                    : result := 'PropertyTagGpsDestBear';
  277.     PropertyTagGpsDestDistRef                 : result := 'PropertyTagGpsDestDistRef';
  278.     PropertyTagGpsDestDist                    : result := 'PropertyTagGpsDestDist';
  279.   else
  280.     result := '<UnKnown>';
  281.   end;
  282. end;
  283.  
  284. function GetEncoderClsid(format: String; out pClsid: TGUID): integer;
  285. var
  286.   num, size, j: UINT;
  287.   ImageCodecInfo: PImageCodecInfo;
  288. Type
  289.   ArrIMgInf = array of TImageCodecInfo;
  290. begin
  291.   num  := 0; // number of image encoders
  292.   size := 0; // size of the image encoder array in bytes
  293.   result := -1;
  294.  
  295.   GetImageEncodersSize(num, size);
  296.   if (size = 0) then exit;
  297.  
  298.   GetMem(ImageCodecInfo, size);
  299.   if(ImageCodecInfo = nil) then exit;
  300.  
  301.   GetImageEncoders(num, size, ImageCodecInfo);
  302.  
  303.   for j := 0 to num - 1 do
  304.   begin
  305.     if( ArrIMgInf(ImageCodecInfo)[j].MimeType = format) then
  306.     begin
  307.       pClsid := ArrIMgInf(ImageCodecInfo)[j].Clsid;
  308.       result := j;  // Success
  309.     end;
  310.   end;
  311.   FreeMem(ImageCodecInfo, size);
  312. end;
  313.  
  314. function GetStatus(Stat: TStatus): string;
  315. begin
  316.   case Stat of
  317.     Ok                        : result := 'Ok';
  318.     GenericError              : result := 'GenericError';
  319.     InvalidParameter          : result := 'InvalidParameter';
  320.     OutOfMemory               : result := 'OutOfMemory';
  321.     ObjectBusy                : result := 'ObjectBusy';
  322.     InsufficientBuffer        : result := 'InsufficientBuffer';
  323.     NotImplemented            : result := 'NotImplemented';
  324.     Win32Error                : result := 'Win32Error';
  325.     WrongState                : result := 'WrongState';
  326.     Aborted                   : result := 'Aborted';
  327.     FileNotFound              : result := 'FileNotFound';
  328.     ValueOverflow             : result := 'ValueOverflow';
  329.     AccessDenied              : result := 'AccessDenied';
  330.     UnknownImageFormat        : result := 'UnknownImageFormat';
  331.     FontFamilyNotFound        : result := 'FontFamilyNotFound';
  332.     FontStyleNotFound         : result := 'FontStyleNotFound';
  333.     NotTrueTypeFont           : result := 'NotTrueTypeFont';
  334.     UnsupportedGdiplusVersion : result := 'UnsupportedGdiplusVersion';
  335.     GdiplusNotInitialized     : result := 'GdiplusNotInitialized';
  336.     PropertyNotFound          : result := 'PropertyNotFound';
  337.     PropertyNotSupported      : result := 'PropertyNotSupported';
  338.   else
  339.     result := '<UnKnown>';
  340.   end;
  341. end;
  342.  
  343. function PixelFormatString(PixelFormat: TPixelFormat): string;
  344. begin
  345.   case PixelFormat of
  346.     PixelFormatIndexed        : result := 'PixelFormatIndexed';
  347.     PixelFormatGDI            : result := 'PixelFormatGDI';
  348.     PixelFormatAlpha          : result := 'PixelFormatAlpha';
  349.     PixelFormatPAlpha         : result := 'PixelFormatPAlpha';
  350.     PixelFormatExtended       : result := 'PixelFormatExtended';
  351.     PixelFormatCanonical      : result := 'PixelFormatCanonical';
  352.     PixelFormatUndefined      : result := 'PixelFormatUndefined';
  353.     PixelFormat1bppIndexed    : result := 'PixelFormat1bppIndexed';
  354.     PixelFormat4bppIndexed    : result := 'PixelFormat4bppIndexed';
  355.     PixelFormat8bppIndexed    : result := 'PixelFormat8bppIndexed';
  356.     PixelFormat16bppGrayScale : result := 'PixelFormat16bppGrayScale';
  357.     PixelFormat16bppRGB555    : result := 'PixelFormat16bppRGB555';
  358.     PixelFormat16bppRGB565    : result := 'PixelFormat16bppRGB565';
  359.     PixelFormat16bppARGB1555  : result := 'PixelFormat16bppARGB1555';
  360.     PixelFormat24bppRGB       : result := 'PixelFormat24bppRGB';
  361.     PixelFormat32bppRGB       : result := 'PixelFormat32bppRGB';
  362.     PixelFormat32bppARGB      : result := 'PixelFormat32bppARGB';
  363.     PixelFormat32bppPARGB     : result := 'PixelFormat32bppPARGB';
  364.     PixelFormat48bppRGB       : result := 'PixelFormat48bppRGB';
  365.     PixelFormat64bppARGB      : result := 'PixelFormat64bppARGB';
  366.     PixelFormat64bppPARGB     : result := 'PixelFormat64bppPARGB';
  367.     PixelFormatMax            : result := 'PixelFormatMax';
  368.   else
  369.     result := '<UnKnown>';
  370.   end;
  371. end;
  372.  
  373. function MakeLangID(PrimaryLanguage, SubLanguage: LANGID): Word;
  374. begin
  375.   result := (SubLanguage shl 10) or PrimaryLanguage;
  376. end;
  377.  
  378. end.
  379.