Win32 API 日本語リファレンス
ホームGraphics.Gdi › BITMAPV5HEADER

BITMAPV5HEADER

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

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

フィールド

フィールドサイズx64x86説明
bV5SizeDWORD4+0+0この構造体のサイズ(バイト数)。
bV5WidthINT4+4+4ビットマップの幅(ピクセル数)。
bV5HeightINT4+8+8ビットマップの高さ。正でボトムアップ、負でトップダウン。
bV5PlanesWORD2+12+12対象デバイスのプレーン数。常に1。
bV5BitCountWORD2+14+141ピクセルあたりのビット数(色深度)。
bV5CompressionBI_COMPRESSION4+16+16ビットマップの圧縮形式を示すBI_COMPRESSION列挙値。
bV5SizeImageDWORD4+20+20画像データのバイト数。
bV5XPelsPerMeterINT4+24+24水平方向の解像度(1メートルあたりのピクセル数)。
bV5YPelsPerMeterINT4+28+28垂直方向の解像度(1メートルあたりのピクセル数)。
bV5ClrUsedDWORD4+32+32実際に使用するカラーテーブルの色数。0で最大数を使用。
bV5ClrImportantDWORD4+36+36表示に重要な色数。0で全色が重要。
bV5RedMaskDWORD4+40+40赤成分を抽出するためのカラーマスク。
bV5GreenMaskDWORD4+44+44緑成分を抽出するためのカラーマスク。
bV5BlueMaskDWORD4+48+48青成分を抽出するためのカラーマスク。
bV5AlphaMaskDWORD4+52+52アルファ成分を抽出するためのカラーマスク。
bV5CSTypeDWORD4+56+56ビットマップの色空間種別を示す値。
bV5EndpointsCIEXYZTRIPLE36+60+60色空間の原色エンドポイント座標を表すCIEXYZTRIPLE。
bV5GammaRedDWORD4+96+96赤チャンネルのガンマ値(16.16固定小数点)。
bV5GammaGreenDWORD4+100+100緑チャンネルのガンマ値(16.16固定小数点)。
bV5GammaBlueDWORD4+104+104青チャンネルのガンマ値(16.16固定小数点)。
bV5IntentDWORD4+108+108色のレンダリングインテント(変換意図)を示す値。
bV5ProfileDataDWORD4+112+112埋め込みまたはリンクされたカラープロファイルへのオフセット(バイト)。
bV5ProfileSizeDWORD4+116+116カラープロファイルデータのバイト数。
bV5ReservedDWORD4+120+120予約フィールド。0でなければならない。

各言語での定義

#include <windows.h>

// CIEXYZ  (x64 12 / x86 12 バイト)
typedef struct CIEXYZ {
    INT ciexyzX;
    INT ciexyzY;
    INT ciexyzZ;
} CIEXYZ;

// CIEXYZTRIPLE  (x64 36 / x86 36 バイト)
typedef struct CIEXYZTRIPLE {
    CIEXYZ ciexyzRed;
    CIEXYZ ciexyzGreen;
    CIEXYZ ciexyzBlue;
} CIEXYZTRIPLE;

