Win32 API 日本語リファレンス
ホームMedia.KernelStreaming › KS_DATAFORMAT_IMAGEINFO

KS_DATAFORMAT_IMAGEINFO

構造体
サイズx64: 104 バイト / x86: 104 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
DataFormatKSDATAFORMAT64+0+0基底となるKSDATAFORMATデータフォーマット記述子である。
ImageInfoHeaderKS_BITMAPINFOHEADER40+64+64画像フォーマットを記述するKS_BITMAPINFOHEADERである。

各言語での定義

#include <windows.h>

// KSDATAFORMAT  (x64 64 / x86 64 バイト)
typedef struct KSDATAFORMAT {
    _Anonymous_e__Struct Anonymous;
    LONGLONG Alignment;
} KSDATAFORMAT;

// KS_BITMAPINFOHEADER  (x64 40 / x86 40 バイト)
typedef struct KS_BITMAPINFOHEADER {
    DWORD biSize;
    INT biWidth;
    INT biHeight;
    WORD biPlanes;
    WORD biBitCount;
    DWORD biCompression;
    DWORD biSizeImage;
    INT biXPelsPerMeter;
    INT biYPelsPerMeter;
    DWORD biClrUsed;
    DWORD biClrImportant;
} KS_BITMAPINFOHEADER;

