Win32 API 日本語リファレンス
ホームGraphics.Gdi › EMRMASKBLT

EMRMASKBLT

構造体
サイズx64: 128 バイト / x86: 128 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
emrEMR8+0+0共通レコードヘッダを表すEMR構造体。
rclBoundsRECTL16+8+8影響を受ける領域の外接矩形を表すRECTL構造体。
xDestINT4+24+24転送先矩形の左上X座標を表す。
yDestINT4+28+28転送先矩形の左上Y座標を表す。
cxDestINT4+32+32転送先矩形の幅を表す。
cyDestINT4+36+36転送先矩形の高さを表す。
dwRopDWORD4+40+40前景・背景のラスタオペレーションコードを表す。
xSrcINT4+44+44転送元矩形の左上X座標を表す。
ySrcINT4+48+48転送元矩形の左上Y座標を表す。
xformSrcXFORM24+52+52転送元に適用するワールド変換を表すXFORM構造体。
crBkColorSrcCOLORREF4+76+76転送元の背景色を表すCOLORREF値。
iUsageSrcDWORD4+80+80ソースビットマップのカラーテーブル形式を表す。
offBmiSrcDWORD4+84+84レコード先頭からソースBITMAPINFOへのオフセットをバイト単位で表す。
cbBmiSrcDWORD4+88+88ソースBITMAPINFOのサイズをバイト単位で表す。
offBitsSrcDWORD4+92+92レコード先頭からソースビットデータへのオフセットをバイト単位で表す。
cbBitsSrcDWORD4+96+96ソースビットデータのサイズをバイト単位で表す。
xMaskINT4+100+100マスクビットマップ内の開始X座標を表す。
yMaskINT4+104+104マスクビットマップ内の開始Y座標を表す。
iUsageMaskDWORD4+108+108マスクビットマップのカラーテーブル形式を表す。
offBmiMaskDWORD4+112+112レコード先頭からマスクBITMAPINFOへのオフセットをバイト単位で表す。
cbBmiMaskDWORD4+116+116マスクBITMAPINFOのサイズをバイト単位で表す。
offBitsMaskDWORD4+120+120レコード先頭からマスクビットデータへのオフセットをバイト単位で表す。
cbBitsMaskDWORD4+124+124マスクビットデータのサイズをバイト単位で表す。

各言語での定義

#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;

// EMRMASKBLT  (x64 128 / x86 128 バイト)
typedef struct EMRMASKBLT {
    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 xMask;
    INT yMask;
    DWORD iUsageMask;
    DWORD offBmiMask;
    DWORD cbBmiMask;
    DWORD offBitsMask;
    DWORD cbBitsMask;
} EMRMASKBLT;
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 EMRMASKBLT
{
    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 xMask;
    public int yMask;
    public uint iUsageMask;
    public uint offBmiMask;
    public uint cbBmiMask;
    public uint offBitsMask;
    public uint cbBitsMask;
}
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 EMRMASKBLT
    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 xMask As Integer
    Public yMask As Integer
    Public iUsageMask As UInteger
    Public offBmiMask As UInteger
    Public cbBmiMask As UInteger
    Public offBitsMask As UInteger
    Public cbBitsMask As UInteger
End Structure
import 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 EMRMASKBLT(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),
        ("xMask", ctypes.c_int),
        ("yMask", ctypes.c_int),
        ("iUsageMask", wintypes.DWORD),
        ("offBmiMask", wintypes.DWORD),
        ("cbBmiMask", wintypes.DWORD),
        ("offBitsMask", wintypes.DWORD),
        ("cbBitsMask", wintypes.DWORD),
    ]
#[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 EMRMASKBLT {
    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 xMask: i32,
    pub yMask: i32,
    pub iUsageMask: u32,
    pub offBmiMask: u32,
    pub cbBmiMask: u32,
    pub offBitsMask: u32,
    pub cbBitsMask: u32,
}
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 EMRMASKBLT 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
	xMask int32
	yMask int32
	iUsageMask uint32
	offBmiMask uint32
	cbBmiMask uint32
	offBitsMask uint32
	cbBitsMask uint32
}
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;

  EMRMASKBLT = 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;
    xMask: Integer;
    yMask: Integer;
    iUsageMask: DWORD;
    offBmiMask: DWORD;
    cbBmiMask: DWORD;
    offBitsMask: DWORD;
    cbBitsMask: DWORD;
  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 EMRMASKBLT = 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,
    xMask: i32,
    yMask: i32,
    iUsageMask: u32,
    offBmiMask: u32,
    cbBmiMask: u32,
    offBitsMask: u32,
    cbBitsMask: u32,
};
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

  EMRMASKBLT {.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
    xMask: int32
    yMask: int32
    iUsageMask: uint32
    offBmiMask: uint32
    cbBmiMask: uint32
    offBitsMask: uint32
    cbBitsMask: uint32
struct 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 EMRMASKBLT
{
    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 xMask;
    int yMask;
    uint iUsageMask;
    uint offBmiMask;
    uint cbBmiMask;
    uint offBitsMask;
    uint cbBitsMask;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRMASKBLT サイズ: 128 バイト(x64)
dim st, 32    ; 4byte整数×32(構造体サイズ 128 / 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 も可)
; xMask : INT (+100, 4byte)  st.25 = 値  /  値 = st.25   (lpoke/lpeek も可)
; yMask : INT (+104, 4byte)  st.26 = 値  /  値 = st.26   (lpoke/lpeek も可)
; iUsageMask : DWORD (+108, 4byte)  st.27 = 値  /  値 = st.27   (lpoke/lpeek も可)
; offBmiMask : DWORD (+112, 4byte)  st.28 = 値  /  値 = st.28   (lpoke/lpeek も可)
; cbBmiMask : DWORD (+116, 4byte)  st.29 = 値  /  値 = st.29   (lpoke/lpeek も可)
; offBitsMask : DWORD (+120, 4byte)  st.30 = 値  /  値 = st.30   (lpoke/lpeek も可)
; cbBitsMask : DWORD (+124, 4byte)  st.31 = 値  /  値 = st.31   (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 EMRMASKBLT
    #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 xMask
    #field int yMask
    #field int iUsageMask
    #field int offBmiMask
    #field int cbBmiMask
    #field int offBitsMask
    #field int cbBitsMask
#endstruct

stdim st, EMRMASKBLT        ; NSTRUCT 変数を確保
st->xDest = 100
mes "xDest=" + st->xDest