ホーム › Graphics.Gdi › EMRSCALEVIEWPORTEXTEX
EMRSCALEVIEWPORTEXTEX
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| emr | EMR | 8 | +0 | +0 | 共通レコードヘッダを表すEMR構造体。 |
| xNum | INT | 4 | +8 | +8 | X方向の倍率の分子を表す。 |
| xDenom | INT | 4 | +12 | +12 | X方向の倍率の分母を表す。 |
| yNum | INT | 4 | +16 | +16 | Y方向の倍率の分子を表す。 |
| yDenom | INT | 4 | +20 | +20 | Y方向の倍率の分母を表す。 |
各言語での定義
#include <windows.h>
// EMR (x64 8 / x86 8 バイト)
typedef struct EMR {
ENHANCED_METAFILE_RECORD_TYPE iType;
DWORD nSize;
} EMR;
// EMRSCALEVIEWPORTEXTEX (x64 24 / x86 24 バイト)
typedef struct EMRSCALEVIEWPORTEXTEX {
EMR emr;
INT xNum;
INT xDenom;
INT yNum;
INT yDenom;
} EMRSCALEVIEWPORTEXTEX;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 EMRSCALEVIEWPORTEXTEX
{
public EMR emr;
public int xNum;
public int xDenom;
public int yNum;
public int yDenom;
}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 EMRSCALEVIEWPORTEXTEX
Public emr As EMR
Public xNum As Integer
Public xDenom As Integer
Public yNum As Integer
Public yDenom As Integer
End Structureimport ctypes
from ctypes import wintypes
class EMR(ctypes.Structure):
_fields_ = [
("iType", wintypes.DWORD),
("nSize", wintypes.DWORD),
]
class EMRSCALEVIEWPORTEXTEX(ctypes.Structure):
_fields_ = [
("emr", EMR),
("xNum", ctypes.c_int),
("xDenom", ctypes.c_int),
("yNum", ctypes.c_int),
("yDenom", ctypes.c_int),
]#[repr(C)]
pub struct EMR {
pub iType: u32,
pub nSize: u32,
}
#[repr(C)]
pub struct EMRSCALEVIEWPORTEXTEX {
pub emr: EMR,
pub xNum: i32,
pub xDenom: i32,
pub yNum: i32,
pub yDenom: i32,
}import "golang.org/x/sys/windows"
type EMR struct {
iType uint32
nSize uint32
}
type EMRSCALEVIEWPORTEXTEX struct {
emr EMR
xNum int32
xDenom int32
yNum int32
yDenom int32
}type
EMR = record
iType: DWORD;
nSize: DWORD;
end;
EMRSCALEVIEWPORTEXTEX = record
emr: EMR;
xNum: Integer;
xDenom: Integer;
yNum: Integer;
yDenom: Integer;
end;const EMR = extern struct {
iType: u32,
nSize: u32,
};
const EMRSCALEVIEWPORTEXTEX = extern struct {
emr: EMR,
xNum: i32,
xDenom: i32,
yNum: i32,
yDenom: i32,
};type
EMR {.bycopy.} = object
iType: uint32
nSize: uint32
EMRSCALEVIEWPORTEXTEX {.bycopy.} = object
emr: EMR
xNum: int32
xDenom: int32
yNum: int32
yDenom: int32struct EMR
{
uint iType;
uint nSize;
}
struct EMRSCALEVIEWPORTEXTEX
{
EMR emr;
int xNum;
int xDenom;
int yNum;
int yDenom;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; EMRSCALEVIEWPORTEXTEX サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; emr : EMR (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; xNum : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; xDenom : INT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; yNum : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; yDenom : INT (+20, 4byte) st.5 = 値 / 値 = st.5 (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 EMRSCALEVIEWPORTEXTEX
#field EMR emr
#field int xNum
#field int xDenom
#field int yNum
#field int yDenom
#endstruct
stdim st, EMRSCALEVIEWPORTEXTEX ; NSTRUCT 変数を確保
st->xNum = 100
mes "xNum=" + st->xNum