ホーム › UI.ColorSystem › EMRCREATECOLORSPACEW
EMRCREATECOLORSPACEW
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| emr | EMR | 8 | +0 | +0 | 拡張メタファイルレコード共通ヘッダー。 |
| ihCS | DWORD | 4 | +8 | +8 | メタファイル内の色空間ハンドルインデックス。 |
| lcs | LOGCOLORSPACEW | 588 | +12 | +12 | 作成する論理色空間を定義するLOGCOLORSPACEW構造体。 |
| dwFlags | DWORD | 4 | +600 | +600 | 色空間作成時の動作を制御するフラグ群。 |
| cbData | DWORD | 4 | +604 | +604 | Data配列の有効データサイズ(バイト)。 |
| Data | BYTE | 1 | +608 | +608 | 埋め込みカラープロファイルデータの先頭バイト(可変長)。 |
各言語での定義
#include <windows.h>
// EMR (x64 8 / x86 8 バイト)
typedef struct EMR {
ENHANCED_METAFILE_RECORD_TYPE iType;
DWORD nSize;
} EMR;
// 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;
// LOGCOLORSPACEW (x64 588 / x86 588 バイト)
typedef struct LOGCOLORSPACEW {
DWORD lcsSignature;
DWORD lcsVersion;
DWORD lcsSize;
LCSCSTYPE lcsCSType;
INT lcsIntent;
CIEXYZTRIPLE lcsEndpoints;
DWORD lcsGammaRed;
DWORD lcsGammaGreen;
DWORD lcsGammaBlue;
WCHAR lcsFilename[260];
} LOGCOLORSPACEW;
// EMRCREATECOLORSPACEW (x64 612 / x86 612 バイト)
typedef struct EMRCREATECOLORSPACEW {
EMR emr;
DWORD ihCS;
LOGCOLORSPACEW lcs;
DWORD dwFlags;
DWORD cbData;
BYTE Data[1];
} EMRCREATECOLORSPACEW;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EMR
{
public uint iType;
public uint nSize;
}
[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 LOGCOLORSPACEW
{
public uint lcsSignature;
public uint lcsVersion;
public uint lcsSize;
public int lcsCSType;
public int lcsIntent;
public CIEXYZTRIPLE lcsEndpoints;
public uint lcsGammaRed;
public uint lcsGammaGreen;
public uint lcsGammaBlue;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string lcsFilename;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EMRCREATECOLORSPACEW
{
public EMR emr;
public uint ihCS;
public LOGCOLORSPACEW lcs;
public uint dwFlags;
public uint cbData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] Data;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EMR
Public iType As UInteger
Public nSize As UInteger
End Structure
<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 LOGCOLORSPACEW
Public lcsSignature As UInteger
Public lcsVersion As UInteger
Public lcsSize As UInteger
Public lcsCSType As Integer
Public lcsIntent As Integer
Public lcsEndpoints As CIEXYZTRIPLE
Public lcsGammaRed As UInteger
Public lcsGammaGreen As UInteger
Public lcsGammaBlue As UInteger
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> Public lcsFilename As String
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EMRCREATECOLORSPACEW
Public emr As EMR
Public ihCS As UInteger
Public lcs As LOGCOLORSPACEW
Public dwFlags As UInteger
Public cbData As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public Data() As Byte
End Structureimport ctypes
from ctypes import wintypes
class EMR(ctypes.Structure):
_fields_ = [
("iType", wintypes.DWORD),
("nSize", wintypes.DWORD),
]
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 LOGCOLORSPACEW(ctypes.Structure):
_fields_ = [
("lcsSignature", wintypes.DWORD),
("lcsVersion", wintypes.DWORD),
("lcsSize", wintypes.DWORD),
("lcsCSType", ctypes.c_int),
("lcsIntent", ctypes.c_int),
("lcsEndpoints", CIEXYZTRIPLE),
("lcsGammaRed", wintypes.DWORD),
("lcsGammaGreen", wintypes.DWORD),
("lcsGammaBlue", wintypes.DWORD),
("lcsFilename", ctypes.c_wchar * 260),
]
class EMRCREATECOLORSPACEW(ctypes.Structure):
_fields_ = [
("emr", EMR),
("ihCS", wintypes.DWORD),
("lcs", LOGCOLORSPACEW),
("dwFlags", wintypes.DWORD),
("cbData", wintypes.DWORD),
("Data", ctypes.c_ubyte * 1),
]#[repr(C)]
pub struct EMR {
pub iType: u32,
pub nSize: u32,
}
#[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 LOGCOLORSPACEW {
pub lcsSignature: u32,
pub lcsVersion: u32,
pub lcsSize: u32,
pub lcsCSType: i32,
pub lcsIntent: i32,
pub lcsEndpoints: CIEXYZTRIPLE,
pub lcsGammaRed: u32,
pub lcsGammaGreen: u32,
pub lcsGammaBlue: u32,
pub lcsFilename: [u16; 260],
}
#[repr(C)]
pub struct EMRCREATECOLORSPACEW {
pub emr: EMR,
pub ihCS: u32,
pub lcs: LOGCOLORSPACEW,
pub dwFlags: u32,
pub cbData: u32,
pub Data: [u8; 1],
}import "golang.org/x/sys/windows"
type EMR struct {
iType uint32
nSize uint32
}
type CIEXYZ struct {
ciexyzX int32
ciexyzY int32
ciexyzZ int32
}
type CIEXYZTRIPLE struct {
ciexyzRed CIEXYZ
ciexyzGreen CIEXYZ
ciexyzBlue CIEXYZ
}
type LOGCOLORSPACEW struct {
lcsSignature uint32
lcsVersion uint32
lcsSize uint32
lcsCSType int32
lcsIntent int32
lcsEndpoints CIEXYZTRIPLE
lcsGammaRed uint32
lcsGammaGreen uint32
lcsGammaBlue uint32
lcsFilename [260]uint16
}
type EMRCREATECOLORSPACEW struct {
emr EMR
ihCS uint32
lcs LOGCOLORSPACEW
dwFlags uint32
cbData uint32
Data [1]byte
}type
EMR = record
iType: DWORD;
nSize: DWORD;
end;
CIEXYZ = record
ciexyzX: Integer;
ciexyzY: Integer;
ciexyzZ: Integer;
end;
CIEXYZTRIPLE = record
ciexyzRed: CIEXYZ;
ciexyzGreen: CIEXYZ;
ciexyzBlue: CIEXYZ;
end;
LOGCOLORSPACEW = record
lcsSignature: DWORD;
lcsVersion: DWORD;
lcsSize: DWORD;
lcsCSType: Integer;
lcsIntent: Integer;
lcsEndpoints: CIEXYZTRIPLE;
lcsGammaRed: DWORD;
lcsGammaGreen: DWORD;
lcsGammaBlue: DWORD;
lcsFilename: array[0..259] of WideChar;
end;
EMRCREATECOLORSPACEW = record
emr: EMR;
ihCS: DWORD;
lcs: LOGCOLORSPACEW;
dwFlags: DWORD;
cbData: DWORD;
Data: array[0..0] of Byte;
end;const EMR = extern struct {
iType: u32,
nSize: u32,
};
const CIEXYZ = extern struct {
ciexyzX: i32,
ciexyzY: i32,
ciexyzZ: i32,
};
const CIEXYZTRIPLE = extern struct {
ciexyzRed: CIEXYZ,
ciexyzGreen: CIEXYZ,
ciexyzBlue: CIEXYZ,
};
const LOGCOLORSPACEW = extern struct {
lcsSignature: u32,
lcsVersion: u32,
lcsSize: u32,
lcsCSType: i32,
lcsIntent: i32,
lcsEndpoints: CIEXYZTRIPLE,
lcsGammaRed: u32,
lcsGammaGreen: u32,
lcsGammaBlue: u32,
lcsFilename: [260]u16,
};
const EMRCREATECOLORSPACEW = extern struct {
emr: EMR,
ihCS: u32,
lcs: LOGCOLORSPACEW,
dwFlags: u32,
cbData: u32,
Data: [1]u8,
};type
EMR {.bycopy.} = object
iType: uint32
nSize: uint32
CIEXYZ {.bycopy.} = object
ciexyzX: int32
ciexyzY: int32
ciexyzZ: int32
CIEXYZTRIPLE {.bycopy.} = object
ciexyzRed: CIEXYZ
ciexyzGreen: CIEXYZ
ciexyzBlue: CIEXYZ
LOGCOLORSPACEW {.bycopy.} = object
lcsSignature: uint32
lcsVersion: uint32
lcsSize: uint32
lcsCSType: int32
lcsIntent: int32
lcsEndpoints: CIEXYZTRIPLE
lcsGammaRed: uint32
lcsGammaGreen: uint32
lcsGammaBlue: uint32
lcsFilename: array[260, uint16]
EMRCREATECOLORSPACEW {.bycopy.} = object
emr: EMR
ihCS: uint32
lcs: LOGCOLORSPACEW
dwFlags: uint32
cbData: uint32
Data: array[1, uint8]struct EMR
{
uint iType;
uint nSize;
}
struct CIEXYZ
{
int ciexyzX;
int ciexyzY;
int ciexyzZ;
}
struct CIEXYZTRIPLE
{
CIEXYZ ciexyzRed;
CIEXYZ ciexyzGreen;
CIEXYZ ciexyzBlue;
}
struct LOGCOLORSPACEW
{
uint lcsSignature;
uint lcsVersion;
uint lcsSize;
int lcsCSType;
int lcsIntent;
CIEXYZTRIPLE lcsEndpoints;
uint lcsGammaRed;
uint lcsGammaGreen;
uint lcsGammaBlue;
wchar[260] lcsFilename;
}
struct EMRCREATECOLORSPACEW
{
EMR emr;
uint ihCS;
LOGCOLORSPACEW lcs;
uint dwFlags;
uint cbData;
ubyte[1] Data;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRCREATECOLORSPACEW サイズ: 612 バイト(x64)
dim st, 153 ; 4byte整数×153(構造体サイズ 612 / 4 切り上げ)
; emr : EMR (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ihCS : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; lcs : LOGCOLORSPACEW (+12, 588byte) varptr(st)+12 を基点に操作(588byte:入れ子/配列)
; dwFlags : DWORD (+600, 4byte) st.150 = 値 / 値 = st.150 (lpoke/lpeek も可)
; cbData : DWORD (+604, 4byte) st.151 = 値 / 値 = st.151 (lpoke/lpeek も可)
; Data : BYTE (+608, 1byte) varptr(st)+608 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global EMR
#field int iType
#field int nSize
#endstruct
#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 LOGCOLORSPACEW
#field int lcsSignature
#field int lcsVersion
#field int lcsSize
#field int lcsCSType
#field int lcsIntent
#field CIEXYZTRIPLE lcsEndpoints
#field int lcsGammaRed
#field int lcsGammaGreen
#field int lcsGammaBlue
#field wchar lcsFilename 260
#endstruct
#defstruct global EMRCREATECOLORSPACEW
#field EMR emr
#field int ihCS
#field LOGCOLORSPACEW lcs
#field int dwFlags
#field int cbData
#field byte Data 1
#endstruct
stdim st, EMRCREATECOLORSPACEW ; NSTRUCT 変数を確保
st->ihCS = 100
mes "ihCS=" + st->ihCS