ホーム › Graphics.Gdi › EMRSETDIBITSTODEVICE
EMRSETDIBITSTODEVICE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| emr | EMR | 8 | +0 | +0 | すべてのレコード型に共通する基本構造体です。 |
| rclBounds | RECTL | 16 | +8 | +8 | 境界四角形をデバイス単位で表します。 |
| 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 | BITMAPINFO 構造体の bmiColors メンバーの値です。iUsageSrc メンバーには、DIB_PAL_COLORS または DIB_RGB_COLORS のいずれかの値を指定できます。 |
| iStartScan | DWORD | 4 | +68 | +68 | 配列内の最初の走査線です。 |
| cScans | DWORD | 4 | +72 | +72 | 走査線の数です。 |
公式ドキュメント
EMRSETDIBITSTODEVICE 構造体は、SetDIBitsToDevice の拡張メタファイルレコード用のメンバーを保持します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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;
// EMRSETDIBITSTODEVICE (x64 76 / x86 76 バイト)
typedef struct EMRSETDIBITSTODEVICE {
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 iStartScan;
DWORD cScans;
} EMRSETDIBITSTODEVICE;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 EMRSETDIBITSTODEVICE
{
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 iStartScan;
public uint cScans;
}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 EMRSETDIBITSTODEVICE
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 iStartScan As UInteger
Public cScans As UInteger
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 EMRSETDIBITSTODEVICE(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),
("iStartScan", wintypes.DWORD),
("cScans", 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 EMRSETDIBITSTODEVICE {
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 iStartScan: u32,
pub cScans: 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 EMRSETDIBITSTODEVICE 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
iStartScan uint32
cScans uint32
}type
EMR = record
iType: DWORD;
nSize: DWORD;
end;
RECTL = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
EMRSETDIBITSTODEVICE = 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;
iStartScan: DWORD;
cScans: DWORD;
end;const EMR = extern struct {
iType: u32,
nSize: u32,
};
const RECTL = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const EMRSETDIBITSTODEVICE = 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,
iStartScan: u32,
cScans: u32,
};type
EMR {.bycopy.} = object
iType: uint32
nSize: uint32
RECTL {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
EMRSETDIBITSTODEVICE {.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
iStartScan: uint32
cScans: uint32struct EMR
{
uint iType;
uint nSize;
}
struct RECTL
{
int left;
int top;
int right;
int bottom;
}
struct EMRSETDIBITSTODEVICE
{
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 iStartScan;
uint cScans;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRSETDIBITSTODEVICE サイズ: 76 バイト(x64)
dim st, 19 ; 4byte整数×19(構造体サイズ 76 / 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 も可)
; iStartScan : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; cScans : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (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 EMRSETDIBITSTODEVICE
#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 iStartScan
#field int cScans
#endstruct
stdim st, EMRSETDIBITSTODEVICE ; NSTRUCT 変数を確保
st->xDest = 100
mes "xDest=" + st->xDest