ホーム › Graphics.Gdi › EMRTRANSPARENTBLT
EMRTRANSPARENTBLT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| emr | EMR | 8 | +0 | +0 | 共通レコードヘッダを表すEMR構造体。 |
| rclBounds | RECTL | 16 | +8 | +8 | 影響を受ける領域の外接矩形を表すRECTL構造体。 |
| xDest | INT | 4 | +24 | +24 | 転送先矩形の左上X座標を表す。 |
| yDest | INT | 4 | +28 | +28 | 転送先矩形の左上Y座標を表す。 |
| cxDest | INT | 4 | +32 | +32 | 転送先矩形の幅を表す。 |
| cyDest | INT | 4 | +36 | +36 | 転送先矩形の高さを表す。 |
| dwRop | DWORD | 4 | +40 | +40 | 透明色(透過対象の色)を格納するフィールド。 |
| xSrc | INT | 4 | +44 | +44 | 転送元矩形の左上X座標を表す。 |
| ySrc | INT | 4 | +48 | +48 | 転送元矩形の左上Y座標を表す。 |
| xformSrc | XFORM | 24 | +52 | +52 | 転送元に適用するワールド変換を表すXFORM構造体。 |
| crBkColorSrc | COLORREF | 4 | +76 | +76 | 転送元の背景色を表すCOLORREF値。 |
| iUsageSrc | DWORD | 4 | +80 | +80 | ビットマップ情報のカラーテーブル形式を表す。 |
| offBmiSrc | DWORD | 4 | +84 | +84 | レコード先頭からソースBITMAPINFOへのオフセットをバイト単位で表す。 |
| cbBmiSrc | DWORD | 4 | +88 | +88 | ソースBITMAPINFOのサイズをバイト単位で表す。 |
| offBitsSrc | DWORD | 4 | +92 | +92 | レコード先頭からソースビットデータへのオフセットをバイト単位で表す。 |
| cbBitsSrc | DWORD | 4 | +96 | +96 | ソースビットデータのサイズをバイト単位で表す。 |
| cxSrc | INT | 4 | +100 | +100 | 転送元矩形の幅を表す。 |
| cySrc | INT | 4 | +104 | +104 | 転送元矩形の高さを表す。 |
各言語での定義
#include <windows.h>
// EMR (x64 8 / x86 8 バイト)
typedef struct EMR {
ENHANCED_METAFILE_RECORD_TYPE iType;
DWORD nSize;
} EMR;
// RECTL (x64 16 / x86 16 バイト)
typedef struct RECTL {
INT left;
INT top;
INT right;
INT bottom;
} RECTL;
// XFORM (x64 24 / x86 24 バイト)
typedef struct XFORM {
FLOAT eM11;
FLOAT eM12;
FLOAT eM21;
FLOAT eM22;
FLOAT eDx;
FLOAT eDy;
} XFORM;
// EMRTRANSPARENTBLT (x64 108 / x86 108 バイト)
typedef struct EMRTRANSPARENTBLT {
EMR emr;
RECTL rclBounds;
INT xDest;
INT yDest;
INT cxDest;
INT cyDest;
DWORD dwRop;
INT xSrc;
INT ySrc;
XFORM xformSrc;
COLORREF crBkColorSrc;
DWORD iUsageSrc;
DWORD offBmiSrc;
DWORD cbBmiSrc;
DWORD offBitsSrc;
DWORD cbBitsSrc;
INT cxSrc;
INT cySrc;
} EMRTRANSPARENTBLT;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 RECTL
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XFORM
{
public float eM11;
public float eM12;
public float eM21;
public float eM22;
public float eDx;
public float eDy;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct EMRTRANSPARENTBLT
{
public EMR emr;
public RECTL rclBounds;
public int xDest;
public int yDest;
public int cxDest;
public int cyDest;
public uint dwRop;
public int xSrc;
public int ySrc;
public XFORM xformSrc;
public uint crBkColorSrc;
public uint iUsageSrc;
public uint offBmiSrc;
public uint cbBmiSrc;
public uint offBitsSrc;
public uint cbBitsSrc;
public int cxSrc;
public int cySrc;
}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 RECTL
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XFORM
Public eM11 As Single
Public eM12 As Single
Public eM21 As Single
Public eM22 As Single
Public eDx As Single
Public eDy As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure EMRTRANSPARENTBLT
Public emr As EMR
Public rclBounds As RECTL
Public xDest As Integer
Public yDest As Integer
Public cxDest As Integer
Public cyDest As Integer
Public dwRop As UInteger
Public xSrc As Integer
Public ySrc As Integer
Public xformSrc As XFORM
Public crBkColorSrc As UInteger
Public iUsageSrc As UInteger
Public offBmiSrc As UInteger
Public cbBmiSrc As UInteger
Public offBitsSrc As UInteger
Public cbBitsSrc As UInteger
Public cxSrc As Integer
Public cySrc As Integer
End Structureimport ctypes
from ctypes import wintypes
class EMR(ctypes.Structure):
_fields_ = [
("iType", wintypes.DWORD),
("nSize", wintypes.DWORD),
]
class RECTL(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class XFORM(ctypes.Structure):
_fields_ = [
("eM11", ctypes.c_float),
("eM12", ctypes.c_float),
("eM21", ctypes.c_float),
("eM22", ctypes.c_float),
("eDx", ctypes.c_float),
("eDy", ctypes.c_float),
]
class EMRTRANSPARENTBLT(ctypes.Structure):
_fields_ = [
("emr", EMR),
("rclBounds", RECTL),
("xDest", ctypes.c_int),
("yDest", ctypes.c_int),
("cxDest", ctypes.c_int),
("cyDest", ctypes.c_int),
("dwRop", wintypes.DWORD),
("xSrc", ctypes.c_int),
("ySrc", ctypes.c_int),
("xformSrc", XFORM),
("crBkColorSrc", wintypes.DWORD),
("iUsageSrc", wintypes.DWORD),
("offBmiSrc", wintypes.DWORD),
("cbBmiSrc", wintypes.DWORD),
("offBitsSrc", wintypes.DWORD),
("cbBitsSrc", wintypes.DWORD),
("cxSrc", ctypes.c_int),
("cySrc", ctypes.c_int),
]#[repr(C)]
pub struct EMR {
pub iType: u32,
pub nSize: u32,
}
#[repr(C)]
pub struct RECTL {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct XFORM {
pub eM11: f32,
pub eM12: f32,
pub eM21: f32,
pub eM22: f32,
pub eDx: f32,
pub eDy: f32,
}
#[repr(C)]
pub struct EMRTRANSPARENTBLT {
pub emr: EMR,
pub rclBounds: RECTL,
pub xDest: i32,
pub yDest: i32,
pub cxDest: i32,
pub cyDest: i32,
pub dwRop: u32,
pub xSrc: i32,
pub ySrc: i32,
pub xformSrc: XFORM,
pub crBkColorSrc: u32,
pub iUsageSrc: u32,
pub offBmiSrc: u32,
pub cbBmiSrc: u32,
pub offBitsSrc: u32,
pub cbBitsSrc: u32,
pub cxSrc: i32,
pub cySrc: i32,
}import "golang.org/x/sys/windows"
type EMR struct {
iType uint32
nSize uint32
}
type RECTL struct {
left int32
top int32
right int32
bottom int32
}
type XFORM struct {
eM11 float32
eM12 float32
eM21 float32
eM22 float32
eDx float32
eDy float32
}
type EMRTRANSPARENTBLT struct {
emr EMR
rclBounds RECTL
xDest int32
yDest int32
cxDest int32
cyDest int32
dwRop uint32
xSrc int32
ySrc int32
xformSrc XFORM
crBkColorSrc uint32
iUsageSrc uint32
offBmiSrc uint32
cbBmiSrc uint32
offBitsSrc uint32
cbBitsSrc uint32
cxSrc int32
cySrc int32
}type
EMR = record
iType: DWORD;
nSize: DWORD;
end;
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
XFORM = record
eM11: Single;
eM12: Single;
eM21: Single;
eM22: Single;
eDx: Single;
eDy: Single;
end;
EMRTRANSPARENTBLT = record
emr: EMR;
rclBounds: RECTL;
xDest: Integer;
yDest: Integer;
cxDest: Integer;
cyDest: Integer;
dwRop: DWORD;
xSrc: Integer;
ySrc: Integer;
xformSrc: XFORM;
crBkColorSrc: DWORD;
iUsageSrc: DWORD;
offBmiSrc: DWORD;
cbBmiSrc: DWORD;
offBitsSrc: DWORD;
cbBitsSrc: DWORD;
cxSrc: Integer;
cySrc: Integer;
end;const EMR = extern struct {
iType: u32,
nSize: u32,
};
const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const XFORM = extern struct {
eM11: f32,
eM12: f32,
eM21: f32,
eM22: f32,
eDx: f32,
eDy: f32,
};
const EMRTRANSPARENTBLT = extern struct {
emr: EMR,
rclBounds: RECTL,
xDest: i32,
yDest: i32,
cxDest: i32,
cyDest: i32,
dwRop: u32,
xSrc: i32,
ySrc: i32,
xformSrc: XFORM,
crBkColorSrc: u32,
iUsageSrc: u32,
offBmiSrc: u32,
cbBmiSrc: u32,
offBitsSrc: u32,
cbBitsSrc: u32,
cxSrc: i32,
cySrc: i32,
};type
EMR {.bycopy.} = object
iType: uint32
nSize: uint32
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
XFORM {.bycopy.} = object
eM11: float32
eM12: float32
eM21: float32
eM22: float32
eDx: float32
eDy: float32
EMRTRANSPARENTBLT {.bycopy.} = object
emr: EMR
rclBounds: RECTL
xDest: int32
yDest: int32
cxDest: int32
cyDest: int32
dwRop: uint32
xSrc: int32
ySrc: int32
xformSrc: XFORM
crBkColorSrc: uint32
iUsageSrc: uint32
offBmiSrc: uint32
cbBmiSrc: uint32
offBitsSrc: uint32
cbBitsSrc: uint32
cxSrc: int32
cySrc: int32struct EMR
{
uint iType;
uint nSize;
}
struct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct XFORM
{
float eM11;
float eM12;
float eM21;
float eM22;
float eDx;
float eDy;
}
struct EMRTRANSPARENTBLT
{
EMR emr;
RECTL rclBounds;
int xDest;
int yDest;
int cxDest;
int cyDest;
uint dwRop;
int xSrc;
int ySrc;
XFORM xformSrc;
uint crBkColorSrc;
uint iUsageSrc;
uint offBmiSrc;
uint cbBmiSrc;
uint offBitsSrc;
uint cbBitsSrc;
int cxSrc;
int cySrc;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRTRANSPARENTBLT サイズ: 108 バイト(x64)
dim st, 27 ; 4byte整数×27(構造体サイズ 108 / 4 切り上げ)
; emr : EMR (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; rclBounds : RECTL (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; xDest : INT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; yDest : INT (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cxDest : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; cyDest : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; dwRop : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; xSrc : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ySrc : INT (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; xformSrc : XFORM (+52, 24byte) varptr(st)+52 を基点に操作(24byte:入れ子/配列)
; crBkColorSrc : COLORREF (+76, 4byte) st.19 = 値 / 値 = st.19 (lpoke/lpeek も可)
; iUsageSrc : DWORD (+80, 4byte) st.20 = 値 / 値 = st.20 (lpoke/lpeek も可)
; offBmiSrc : DWORD (+84, 4byte) st.21 = 値 / 値 = st.21 (lpoke/lpeek も可)
; cbBmiSrc : DWORD (+88, 4byte) st.22 = 値 / 値 = st.22 (lpoke/lpeek も可)
; offBitsSrc : DWORD (+92, 4byte) st.23 = 値 / 値 = st.23 (lpoke/lpeek も可)
; cbBitsSrc : DWORD (+96, 4byte) st.24 = 値 / 値 = st.24 (lpoke/lpeek も可)
; cxSrc : INT (+100, 4byte) st.25 = 値 / 値 = st.25 (lpoke/lpeek も可)
; cySrc : INT (+104, 4byte) st.26 = 値 / 値 = st.26 (lpoke/lpeek も可)
; ※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 RECTL
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global XFORM
#field float eM11
#field float eM12
#field float eM21
#field float eM22
#field float eDx
#field float eDy
#endstruct
#defstruct global EMRTRANSPARENTBLT
#field EMR emr
#field RECTL rclBounds
#field int xDest
#field int yDest
#field int cxDest
#field int cyDest
#field int dwRop
#field int xSrc
#field int ySrc
#field XFORM xformSrc
#field int crBkColorSrc
#field int iUsageSrc
#field int offBmiSrc
#field int cbBmiSrc
#field int offBitsSrc
#field int cbBitsSrc
#field int cxSrc
#field int cySrc
#endstruct
stdim st, EMRTRANSPARENTBLT ; NSTRUCT 変数を確保
st->xDest = 100
mes "xDest=" + st->xDest