// BITMAPV5HEADER  (x64 124 / x86 124 バイト)
typedef struct BITMAPV5HEADER {
    DWORD bV5Size;
    INT bV5Width;
    INT bV5Height;
    WORD bV5Planes;
    WORD bV5BitCount;
    BI_COMPRESSION bV5Compression;
    DWORD bV5SizeImage;
    INT bV5XPelsPerMeter;
    INT bV5YPelsPerMeter;
    DWORD bV5ClrUsed;
    DWORD bV5ClrImportant;
    DWORD bV5RedMask;
    DWORD bV5GreenMask;
    DWORD bV5BlueMask;
    DWORD bV5AlphaMask;
    DWORD bV5CSType;
    CIEXYZTRIPLE bV5Endpoints;
    DWORD bV5GammaRed;
    DWORD bV5GammaGreen;
    DWORD bV5GammaBlue;
    DWORD bV5Intent;
    DWORD bV5ProfileData;
    DWORD bV5ProfileSize;
    DWORD bV5Reserved;
} BITMAPV5HEADER;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CIEXYZ
{
    public int ciexyzX;
    public int ciexyzY;
    public int ciexyzZ;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CIEXYZTRIPLE
{
    public CIEXYZ ciexyzRed;
    public CIEXYZ ciexyzGreen;
    public CIEXYZ ciexyzBlue;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BITMAPV5HEADER
{
    public uint bV5Size;
    public int bV5Width;
    public int bV5Height;
    public ushort bV5Planes;
    public ushort bV5BitCount;
    public uint bV5Compression;
    public uint bV5SizeImage;
    public int bV5XPelsPerMeter;
    public int bV5YPelsPerMeter;
    public uint bV5ClrUsed;
    public uint bV5ClrImportant;
    public uint bV5RedMask;
    public uint bV5GreenMask;
    public uint bV5BlueMask;
    public uint bV5AlphaMask;
    public uint bV5CSType;
    public CIEXYZTRIPLE bV5Endpoints;
    public uint bV5GammaRed;
    public uint bV5GammaGreen;
    public uint bV5GammaBlue;
    public uint bV5Intent;
    public uint bV5ProfileData;
    public uint bV5ProfileSize;
    public uint bV5Reserved;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CIEXYZ
    Public ciexyzX As Integer
    Public ciexyzY As Integer
    Public ciexyzZ As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CIEXYZTRIPLE
    Public ciexyzRed As CIEXYZ
    Public ciexyzGreen As CIEXYZ
    Public ciexyzBlue As CIEXYZ
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BITMAPV5HEADER
    Public bV5Size As UInteger
    Public bV5Width As Integer
    Public bV5Height As Integer
    Public bV5Planes As UShort
    Public bV5BitCount As UShort
    Public bV5Compression As UInteger
    Public bV5SizeImage As UInteger
    Public bV5XPelsPerMeter As Integer
    Public bV5YPelsPerMeter As Integer
    Public bV5ClrUsed As UInteger
    Public bV5ClrImportant As UInteger
    Public bV5RedMask As UInteger
    Public bV5GreenMask As UInteger
    Public bV5BlueMask As UInteger
    Public bV5AlphaMask As UInteger
    Public bV5CSType As UInteger
    Public bV5Endpoints As CIEXYZTRIPLE
    Public bV5GammaRed As UInteger
    Public bV5GammaGreen As UInteger
    Public bV5GammaBlue As UInteger
    Public bV5Intent As UInteger
    Public bV5ProfileData As UInteger
    Public bV5ProfileSize As UInteger
    Public bV5Reserved As UInteger
End Structure
import ctypes
from ctypes import wintypes

class CIEXYZ(ctypes.Structure):
    _fields_ = [
        ("ciexyzX", ctypes.c_int),
        ("ciexyzY", ctypes.c_int),
        ("ciexyzZ", ctypes.c_int),
    ]

class CIEXYZTRIPLE(ctypes.Structure):
    _fields_ = [
        ("ciexyzRed", CIEXYZ),
        ("ciexyzGreen", CIEXYZ),
        ("ciexyzBlue", CIEXYZ),
    ]

class BITMAPV5HEADER(ctypes.Structure):
    _fields_ = [
        ("bV5Size", wintypes.DWORD),
        ("bV5Width", ctypes.c_int),
        ("bV5Height", ctypes.c_int),
        ("bV5Planes", ctypes.c_ushort),
        ("bV5BitCount", ctypes.c_ushort),
        ("bV5Compression", wintypes.DWORD),
        ("bV5SizeImage", wintypes.DWORD),
        ("bV5XPelsPerMeter", ctypes.c_int),
        ("bV5YPelsPerMeter", ctypes.c_int),
        ("bV5ClrUsed", wintypes.DWORD),
        ("bV5ClrImportant", wintypes.DWORD),
        ("bV5RedMask", wintypes.DWORD),
        ("bV5GreenMask", wintypes.DWORD),
        ("bV5BlueMask", wintypes.DWORD),
        ("bV5AlphaMask", wintypes.DWORD),
        ("bV5CSType", wintypes.DWORD),
        ("bV5Endpoints", CIEXYZTRIPLE),
        ("bV5GammaRed", wintypes.DWORD),
        ("bV5GammaGreen", wintypes.DWORD),
        ("bV5GammaBlue", wintypes.DWORD),
        ("bV5Intent", wintypes.DWORD),
        ("bV5ProfileData", wintypes.DWORD),
        ("bV5ProfileSize", wintypes.DWORD),
        ("bV5Reserved", wintypes.DWORD),
    ]
#[repr(C)]
pub struct CIEXYZ {
    pub ciexyzX: i32,
    pub ciexyzY: i32,
    pub ciexyzZ: i32,
}

#[repr(C)]
pub struct CIEXYZTRIPLE {
    pub ciexyzRed: CIEXYZ,
    pub ciexyzGreen: CIEXYZ,
    pub ciexyzBlue: CIEXYZ,
}

#[repr(C)]
pub struct BITMAPV5HEADER {
    pub bV5Size: u32,
    pub bV5Width: i32,
    pub bV5Height: i32,
    pub bV5Planes: u16,
    pub bV5BitCount: u16,
    pub bV5Compression: u32,
    pub bV5SizeImage: u32,
    pub bV5XPelsPerMeter: i32,
    pub bV5YPelsPerMeter: i32,
    pub bV5ClrUsed: u32,
    pub bV5ClrImportant: u32,
    pub bV5RedMask: u32,
    pub bV5GreenMask: u32,
    pub bV5BlueMask: u32,
    pub bV5AlphaMask: u32,
    pub bV5CSType: u32,
    pub bV5Endpoints: CIEXYZTRIPLE,
    pub bV5GammaRed: u32,
    pub bV5GammaGreen: u32,
    pub bV5GammaBlue: u32,
    pub bV5Intent: u32,
    pub bV5ProfileData: u32,
    pub bV5ProfileSize: u32,
    pub bV5Reserved: u32,
}
import "golang.org/x/sys/windows"

type CIEXYZ struct {
	ciexyzX int32
	ciexyzY int32
	ciexyzZ int32
}

type CIEXYZTRIPLE struct {
	ciexyzRed CIEXYZ
	ciexyzGreen CIEXYZ
	ciexyzBlue CIEXYZ
}

type BITMAPV5HEADER struct {
	bV5Size uint32
	bV5Width int32
	bV5Height int32
	bV5Planes uint16
	bV5BitCount uint16
	bV5Compression uint32
	bV5SizeImage uint32
	bV5XPelsPerMeter int32
	bV5YPelsPerMeter int32
	bV5ClrUsed uint32
	bV5ClrImportant uint32
	bV5RedMask uint32
	bV5GreenMask uint32
	bV5BlueMask uint32
	bV5AlphaMask uint32
	bV5CSType uint32
	bV5Endpoints CIEXYZTRIPLE
	bV5GammaRed uint32
	bV5GammaGreen uint32
	bV5GammaBlue uint32
	bV5Intent uint32
	bV5ProfileData uint32
	bV5ProfileSize uint32
	bV5Reserved uint32
}
type
  CIEXYZ = record
    ciexyzX: Integer;
    ciexyzY: Integer;
    ciexyzZ: Integer;
  end;

  CIEXYZTRIPLE = record
    ciexyzRed: CIEXYZ;
    ciexyzGreen: CIEXYZ;
    ciexyzBlue: CIEXYZ;
  end;

  BITMAPV5HEADER = record
    bV5Size: DWORD;
    bV5Width: Integer;
    bV5Height: Integer;
    bV5Planes: Word;
    bV5BitCount: Word;
    bV5Compression: DWORD;
    bV5SizeImage: DWORD;
    bV5XPelsPerMeter: Integer;
    bV5YPelsPerMeter: Integer;
    bV5ClrUsed: DWORD;
    bV5ClrImportant: DWORD;
    bV5RedMask: DWORD;
    bV5GreenMask: DWORD;
    bV5BlueMask: DWORD;
    bV5AlphaMask: DWORD;
    bV5CSType: DWORD;
    bV5Endpoints: CIEXYZTRIPLE;
    bV5GammaRed: DWORD;
    bV5GammaGreen: DWORD;
    bV5GammaBlue: DWORD;
    bV5Intent: DWORD;
    bV5ProfileData: DWORD;
    bV5ProfileSize: DWORD;
    bV5Reserved: DWORD;
  end;
const CIEXYZ = extern struct {
    ciexyzX: i32,
    ciexyzY: i32,
    ciexyzZ: i32,
};

const CIEXYZTRIPLE = extern struct {
    ciexyzRed: CIEXYZ,
    ciexyzGreen: CIEXYZ,
    ciexyzBlue: CIEXYZ,
};

const BITMAPV5HEADER = extern struct {
    bV5Size: u32,
    bV5Width: i32,
    bV5Height: i32,
    bV5Planes: u16,
    bV5BitCount: u16,
    bV5Compression: u32,
    bV5SizeImage: u32,
    bV5XPelsPerMeter: i32,
    bV5YPelsPerMeter: i32,
    bV5ClrUsed: u32,
    bV5ClrImportant: u32,
    bV5RedMask: u32,
    bV5GreenMask: u32,
    bV5BlueMask: u32,
    bV5AlphaMask: u32,
    bV5CSType: u32,
    bV5Endpoints: CIEXYZTRIPLE,
    bV5GammaRed: u32,
    bV5GammaGreen: u32,
    bV5GammaBlue: u32,
    bV5Intent: u32,
    bV5ProfileData: u32,
    bV5ProfileSize: u32,
    bV5Reserved: u32,
};
type
  CIEXYZ {.bycopy.} = object
    ciexyzX: int32
    ciexyzY: int32
    ciexyzZ: int32

  CIEXYZTRIPLE {.bycopy.} = object
    ciexyzRed: CIEXYZ
    ciexyzGreen: CIEXYZ
    ciexyzBlue: CIEXYZ

  BITMAPV5HEADER {.bycopy.} = object
    bV5Size: uint32
    bV5Width: int32
    bV5Height: int32
    bV5Planes: uint16
    bV5BitCount: uint16
    bV5Compression: uint32
    bV5SizeImage: uint32
    bV5XPelsPerMeter: int32
    bV5YPelsPerMeter: int32
    bV5ClrUsed: uint32
    bV5ClrImportant: uint32
    bV5RedMask: uint32
    bV5GreenMask: uint32
    bV5BlueMask: uint32
    bV5AlphaMask: uint32
    bV5CSType: uint32
    bV5Endpoints: CIEXYZTRIPLE
    bV5GammaRed: uint32
    bV5GammaGreen: uint32
    bV5GammaBlue: uint32
    bV5Intent: uint32
    bV5ProfileData: uint32
    bV5ProfileSize: uint32
    bV5Reserved: uint32
struct CIEXYZ
{
    int ciexyzX;
    int ciexyzY;
    int ciexyzZ;
}

struct CIEXYZTRIPLE
{
    CIEXYZ ciexyzRed;
    CIEXYZ ciexyzGreen;
    CIEXYZ ciexyzBlue;
}

struct BITMAPV5HEADER
{
    uint bV5Size;
    int bV5Width;
    int bV5Height;
    ushort bV5Planes;
    ushort bV5BitCount;
    uint bV5Compression;
    uint bV5SizeImage;
    int bV5XPelsPerMeter;
    int bV5YPelsPerMeter;
    uint bV5ClrUsed;
    uint bV5ClrImportant;
    uint bV5RedMask;
    uint bV5GreenMask;
    uint bV5BlueMask;
    uint bV5AlphaMask;
    uint bV5CSType;
    CIEXYZTRIPLE bV5Endpoints;
    uint bV5GammaRed;
    uint bV5GammaGreen;
    uint bV5GammaBlue;
    uint bV5Intent;
    uint bV5ProfileData;
    uint bV5ProfileSize;
    uint bV5Reserved;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BITMAPV5HEADER サイズ: 124 バイト(x64)
dim st, 31    ; 4byte整数×31(構造体サイズ 124 / 4 切り上げ)
; bV5Size : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; bV5Width : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; bV5Height : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; bV5Planes : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; bV5BitCount : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; bV5Compression : BI_COMPRESSION (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; bV5SizeImage : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; bV5XPelsPerMeter : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; bV5YPelsPerMeter : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; bV5ClrUsed : DWORD (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; bV5ClrImportant : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; bV5RedMask : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; bV5GreenMask : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; bV5BlueMask : DWORD (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; bV5AlphaMask : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; bV5CSType : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; bV5Endpoints : CIEXYZTRIPLE (+60, 36byte)  varptr(st)+60 を基点に操作(36byte:入れ子/配列)
; bV5GammaRed : DWORD (+96, 4byte)  st.24 = 値  /  値 = st.24   (lpoke/lpeek も可)
; bV5GammaGreen : DWORD (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; bV5GammaBlue : DWORD (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; bV5Intent : DWORD (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; bV5ProfileData : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; bV5ProfileSize : DWORD (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; bV5Reserved : DWORD (+120, 4byte)  st.30 = 値  /  値 = st.30   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global CIEXYZ
    #field int ciexyzX
    #field int ciexyzY
    #field int ciexyzZ
#endstruct

#defstruct global CIEXYZTRIPLE
    #field CIEXYZ ciexyzRed
    #field CIEXYZ ciexyzGreen
    #field CIEXYZ ciexyzBlue
#endstruct

#defstruct global BITMAPV5HEADER
    #field int bV5Size
    #field int bV5Width
    #field int bV5Height
    #field short bV5Planes
    #field short bV5BitCount
    #field int bV5Compression
    #field int bV5SizeImage
    #field int bV5XPelsPerMeter
    #field int bV5YPelsPerMeter
    #field int bV5ClrUsed
    #field int bV5ClrImportant
    #field int bV5RedMask
    #field int bV5GreenMask
    #field int bV5BlueMask
    #field int bV5AlphaMask
    #field int bV5CSType
    #field CIEXYZTRIPLE bV5Endpoints
    #field int bV5GammaRed
    #field int bV5GammaGreen
    #field int bV5GammaBlue
    #field int bV5Intent
    #field int bV5ProfileData
    #field int bV5ProfileSize
    #field int bV5Reserved
#endstruct

stdim st, BITMAPV5HEADER        ; NSTRUCT 変数を確保
st->bV5Size = 100
mes "bV5Size=" + st->bV5Size