ホーム › Graphics.GdiPlus › ImageCodecInfo
ImageCodecInfo
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Clsid | GUID | 16 | +0 | +0 | コーデックを一意に識別するCLSIDを表すGUID。 |
| FormatID | GUID | 16 | +16 | +16 | 画像形式を識別するフォーマットIDを表すGUID。 |
| CodecName | LPWSTR | 8/4 | +32 | +32 | コーデック名を表す文字列。 |
| DllName | LPWSTR | 8/4 | +40 | +36 | コーデックを実装するDLLのパスを表す文字列。 |
| FormatDescription | LPWSTR | 8/4 | +48 | +40 | 画像形式の説明文字列。 |
| FilenameExtension | LPWSTR | 8/4 | +56 | +44 | 対応するファイル拡張子の一覧を表す文字列。 |
| MimeType | LPWSTR | 8/4 | +64 | +48 | 対応するMIMEタイプを表す文字列。 |
| Flags | DWORD | 4 | +72 | +52 | コーデックの属性を表すフラグ。ImageCodecFlagsEncoder等。 |
| Version | DWORD | 4 | +76 | +56 | コーデックのバージョン番号を表す。 |
| SigCount | DWORD | 4 | +80 | +60 | 署名(シグネチャ)の個数を表す。 |
| SigSize | DWORD | 4 | +84 | +64 | 各署名のサイズをバイト単位で表す。 |
| SigPattern | BYTE* | 8/4 | +88 | +68 | ファイル先頭の署名パターンを表すバイト配列へのポインタ。 |
| SigMask | BYTE* | 8/4 | +96 | +72 | 署名比較時に適用するマスクを表すバイト配列へのポインタ。 |
各言語での定義
#include <windows.h>
// ImageCodecInfo (x64 104 / x86 76 バイト)
typedef struct ImageCodecInfo {
GUID Clsid;
GUID FormatID;
LPWSTR CodecName;
LPWSTR DllName;
LPWSTR FormatDescription;
LPWSTR FilenameExtension;
LPWSTR MimeType;
DWORD Flags;
DWORD Version;
DWORD SigCount;
DWORD SigSize;
BYTE* SigPattern;
BYTE* SigMask;
} ImageCodecInfo;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct ImageCodecInfo
{
public Guid Clsid;
public Guid FormatID;
public IntPtr CodecName;
public IntPtr DllName;
public IntPtr FormatDescription;
public IntPtr FilenameExtension;
public IntPtr MimeType;
public uint Flags;
public uint Version;
public uint SigCount;
public uint SigSize;
public IntPtr SigPattern;
public IntPtr SigMask;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure ImageCodecInfo
Public Clsid As Guid
Public FormatID As Guid
Public CodecName As IntPtr
Public DllName As IntPtr
Public FormatDescription As IntPtr
Public FilenameExtension As IntPtr
Public MimeType As IntPtr
Public Flags As UInteger
Public Version As UInteger
Public SigCount As UInteger
Public SigSize As UInteger
Public SigPattern As IntPtr
Public SigMask As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class ImageCodecInfo(ctypes.Structure):
_fields_ = [
("Clsid", GUID),
("FormatID", GUID),
("CodecName", ctypes.c_void_p),
("DllName", ctypes.c_void_p),
("FormatDescription", ctypes.c_void_p),
("FilenameExtension", ctypes.c_void_p),
("MimeType", ctypes.c_void_p),
("Flags", wintypes.DWORD),
("Version", wintypes.DWORD),
("SigCount", wintypes.DWORD),
("SigSize", wintypes.DWORD),
("SigPattern", ctypes.c_void_p),
("SigMask", ctypes.c_void_p),
]#[repr(C)]
pub struct ImageCodecInfo {
pub Clsid: GUID,
pub FormatID: GUID,
pub CodecName: *mut core::ffi::c_void,
pub DllName: *mut core::ffi::c_void,
pub FormatDescription: *mut core::ffi::c_void,
pub FilenameExtension: *mut core::ffi::c_void,
pub MimeType: *mut core::ffi::c_void,
pub Flags: u32,
pub Version: u32,
pub SigCount: u32,
pub SigSize: u32,
pub SigPattern: *mut core::ffi::c_void,
pub SigMask: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type ImageCodecInfo struct {
Clsid windows.GUID
FormatID windows.GUID
CodecName uintptr
DllName uintptr
FormatDescription uintptr
FilenameExtension uintptr
MimeType uintptr
Flags uint32
Version uint32
SigCount uint32
SigSize uint32
SigPattern uintptr
SigMask uintptr
}type
ImageCodecInfo = record
Clsid: TGUID;
FormatID: TGUID;
CodecName: Pointer;
DllName: Pointer;
FormatDescription: Pointer;
FilenameExtension: Pointer;
MimeType: Pointer;
Flags: DWORD;
Version: DWORD;
SigCount: DWORD;
SigSize: DWORD;
SigPattern: Pointer;
SigMask: Pointer;
end;const ImageCodecInfo = extern struct {
Clsid: GUID,
FormatID: GUID,
CodecName: ?*anyopaque,
DllName: ?*anyopaque,
FormatDescription: ?*anyopaque,
FilenameExtension: ?*anyopaque,
MimeType: ?*anyopaque,
Flags: u32,
Version: u32,
SigCount: u32,
SigSize: u32,
SigPattern: ?*anyopaque,
SigMask: ?*anyopaque,
};type
ImageCodecInfo {.bycopy.} = object
Clsid: GUID
FormatID: GUID
CodecName: pointer
DllName: pointer
FormatDescription: pointer
FilenameExtension: pointer
MimeType: pointer
Flags: uint32
Version: uint32
SigCount: uint32
SigSize: uint32
SigPattern: pointer
SigMask: pointerstruct ImageCodecInfo
{
GUID Clsid;
GUID FormatID;
void* CodecName;
void* DllName;
void* FormatDescription;
void* FilenameExtension;
void* MimeType;
uint Flags;
uint Version;
uint SigCount;
uint SigSize;
void* SigPattern;
void* SigMask;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; ImageCodecInfo サイズ: 76 バイト(x86)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 4 切り上げ)
; Clsid : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; FormatID : GUID (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; CodecName : LPWSTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; DllName : LPWSTR (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; FormatDescription : LPWSTR (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; FilenameExtension : LPWSTR (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; MimeType : LPWSTR (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Flags : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; Version : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; SigCount : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; SigSize : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; SigPattern : BYTE* (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; SigMask : BYTE* (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; ImageCodecInfo サイズ: 104 バイト(x64)
dim st, 26 ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; Clsid : GUID (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; FormatID : GUID (+16, 16byte) varptr(st)+16 を基点に操作(16byte:入れ子/配列)
; CodecName : LPWSTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; DllName : LPWSTR (+40, 8byte) qpoke st,40,値 / qpeek(st,40) ※IronHSPのみ。3.7/3.8は lpoke st,40,下位 : lpoke st,44,上位
; FormatDescription : LPWSTR (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; FilenameExtension : LPWSTR (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; MimeType : LPWSTR (+64, 8byte) qpoke st,64,値 / qpeek(st,64) ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; Flags : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; Version : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; SigCount : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; SigSize : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; SigPattern : BYTE* (+88, 8byte) qpoke st,88,値 / qpeek(st,88) ※IronHSPのみ。3.7/3.8は lpoke st,88,下位 : lpoke st,92,上位
; SigMask : BYTE* (+96, 8byte) qpoke st,96,値 / qpeek(st,96) ※IronHSPのみ。3.7/3.8は lpoke st,96,下位 : lpoke st,100,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global ImageCodecInfo
#field GUID Clsid
#field GUID FormatID
#field intptr CodecName
#field intptr DllName
#field intptr FormatDescription
#field intptr FilenameExtension
#field intptr MimeType
#field int Flags
#field int Version
#field int SigCount
#field int SigSize
#field intptr SigPattern
#field intptr SigMask
#endstruct
stdim st, ImageCodecInfo ; NSTRUCT 変数を確保
st->Flags = 100
mes "Flags=" + st->Flags