ホーム › Graphics.Gdi › BITMAPCOREINFO
BITMAPCOREINFO
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| bmciHeader | BITMAPCOREHEADER | 12 | +0 | +0 | ビットマップの寸法・色情報を表すBITMAPCOREHEADER。 |
| bmciColors | RGBTRIPLE | 3 | +12 | +12 | カラーテーブルのRGBTRIPLE配列。 |
各言語での定義
#include <windows.h>
// BITMAPCOREHEADER (x64 12 / x86 12 バイト)
typedef struct BITMAPCOREHEADER {
DWORD bcSize;
WORD bcWidth;
WORD bcHeight;
WORD bcPlanes;
WORD bcBitCount;
} BITMAPCOREHEADER;
// RGBTRIPLE (x64 3 / x86 3 バイト)
typedef struct RGBTRIPLE {
BYTE rgbtBlue;
BYTE rgbtGreen;
BYTE rgbtRed;
} RGBTRIPLE;
// BITMAPCOREINFO (x64 16 / x86 16 バイト)
typedef struct BITMAPCOREINFO {
BITMAPCOREHEADER bmciHeader;
RGBTRIPLE bmciColors[1];
} BITMAPCOREINFO;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BITMAPCOREHEADER
{
public uint bcSize;
public ushort bcWidth;
public ushort bcHeight;
public ushort bcPlanes;
public ushort bcBitCount;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RGBTRIPLE
{
public byte rgbtBlue;
public byte rgbtGreen;
public byte rgbtRed;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BITMAPCOREINFO
{
public BITMAPCOREHEADER bmciHeader;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public RGBTRIPLE[] bmciColors;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BITMAPCOREHEADER
Public bcSize As UInteger
Public bcWidth As UShort
Public bcHeight As UShort
Public bcPlanes As UShort
Public bcBitCount As UShort
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RGBTRIPLE
Public rgbtBlue As Byte
Public rgbtGreen As Byte
Public rgbtRed As Byte
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BITMAPCOREINFO
Public bmciHeader As BITMAPCOREHEADER
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public bmciColors() As RGBTRIPLE
End Structureimport ctypes
from ctypes import wintypes
class BITMAPCOREHEADER(ctypes.Structure):
_fields_ = [
("bcSize", wintypes.DWORD),
("bcWidth", ctypes.c_ushort),
("bcHeight", ctypes.c_ushort),
("bcPlanes", ctypes.c_ushort),
("bcBitCount", ctypes.c_ushort),
]
class RGBTRIPLE(ctypes.Structure):
_fields_ = [
("rgbtBlue", ctypes.c_ubyte),
("rgbtGreen", ctypes.c_ubyte),
("rgbtRed", ctypes.c_ubyte),
]
class BITMAPCOREINFO(ctypes.Structure):
_fields_ = [
("bmciHeader", BITMAPCOREHEADER),
("bmciColors", RGBTRIPLE * 1),
]#[repr(C)]
pub struct BITMAPCOREHEADER {
pub bcSize: u32,
pub bcWidth: u16,
pub bcHeight: u16,
pub bcPlanes: u16,
pub bcBitCount: u16,
}
#[repr(C)]
pub struct RGBTRIPLE {
pub rgbtBlue: u8,
pub rgbtGreen: u8,
pub rgbtRed: u8,
}
#[repr(C)]
pub struct BITMAPCOREINFO {
pub bmciHeader: BITMAPCOREHEADER,
pub bmciColors: [RGBTRIPLE; 1],
}import "golang.org/x/sys/windows"
type BITMAPCOREHEADER struct {
bcSize uint32
bcWidth uint16
bcHeight uint16
bcPlanes uint16
bcBitCount uint16
}
type RGBTRIPLE struct {
rgbtBlue byte
rgbtGreen byte
rgbtRed byte
}
type BITMAPCOREINFO struct {
bmciHeader BITMAPCOREHEADER
bmciColors [1]RGBTRIPLE
}type
BITMAPCOREHEADER = record
bcSize: DWORD;
bcWidth: Word;
bcHeight: Word;
bcPlanes: Word;
bcBitCount: Word;
end;
RGBTRIPLE = record
rgbtBlue: Byte;
rgbtGreen: Byte;
rgbtRed: Byte;
end;
BITMAPCOREINFO = record
bmciHeader: BITMAPCOREHEADER;
bmciColors: array[0..0] of RGBTRIPLE;
end;const BITMAPCOREHEADER = extern struct {
bcSize: u32,
bcWidth: u16,
bcHeight: u16,
bcPlanes: u16,
bcBitCount: u16,
};
const RGBTRIPLE = extern struct {
rgbtBlue: u8,
rgbtGreen: u8,
rgbtRed: u8,
};
const BITMAPCOREINFO = extern struct {
bmciHeader: BITMAPCOREHEADER,
bmciColors: [1]RGBTRIPLE,
};type
BITMAPCOREHEADER {.bycopy.} = object
bcSize: uint32
bcWidth: uint16
bcHeight: uint16
bcPlanes: uint16
bcBitCount: uint16
RGBTRIPLE {.bycopy.} = object
rgbtBlue: uint8
rgbtGreen: uint8
rgbtRed: uint8
BITMAPCOREINFO {.bycopy.} = object
bmciHeader: BITMAPCOREHEADER
bmciColors: array[1, RGBTRIPLE]struct BITMAPCOREHEADER
{
uint bcSize;
ushort bcWidth;
ushort bcHeight;
ushort bcPlanes;
ushort bcBitCount;
}
struct RGBTRIPLE
{
ubyte rgbtBlue;
ubyte rgbtGreen;
ubyte rgbtRed;
}
struct BITMAPCOREINFO
{
BITMAPCOREHEADER bmciHeader;
RGBTRIPLE[1] bmciColors;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BITMAPCOREINFO サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; bmciHeader : BITMAPCOREHEADER (+0, 12byte) varptr(st)+0 を基点に操作(12byte:入れ子/配列)
; bmciColors : RGBTRIPLE (+12, 3byte) varptr(st)+12 を基点に操作(3byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global BITMAPCOREHEADER
#field int bcSize
#field short bcWidth
#field short bcHeight
#field short bcPlanes
#field short bcBitCount
#endstruct
#defstruct global RGBTRIPLE
#field byte rgbtBlue
#field byte rgbtGreen
#field byte rgbtRed
#endstruct
#defstruct global BITMAPCOREINFO
#field BITMAPCOREHEADER bmciHeader
#field RGBTRIPLE bmciColors 1
#endstruct
stdim st, BITMAPCOREINFO ; NSTRUCT 変数を確保