// KS_DATAFORMAT_IMAGEINFO  (x64 104 / x86 104 バイト)
typedef struct KS_DATAFORMAT_IMAGEINFO {
    KSDATAFORMAT DataFormat;
    KS_BITMAPINFOHEADER ImageInfoHeader;
} KS_DATAFORMAT_IMAGEINFO;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KSDATAFORMAT
{
    public _Anonymous_e__Struct Anonymous;
    public long Alignment;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_BITMAPINFOHEADER
{
    public uint biSize;
    public int biWidth;
    public int biHeight;
    public ushort biPlanes;
    public ushort biBitCount;
    public uint biCompression;
    public uint biSizeImage;
    public int biXPelsPerMeter;
    public int biYPelsPerMeter;
    public uint biClrUsed;
    public uint biClrImportant;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct KS_DATAFORMAT_IMAGEINFO
{
    public KSDATAFORMAT DataFormat;
    public KS_BITMAPINFOHEADER ImageInfoHeader;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KSDATAFORMAT
    Public Anonymous As _Anonymous_e__Struct
    Public Alignment As Long
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_BITMAPINFOHEADER
    Public biSize As UInteger
    Public biWidth As Integer
    Public biHeight As Integer
    Public biPlanes As UShort
    Public biBitCount As UShort
    Public biCompression As UInteger
    Public biSizeImage As UInteger
    Public biXPelsPerMeter As Integer
    Public biYPelsPerMeter As Integer
    Public biClrUsed As UInteger
    Public biClrImportant As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure KS_DATAFORMAT_IMAGEINFO
    Public DataFormat As KSDATAFORMAT
    Public ImageInfoHeader As KS_BITMAPINFOHEADER
End Structure
import ctypes
from ctypes import wintypes

class KSDATAFORMAT(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Struct),
        ("Alignment", ctypes.c_longlong),
    ]

class KS_BITMAPINFOHEADER(ctypes.Structure):
    _fields_ = [
        ("biSize", wintypes.DWORD),
        ("biWidth", ctypes.c_int),
        ("biHeight", ctypes.c_int),
        ("biPlanes", ctypes.c_ushort),
        ("biBitCount", ctypes.c_ushort),
        ("biCompression", wintypes.DWORD),
        ("biSizeImage", wintypes.DWORD),
        ("biXPelsPerMeter", ctypes.c_int),
        ("biYPelsPerMeter", ctypes.c_int),
        ("biClrUsed", wintypes.DWORD),
        ("biClrImportant", wintypes.DWORD),
    ]

class KS_DATAFORMAT_IMAGEINFO(ctypes.Structure):
    _fields_ = [
        ("DataFormat", KSDATAFORMAT),
        ("ImageInfoHeader", KS_BITMAPINFOHEADER),
    ]
#[repr(C)]
pub struct KSDATAFORMAT {
    pub Anonymous: _Anonymous_e__Struct,
    pub Alignment: i64,
}

#[repr(C)]
pub struct KS_BITMAPINFOHEADER {
    pub biSize: u32,
    pub biWidth: i32,
    pub biHeight: i32,
    pub biPlanes: u16,
    pub biBitCount: u16,
    pub biCompression: u32,
    pub biSizeImage: u32,
    pub biXPelsPerMeter: i32,
    pub biYPelsPerMeter: i32,
    pub biClrUsed: u32,
    pub biClrImportant: u32,
}

#[repr(C)]
pub struct KS_DATAFORMAT_IMAGEINFO {
    pub DataFormat: KSDATAFORMAT,
    pub ImageInfoHeader: KS_BITMAPINFOHEADER,
}
import "golang.org/x/sys/windows"

type KSDATAFORMAT struct {
	Anonymous _Anonymous_e__Struct
	Alignment int64
}

type KS_BITMAPINFOHEADER struct {
	biSize uint32
	biWidth int32
	biHeight int32
	biPlanes uint16
	biBitCount uint16
	biCompression uint32
	biSizeImage uint32
	biXPelsPerMeter int32
	biYPelsPerMeter int32
	biClrUsed uint32
	biClrImportant uint32
}

type KS_DATAFORMAT_IMAGEINFO struct {
	DataFormat KSDATAFORMAT
	ImageInfoHeader KS_BITMAPINFOHEADER
}
type
  KSDATAFORMAT = record
    Anonymous: _Anonymous_e__Struct;
    Alignment: Int64;
  end;

  KS_BITMAPINFOHEADER = record
    biSize: DWORD;
    biWidth: Integer;
    biHeight: Integer;
    biPlanes: Word;
    biBitCount: Word;
    biCompression: DWORD;
    biSizeImage: DWORD;
    biXPelsPerMeter: Integer;
    biYPelsPerMeter: Integer;
    biClrUsed: DWORD;
    biClrImportant: DWORD;
  end;

  KS_DATAFORMAT_IMAGEINFO = record
    DataFormat: KSDATAFORMAT;
    ImageInfoHeader: KS_BITMAPINFOHEADER;
  end;
const KSDATAFORMAT = extern struct {
    Anonymous: _Anonymous_e__Struct,
    Alignment: i64,
};

const KS_BITMAPINFOHEADER = extern struct {
    biSize: u32,
    biWidth: i32,
    biHeight: i32,
    biPlanes: u16,
    biBitCount: u16,
    biCompression: u32,
    biSizeImage: u32,
    biXPelsPerMeter: i32,
    biYPelsPerMeter: i32,
    biClrUsed: u32,
    biClrImportant: u32,
};

const KS_DATAFORMAT_IMAGEINFO = extern struct {
    DataFormat: KSDATAFORMAT,
    ImageInfoHeader: KS_BITMAPINFOHEADER,
};
type
  KSDATAFORMAT {.bycopy.} = object
    Anonymous: _Anonymous_e__Struct
    Alignment: int64

  KS_BITMAPINFOHEADER {.bycopy.} = object
    biSize: uint32
    biWidth: int32
    biHeight: int32
    biPlanes: uint16
    biBitCount: uint16
    biCompression: uint32
    biSizeImage: uint32
    biXPelsPerMeter: int32
    biYPelsPerMeter: int32
    biClrUsed: uint32
    biClrImportant: uint32

  KS_DATAFORMAT_IMAGEINFO {.bycopy.} = object
    DataFormat: KSDATAFORMAT
    ImageInfoHeader: KS_BITMAPINFOHEADER
struct KSDATAFORMAT
{
    _Anonymous_e__Struct Anonymous;
    long Alignment;
}

struct KS_BITMAPINFOHEADER
{
    uint biSize;
    int biWidth;
    int biHeight;
    ushort biPlanes;
    ushort biBitCount;
    uint biCompression;
    uint biSizeImage;
    int biXPelsPerMeter;
    int biYPelsPerMeter;
    uint biClrUsed;
    uint biClrImportant;
}

struct KS_DATAFORMAT_IMAGEINFO
{
    KSDATAFORMAT DataFormat;
    KS_BITMAPINFOHEADER ImageInfoHeader;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_DATAFORMAT_IMAGEINFO サイズ: 104 バイト(x64)
dim st, 26    ; 4byte整数×26(構造体サイズ 104 / 4 切り上げ)
; DataFormat : KSDATAFORMAT (+0, 64byte)  varptr(st)+0 を基点に操作(64byte:入れ子/配列)
; ImageInfoHeader : KS_BITMAPINFOHEADER (+64, 40byte)  varptr(st)+64 を基点に操作(40byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global KS_BITMAPINFOHEADER
    #field int biSize
    #field int biWidth
    #field int biHeight
    #field short biPlanes
    #field short biBitCount
    #field int biCompression
    #field int biSizeImage
    #field int biXPelsPerMeter
    #field int biYPelsPerMeter
    #field int biClrUsed
    #field int biClrImportant
#endstruct

#defstruct global KS_DATAFORMAT_IMAGEINFO
    #field byte DataFormat 64
    #field KS_BITMAPINFOHEADER ImageInfoHeader
#endstruct

stdim st, KS_DATAFORMAT_IMAGEINFO        ; NSTRUCT 変数を確保
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。