サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
コピー #include <windows.h>
// DDCOLORKEY (x64 8 / x86 8 バイト)
typedef struct DDCOLORKEY {
DWORD dwColorSpaceLowValue;
DWORD dwColorSpaceHighValue;
} DDCOLORKEY;
// DDBLTFX (x64 128 / x86 100 バイト)
typedef struct DDBLTFX {
DWORD dwSize;
DWORD dwDDFX;
DWORD dwROP;
DWORD dwDDROP;
DWORD dwRotationAngle;
DWORD dwZBufferOpCode;
DWORD dwZBufferLow;
DWORD dwZBufferHigh;
DWORD dwZBufferBaseDest;
DWORD dwZDestConstBitDepth;
_Anonymous1_e__Union Anonymous1;
DWORD dwZSrcConstBitDepth;
_Anonymous2_e__Union Anonymous2;
DWORD dwAlphaEdgeBlendBitDepth;
DWORD dwAlphaEdgeBlend;
DWORD dwReserved;
DWORD dwAlphaDestConstBitDepth;
_Anonymous3_e__Union Anonymous3;
DWORD dwAlphaSrcConstBitDepth;
_Anonymous4_e__Union Anonymous4;
_Anonymous5_e__Union Anonymous5;
DDCOLORKEY ddckDestColorkey;
DDCOLORKEY ddckSrcColorkey;
} DDBLTFX;コピー using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDCOLORKEY
{
public uint dwColorSpaceLowValue;
public uint dwColorSpaceHighValue;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDBLTFX
{
public uint dwSize;
public uint dwDDFX;
public uint dwROP;
public uint dwDDROP;
public uint dwRotationAngle;
public uint dwZBufferOpCode;
public uint dwZBufferLow;
public uint dwZBufferHigh;
public uint dwZBufferBaseDest;
public uint dwZDestConstBitDepth;
public _Anonymous1_e__Union Anonymous1;
public uint dwZSrcConstBitDepth;
public _Anonymous2_e__Union Anonymous2;
public uint dwAlphaEdgeBlendBitDepth;
public uint dwAlphaEdgeBlend;
public uint dwReserved;
public uint dwAlphaDestConstBitDepth;
public _Anonymous3_e__Union Anonymous3;
public uint dwAlphaSrcConstBitDepth;
public _Anonymous4_e__Union Anonymous4;
public _Anonymous5_e__Union Anonymous5;
public DDCOLORKEY ddckDestColorkey;
public DDCOLORKEY ddckSrcColorkey;
}コピー Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDCOLORKEY
Public dwColorSpaceLowValue As UInteger
Public dwColorSpaceHighValue As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDBLTFX
Public dwSize As UInteger
Public dwDDFX As UInteger
Public dwROP As UInteger
Public dwDDROP As UInteger
Public dwRotationAngle As UInteger
Public dwZBufferOpCode As UInteger
Public dwZBufferLow As UInteger
Public dwZBufferHigh As UInteger
Public dwZBufferBaseDest As UInteger
Public dwZDestConstBitDepth As UInteger
Public Anonymous1 As _Anonymous1_e__Union
Public dwZSrcConstBitDepth As UInteger
Public Anonymous2 As _Anonymous2_e__Union
Public dwAlphaEdgeBlendBitDepth As UInteger
Public dwAlphaEdgeBlend As UInteger
Public dwReserved As UInteger
Public dwAlphaDestConstBitDepth As UInteger
Public Anonymous3 As _Anonymous3_e__Union
Public dwAlphaSrcConstBitDepth As UInteger
Public Anonymous4 As _Anonymous4_e__Union
Public Anonymous5 As _Anonymous5_e__Union
Public ddckDestColorkey As DDCOLORKEY
Public ddckSrcColorkey As DDCOLORKEY
End Structureコピー import ctypes
from ctypes import wintypes
class DDCOLORKEY(ctypes.Structure):
_fields_ = [
("dwColorSpaceLowValue", wintypes.DWORD),
("dwColorSpaceHighValue", wintypes.DWORD),
]
class DDBLTFX(ctypes.Structure):
_fields_ = [
("dwSize", wintypes.DWORD),
("dwDDFX", wintypes.DWORD),
("dwROP", wintypes.DWORD),
("dwDDROP", wintypes.DWORD),
("dwRotationAngle", wintypes.DWORD),
("dwZBufferOpCode", wintypes.DWORD),
("dwZBufferLow", wintypes.DWORD),
("dwZBufferHigh", wintypes.DWORD),
("dwZBufferBaseDest", wintypes.DWORD),
("dwZDestConstBitDepth", wintypes.DWORD),
("Anonymous1", _Anonymous1_e__Union),
("dwZSrcConstBitDepth", wintypes.DWORD),
("Anonymous2", _Anonymous2_e__Union),
("dwAlphaEdgeBlendBitDepth", wintypes.DWORD),
("dwAlphaEdgeBlend", wintypes.DWORD),
("dwReserved", wintypes.DWORD),
("dwAlphaDestConstBitDepth", wintypes.DWORD),
("Anonymous3", _Anonymous3_e__Union),
("dwAlphaSrcConstBitDepth", wintypes.DWORD),
("Anonymous4", _Anonymous4_e__Union),
("Anonymous5", _Anonymous5_e__Union),
("ddckDestColorkey", DDCOLORKEY),
("ddckSrcColorkey", DDCOLORKEY),
]コピー #[repr(C)]
pub struct DDCOLORKEY {
pub dwColorSpaceLowValue: u32,
pub dwColorSpaceHighValue: u32,
}
#[repr(C)]
pub struct DDBLTFX {
pub dwSize: u32,
pub dwDDFX: u32,
pub dwROP: u32,
pub dwDDROP: u32,
pub dwRotationAngle: u32,
pub dwZBufferOpCode: u32,
pub dwZBufferLow: u32,
pub dwZBufferHigh: u32,
pub dwZBufferBaseDest: u32,
pub dwZDestConstBitDepth: u32,
pub Anonymous1: _Anonymous1_e__Union,
pub dwZSrcConstBitDepth: u32,
pub Anonymous2: _Anonymous2_e__Union,
pub dwAlphaEdgeBlendBitDepth: u32,
pub dwAlphaEdgeBlend: u32,
pub dwReserved: u32,
pub dwAlphaDestConstBitDepth: u32,
pub Anonymous3: _Anonymous3_e__Union,
pub dwAlphaSrcConstBitDepth: u32,
pub Anonymous4: _Anonymous4_e__Union,
pub Anonymous5: _Anonymous5_e__Union,
pub ddckDestColorkey: DDCOLORKEY,
pub ddckSrcColorkey: DDCOLORKEY,
}コピー import "golang.org/x/sys/windows"
type DDCOLORKEY struct {
dwColorSpaceLowValue uint32
dwColorSpaceHighValue uint32
}
type DDBLTFX struct {
dwSize uint32
dwDDFX uint32
dwROP uint32
dwDDROP uint32
dwRotationAngle uint32
dwZBufferOpCode uint32
dwZBufferLow uint32
dwZBufferHigh uint32
dwZBufferBaseDest uint32
dwZDestConstBitDepth uint32
Anonymous1 _Anonymous1_e__Union
dwZSrcConstBitDepth uint32
Anonymous2 _Anonymous2_e__Union
dwAlphaEdgeBlendBitDepth uint32
dwAlphaEdgeBlend uint32
dwReserved uint32
dwAlphaDestConstBitDepth uint32
Anonymous3 _Anonymous3_e__Union
dwAlphaSrcConstBitDepth uint32
Anonymous4 _Anonymous4_e__Union
Anonymous5 _Anonymous5_e__Union
ddckDestColorkey DDCOLORKEY
ddckSrcColorkey DDCOLORKEY
}コピー type
DDCOLORKEY = record
dwColorSpaceLowValue: DWORD;
dwColorSpaceHighValue: DWORD;
end;
DDBLTFX = record
dwSize: DWORD;
dwDDFX: DWORD;
dwROP: DWORD;
dwDDROP: DWORD;
dwRotationAngle: DWORD;
dwZBufferOpCode: DWORD;
dwZBufferLow: DWORD;
dwZBufferHigh: DWORD;
dwZBufferBaseDest: DWORD;
dwZDestConstBitDepth: DWORD;
Anonymous1: _Anonymous1_e__Union;
dwZSrcConstBitDepth: DWORD;
Anonymous2: _Anonymous2_e__Union;
dwAlphaEdgeBlendBitDepth: DWORD;
dwAlphaEdgeBlend: DWORD;
dwReserved: DWORD;
dwAlphaDestConstBitDepth: DWORD;
Anonymous3: _Anonymous3_e__Union;
dwAlphaSrcConstBitDepth: DWORD;
Anonymous4: _Anonymous4_e__Union;
Anonymous5: _Anonymous5_e__Union;
ddckDestColorkey: DDCOLORKEY;
ddckSrcColorkey: DDCOLORKEY;
end;コピー const DDCOLORKEY = extern struct {
dwColorSpaceLowValue: u32,
dwColorSpaceHighValue: u32,
};
const DDBLTFX = extern struct {
dwSize: u32,
dwDDFX: u32,
dwROP: u32,
dwDDROP: u32,
dwRotationAngle: u32,
dwZBufferOpCode: u32,
dwZBufferLow: u32,
dwZBufferHigh: u32,
dwZBufferBaseDest: u32,
dwZDestConstBitDepth: u32,
Anonymous1: _Anonymous1_e__Union,
dwZSrcConstBitDepth: u32,
Anonymous2: _Anonymous2_e__Union,
dwAlphaEdgeBlendBitDepth: u32,
dwAlphaEdgeBlend: u32,
dwReserved: u32,
dwAlphaDestConstBitDepth: u32,
Anonymous3: _Anonymous3_e__Union,
dwAlphaSrcConstBitDepth: u32,
Anonymous4: _Anonymous4_e__Union,
Anonymous5: _Anonymous5_e__Union,
ddckDestColorkey: DDCOLORKEY,
ddckSrcColorkey: DDCOLORKEY,
};コピー type
DDCOLORKEY {.bycopy.} = object
dwColorSpaceLowValue: uint32
dwColorSpaceHighValue: uint32
DDBLTFX {.bycopy.} = object
dwSize: uint32
dwDDFX: uint32
dwROP: uint32
dwDDROP: uint32
dwRotationAngle: uint32
dwZBufferOpCode: uint32
dwZBufferLow: uint32
dwZBufferHigh: uint32
dwZBufferBaseDest: uint32
dwZDestConstBitDepth: uint32
Anonymous1: _Anonymous1_e__Union
dwZSrcConstBitDepth: uint32
Anonymous2: _Anonymous2_e__Union
dwAlphaEdgeBlendBitDepth: uint32
dwAlphaEdgeBlend: uint32
dwReserved: uint32
dwAlphaDestConstBitDepth: uint32
Anonymous3: _Anonymous3_e__Union
dwAlphaSrcConstBitDepth: uint32
Anonymous4: _Anonymous4_e__Union
Anonymous5: _Anonymous5_e__Union
ddckDestColorkey: DDCOLORKEY
ddckSrcColorkey: DDCOLORKEYコピー struct DDCOLORKEY
{
uint dwColorSpaceLowValue;
uint dwColorSpaceHighValue;
}
struct DDBLTFX
{
uint dwSize;
uint dwDDFX;
uint dwROP;
uint dwDDROP;
uint dwRotationAngle;
uint dwZBufferOpCode;
uint dwZBufferLow;
uint dwZBufferHigh;
uint dwZBufferBaseDest;
uint dwZDestConstBitDepth;
_Anonymous1_e__Union Anonymous1;
uint dwZSrcConstBitDepth;
_Anonymous2_e__Union Anonymous2;
uint dwAlphaEdgeBlendBitDepth;
uint dwAlphaEdgeBlend;
uint dwReserved;
uint dwAlphaDestConstBitDepth;
_Anonymous3_e__Union Anonymous3;
uint dwAlphaSrcConstBitDepth;
_Anonymous4_e__Union Anonymous4;
_Anonymous5_e__Union Anonymous5;
DDCOLORKEY ddckDestColorkey;
DDCOLORKEY ddckSrcColorkey;
}HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT (#defstruct/stdim/->)で32/64bit共通。
コピー ; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DDBLTFX サイズ: 100 バイト(x86)
dim st, 25 ; 4byte整数×25(構造体サイズ 100 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwDDFX : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwROP : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwDDROP : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwRotationAngle : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwZBufferOpCode : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwZBufferLow : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwZBufferHigh : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwZBufferBaseDest : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwZDestConstBitDepth : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; Anonymous1 : _Anonymous1_e__Union (+40, 4byte) varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; dwZSrcConstBitDepth : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+48, 4byte) varptr(st)+48 を基点に操作(4byte:入れ子/配列)
; dwAlphaEdgeBlendBitDepth : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; dwAlphaEdgeBlend : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; dwReserved : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; dwAlphaDestConstBitDepth : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; Anonymous3 : _Anonymous3_e__Union (+68, 4byte) varptr(st)+68 を基点に操作(4byte:入れ子/配列)
; dwAlphaSrcConstBitDepth : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; Anonymous4 : _Anonymous4_e__Union (+76, 4byte) varptr(st)+76 を基点に操作(4byte:入れ子/配列)
; Anonymous5 : _Anonymous5_e__Union (+80, 4byte) varptr(st)+80 を基点に操作(4byte:入れ子/配列)
; ddckDestColorkey : DDCOLORKEY (+84, 8byte) varptr(st)+84 を基点に操作(8byte:入れ子/配列)
; ddckSrcColorkey : DDCOLORKEY (+92, 8byte) varptr(st)+92 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。コピー ; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDBLTFX サイズ: 128 バイト(x64)
dim st, 32 ; 4byte整数×32(構造体サイズ 128 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwDDFX : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dwROP : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; dwDDROP : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; dwRotationAngle : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; dwZBufferOpCode : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; dwZBufferLow : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; dwZBufferHigh : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; dwZBufferBaseDest : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; dwZDestConstBitDepth : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; Anonymous1 : _Anonymous1_e__Union (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; dwZSrcConstBitDepth : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; Anonymous2 : _Anonymous2_e__Union (+56, 8byte) varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; dwAlphaEdgeBlendBitDepth : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwAlphaEdgeBlend : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; dwReserved : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; dwAlphaDestConstBitDepth : DWORD (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; Anonymous3 : _Anonymous3_e__Union (+80, 8byte) varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; dwAlphaSrcConstBitDepth : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; Anonymous4 : _Anonymous4_e__Union (+96, 8byte) varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; Anonymous5 : _Anonymous5_e__Union (+104, 8byte) varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; ddckDestColorkey : DDCOLORKEY (+112, 8byte) varptr(st)+112 を基点に操作(8byte:入れ子/配列)
; ddckSrcColorkey : DDCOLORKEY (+120, 8byte) varptr(st)+120 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。コピー ; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DDCOLORKEY
#field int dwColorSpaceLowValue
#field int dwColorSpaceHighValue
#endstruct
#defstruct global DDBLTFX
#field int dwSize
#field int dwDDFX
#field int dwROP
#field int dwDDROP
#field int dwRotationAngle
#field int dwZBufferOpCode
#field int dwZBufferLow
#field int dwZBufferHigh
#field int dwZBufferBaseDest
#field int dwZDestConstBitDepth
#field byte Anonymous1 8
#field int dwZSrcConstBitDepth
#field byte Anonymous2 8
#field int dwAlphaEdgeBlendBitDepth
#field int dwAlphaEdgeBlend
#field int dwReserved
#field int dwAlphaDestConstBitDepth
#field byte Anonymous3 8
#field int dwAlphaSrcConstBitDepth
#field byte Anonymous4 8
#field byte Anonymous5 8
#field DDCOLORKEY ddckDestColorkey
#field DDCOLORKEY ddckSrcColorkey
#endstruct
stdim st, DDBLTFX ; NSTRUCT 変数を確保
st->dwSize = 100
mes "dwSize=" + st->dwSize
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。