zoukankan      html  css  js  c++  java
  • 再学 GDI+[102]: TGPImage(22) 获取所有解码器的详细信息

    本例运行结果:
    Clsid: {557CF400-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CAB-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in BMP Codec
    DllName: 
    FormatDescription: BMP
    FilenameExtension: *.BMP;*.DIB;*.RLE
    MimeType: image/bmp
    Flags: 65543
    Version: 1
    SigCount: 1
    SigSize: 2
    
    Clsid: {557CF401-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CAE-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in JPEG Codec
    DllName: 
    FormatDescription: JPEG
    FilenameExtension: *.JPG;*.JPEG;*.JPE;*.JFIF
    MimeType: image/jpeg
    Flags: 65543
    Version: 1
    SigCount: 1
    SigSize: 2
    
    Clsid: {557CF402-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CB0-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in GIF Codec
    DllName: 
    FormatDescription: GIF
    FilenameExtension: *.GIF
    MimeType: image/gif
    Flags: 65543
    Version: 1
    SigCount: 2
    SigSize: 6
    
    Clsid: {557CF403-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CAC-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in EMF Codec
    DllName: 
    FormatDescription: EMF
    FilenameExtension: *.EMF
    MimeType: image/x-emf
    Flags: 65542
    Version: 1
    SigCount: 1
    SigSize: 44
    
    Clsid: {557CF404-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CAD-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in WMF Codec
    DllName: 
    FormatDescription: WMF
    FilenameExtension: *.WMF
    MimeType: image/x-wmf
    Flags: 65542
    Version: 1
    SigCount: 1
    SigSize: 4
    
    Clsid: {557CF405-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CB1-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in TIFF Codec
    DllName: 
    FormatDescription: TIFF
    FilenameExtension: *.TIF;*.TIFF
    MimeType: image/tiff
    Flags: 65543
    Version: 1
    SigCount: 2
    SigSize: 2
    
    Clsid: {557CF406-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CAF-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in PNG Codec
    DllName: 
    FormatDescription: PNG
    FilenameExtension: *.PNG
    MimeType: image/png
    Flags: 65543
    Version: 1
    SigCount: 1
    SigSize: 8
    
    Clsid: {557CF407-1A04-11D3-9A73-0000F81EF32E}
    FormatID: {B96B3CB5-0728-11D3-9D7B-0000F81EF32E}
    CodecName: Built-in ICO Codec
    DllName: 
    FormatDescription: ICO
    FilenameExtension: *.ICO
    MimeType: image/x-icon
    Flags: 65542
    Version: 1
    SigCount: 1
    SigSize: 4
    
    代码文件:
    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    uses GDIPOBJ, GDIPAPI;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      Memo1.Align := alLeft;
      Memo1.ScrollBars := ssBoth;
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    var
      num, size: Cardinal;
      ImageCodecInfo: PImageCodecInfo;
      i: Integer;
    type
      ArrImgCodInfo = array of TImageCodecInfo;
    begin
      GetImageDecodersSize(num, size);
      GetMem(ImageCodecInfo, size);
      GetImageDecoders(num, size, ImageCodecInfo);
    
      Memo1.Clear;
      for i := 0 to num - 1 do with Memo1.Lines do
      begin
        Add(format('Clsid: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[i].Clsid)]));
        Add(format('FormatID: %s',[GUIDToString(ArrImgCodInfo(ImageCodecInfo)[i].FormatID)]));
        Add(format('CodecName: %s',[ArrImgCodInfo(ImageCodecInfo)[i].CodecName]));
        Add(format('DllName: %s',[ArrImgCodInfo(ImageCodecInfo)[i].DllName]));
        Add(format('FormatDescription: %s',[ArrImgCodInfo(ImageCodecInfo)[i].FormatDescription]));
        Add(format('FilenameExtension: %s',[ArrImgCodInfo(ImageCodecInfo)[i].FilenameExtension]));
        Add(format('MimeType: %s',[ArrImgCodInfo(ImageCodecInfo)[i].MimeType]));
        Add(format('Flags: %d',[ArrImgCodInfo(ImageCodecInfo)[i].Flags]));
        Add(format('Version: %d',[ArrImgCodInfo(ImageCodecInfo)[i].Version]));
        Add(format('SigCount: %d',[ArrImgCodInfo(ImageCodecInfo)[i].SigCount]));
        Add(format('SigSize: %d',[ArrImgCodInfo(ImageCodecInfo)[i].SigSize]));
        Add('');
      end;
    
      FreeMem(ImageCodecInfo);
    end;
    
    end.
    
    窗体文件:
    object Form1: TForm1
      Left = 0
      Top = 0
      Caption = 'Form1'
      ClientHeight = 206
      ClientWidth = 445
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = []
      OldCreateOrder = False
      OnCreate = FormCreate
      PixelsPerInch = 96
      TextHeight = 13
      object Memo1: TMemo
        Left = 8
        Top = 8
        Width = 337
        Height = 145
        Lines.Strings = (
          'Memo1')
        TabOrder = 0
      end
      object Button1: TButton
        Left = 351
        Top = 32
        Width = 75
        Height = 25
        Caption = 'Button1'
        TabOrder = 1
        OnClick = Button1Click
      end
    end
    
    Clsid              //获取或设置 Guid 结构,其中包含能识别特定编码解码器的 GUID。 
    FormatID           //获取或设置 Guid 结构,其中包含用于识别编码解码器格式的 GUID。 
    CodecName          //获取或设置包含编码解码器名称的字符串。 
    DllName            //获取或设置包含存放编码解码器的 DLL 的路径名字符串。如果编码解码器不在 DLL 中,则该指针为空。 
    FormatDescription  //获取或设置描述编码解码器的文件格式的字符串。 
    FilenameExtension  //获取或设置包含编码解码器中使用的文件扩展名的字符串。这些扩展名用分号分隔。 
    MimeType           //获取或设置包含编码解码器的多用途网际邮件扩充协议 (MIME) 类型的字符串。
    Flags              //获取或设置用于存储有关编码解码器的其他信息的 32 位值。该属性从 ImageCodecFlags 枚举返回若干标志的组合。 
    Version            //获取或设置编码解码器的版本号。 
    SigMask            //获取或设置可用作筛选器的二维字节数组。 
    SigPattern         //获取或设置表示编码解码器签名的二维字节数组。
    
  • 相关阅读:
    Game Engine Architecture 3
    Game Engine Architecture 2
    补码
    工厂模式
    Game Engine Architecture 1
    YDWE Keynote
    3D Math Keynote 4
    3D Math Keynote 3
    3D Math Keynote 2
    OGRE中Any 类型的实现
  • 原文地址:https://www.cnblogs.com/del/p/1240049.html
Copyright © 2011-2022 走看看