ホーム › Media.KernelStreaming › KS_BITMAPINFOHEADER
KS_BITMAPINFOHEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| biSize | DWORD | 4 | +0 | +0 | この構造体のサイズをバイト単位で示す。 |
| biWidth | INT | 4 | +4 | +4 | ビットマップの幅をピクセル単位で示す。 |
| biHeight | INT | 4 | +8 | +8 | ビットマップの高さをピクセル単位で示す。負値はトップダウン配置を表す。 |
| biPlanes | WORD | 2 | +12 | +12 | プレーン数を示し、通常1である。 |
| biBitCount | WORD | 2 | +14 | +14 | 1ピクセルあたりのビット数(色深度)を示す。 |
| biCompression | DWORD | 4 | +16 | +16 | 圧縮形式(FOURCCまたはBI_RGB等)を示す。 |
| biSizeImage | DWORD | 4 | +20 | +20 | 画像データのサイズをバイト単位で示す。 |
| biXPelsPerMeter | INT | 4 | +24 | +24 | 水平方向の解像度をピクセル/メートルで示す。 |
| biYPelsPerMeter | INT | 4 | +28 | +28 | 垂直方向の解像度をピクセル/メートルで示す。 |
| biClrUsed | DWORD | 4 | +32 | +32 | 実際に使用するカラーパレットの色数を示す。0は最大数を意味する。 |
| biClrImportant | DWORD | 4 | +36 | +36 | 重要な色の数を示す。0はすべて重要を意味する。 |
各言語での定義
#include <windows.h>
// 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;using System;
using System.Runtime.InteropServices;
[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;
}Imports System.Runtime.InteropServices
<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 Structureimport ctypes
from ctypes import wintypes
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),
]#[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,
}import "golang.org/x/sys/windows"
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_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;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,
};type
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: uint32struct KS_BITMAPINFOHEADER
{
uint biSize;
int biWidth;
int biHeight;
ushort biPlanes;
ushort biBitCount;
uint biCompression;
uint biSizeImage;
int biXPelsPerMeter;
int biYPelsPerMeter;
uint biClrUsed;
uint biClrImportant;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; KS_BITMAPINFOHEADER サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; biSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; biWidth : INT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; biHeight : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; biPlanes : WORD (+12, 2byte) wpoke st,12,値 / 値 = wpeek(st,12)
; biBitCount : WORD (+14, 2byte) wpoke st,14,値 / 値 = wpeek(st,14)
; biCompression : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; biSizeImage : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; biXPelsPerMeter : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; biYPelsPerMeter : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; biClrUsed : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; biClrImportant : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#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
stdim st, KS_BITMAPINFOHEADER ; NSTRUCT 変数を確保
st->biSize = 100
mes "biSize=" + st->biSize