ホーム › Graphics.Gdi › EMRSTRETCHDIBITS
EMRSTRETCHDIBITS
構造体サイズ=各フィールドのバイト数(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座標を表す。 |
| xSrc | INT | 4 | +32 | +32 | 転送元DIB内の左上X座標を表す。 |
| ySrc | INT | 4 | +36 | +36 | 転送元DIB内の左上Y座標を表す。 |
| cxSrc | INT | 4 | +40 | +40 | 転送元矩形の幅を表す。 |
| cySrc | INT | 4 | +44 | +44 | 転送元矩形の高さを表す。 |
| offBmiSrc | DWORD | 4 | +48 | +48 | レコード先頭からソースBITMAPINFOへのオフセットをバイト単位で表す。 |
| cbBmiSrc | DWORD | 4 | +52 | +52 | ソースBITMAPINFOのサイズをバイト単位で表す。 |
| offBitsSrc | DWORD | 4 | +56 | +56 | レコード先頭からソースビットデータへのオフセットをバイト単位で表す。 |
| cbBitsSrc | DWORD | 4 | +60 | +60 | ソースビットデータのサイズをバイト単位で表す。 |
| iUsageSrc | DWORD | 4 | +64 | +64 | ビットマップ情報のカラーテーブル形式を表す。 |
| dwRop | DWORD | 4 | +68 | +68 | ラスタオペレーションコード(ROP3)を表す。 |
| cxDest | INT | 4 | +72 | +72 | 転送先矩形の幅を表す。 |
| cyDest | INT | 4 | +76 | +76 | 転送先矩形の高さを表す。 |
各言語での定義
#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;
// EMRSTRETCHDIBITS (x64 80 / x86 80 バイト)
typedef struct EMRSTRETCHDIBITS {
EMR emr;
RECTL rclBounds;
INT xDest;
INT yDest;
INT xSrc;
INT ySrc;
INT cxSrc;
INT cySrc;
DWORD offBmiSrc;
DWORD cbBmiSrc;
DWORD offBitsSrc;
DWORD cbBitsSrc;
DWORD iUsageSrc;
DWORD dwRop;
INT cxDest;
INT cyDest;
} EMRSTRETCHDIBITS;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 EMRSTRETCHDIBITS
{
public EMR emr;
public RECTL rclBounds;
public int xDest;
public int yDest;
public int xSrc;
public int ySrc;
public int cxSrc;
public int cySrc;
public uint offBmiSrc;
public uint cbBmiSrc;
public uint offBitsSrc;
public uint cbBitsSrc;
public uint iUsageSrc;
public uint dwRop;
public int cxDest;
public int cyDest;
}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 EMRSTRETCHDIBITS
Public emr As EMR
Public rclBounds As RECTL
Public xDest As Integer
Public yDest As Integer
Public xSrc As Integer
Public ySrc As Integer
Public cxSrc As Integer
Public cySrc As Integer
Public offBmiSrc As UInteger
Public cbBmiSrc As UInteger
Public offBitsSrc As UInteger
Public cbBitsSrc As UInteger
Public iUsageSrc As UInteger
Public dwRop As UInteger
Public cxDest As Integer
Public cyDest 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 EMRSTRETCHDIBITS(ctypes.Structure):
_fields_ = [
("emr", EMR),
("rclBounds", RECTL),
("xDest", ctypes.c_int),
("yDest", ctypes.c_int),
("xSrc", ctypes.c_int),
("ySrc", ctypes.c_int),
("cxSrc", ctypes.c_int),
("cySrc", ctypes.c_int),
("offBmiSrc", wintypes.DWORD),
("cbBmiSrc", wintypes.DWORD),
("offBitsSrc", wintypes.DWORD),
("cbBitsSrc", wintypes.DWORD),
("iUsageSrc", wintypes.DWORD),
("dwRop", wintypes.DWORD),
("cxDest", ctypes.c_int),
("cyDest", 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 EMRSTRETCHDIBITS {
pub emr: EMR,
pub rclBounds: RECTL,
pub xDest: i32,
pub yDest: i32,
pub xSrc: i32,
pub ySrc: i32,
pub cxSrc: i32,
pub cySrc: i32,
pub offBmiSrc: u32,
pub cbBmiSrc: u32,
pub offBitsSrc: u32,
pub cbBitsSrc: u32,
pub iUsageSrc: u32,
pub dwRop: u32,
pub cxDest: i32,
pub cyDest: 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 EMRSTRETCHDIBITS struct {
emr EMR
rclBounds RECTL
xDest int32
yDest int32
xSrc int32
ySrc int32
cxSrc int32
cySrc int32
offBmiSrc uint32
cbBmiSrc uint32
offBitsSrc uint32
cbBitsSrc uint32
iUsageSrc uint32
dwRop uint32
cxDest int32
cyDest int32
}type
EMR = record
iType: DWORD;
nSize: DWORD;
end;
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
EMRSTRETCHDIBITS = record
emr: EMR;
rclBounds: RECTL;
xDest: Integer;
yDest: Integer;
xSrc: Integer;
ySrc: Integer;
cxSrc: Integer;
cySrc: Integer;
offBmiSrc: DWORD;
cbBmiSrc: DWORD;
offBitsSrc: DWORD;
cbBitsSrc: DWORD;
iUsageSrc: DWORD;
dwRop: DWORD;
cxDest: Integer;
cyDest: Integer;
end;const EMR = extern struct {
iType: u32,
nSize: u32,
};
const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const EMRSTRETCHDIBITS = extern struct {
emr: EMR,
rclBounds: RECTL,
xDest: i32,
yDest: i32,
xSrc: i32,
ySrc: i32,
cxSrc: i32,
cySrc: i32,
offBmiSrc: u32,
cbBmiSrc: u32,
offBitsSrc: u32,
cbBitsSrc: u32,
iUsageSrc: u32,
dwRop: u32,
cxDest: i32,
cyDest: i32,
};type
EMR {.bycopy.} = object
iType: uint32
nSize: uint32
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
EMRSTRETCHDIBITS {.bycopy.} = object
emr: EMR
rclBounds: RECTL
xDest: int32
yDest: int32
xSrc: int32
ySrc: int32
cxSrc: int32
cySrc: int32
offBmiSrc: uint32
cbBmiSrc: uint32
offBitsSrc: uint32
cbBitsSrc: uint32
iUsageSrc: uint32
dwRop: uint32
cxDest: int32
cyDest: int32struct EMR
{
uint iType;
uint nSize;
}
struct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct EMRSTRETCHDIBITS
{
EMR emr;
RECTL rclBounds;
int xDest;
int yDest;
int xSrc;
int ySrc;
int cxSrc;
int cySrc;
uint offBmiSrc;
uint cbBmiSrc;
uint offBitsSrc;
uint cbBitsSrc;
uint iUsageSrc;
uint dwRop;
int cxDest;
int cyDest;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRSTRETCHDIBITS サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 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 も可)
; xSrc : INT (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ySrc : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; cxSrc : INT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; cySrc : INT (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; offBmiSrc : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; cbBmiSrc : DWORD (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; offBitsSrc : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; cbBitsSrc : DWORD (+60, 4byte) st.15 = 値 / 値 = st.15 (lpoke/lpeek も可)
; iUsageSrc : DWORD (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; dwRop : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; cxDest : INT (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; cyDest : INT (+76, 4byte) st.19 = 値 / 値 = st.19 (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 EMRSTRETCHDIBITS
#field EMR emr
#field RECTL rclBounds
#field int xDest
#field int yDest
#field int xSrc
#field int ySrc
#field int cxSrc
#field int cySrc
#field int offBmiSrc
#field int cbBmiSrc
#field int offBitsSrc
#field int cbBitsSrc
#field int iUsageSrc
#field int dwRop
#field int cxDest
#field int cyDest
#endstruct
stdim st, EMRSTRETCHDIBITS ; NSTRUCT 変数を確保
st->xDest = 100
mes "xDest=" + st->xDest