ホーム › Storage.Xps › XPS_RECT
XPS_RECT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| x | FLOAT | 4 | +0 | +0 | 矩形の左上X座標を浮動小数点で示す。 |
| y | FLOAT | 4 | +4 | +4 | 矩形の左上Y座標を浮動小数点で示す。 |
| width | FLOAT | 4 | +8 | +8 | 矩形の幅を浮動小数点で示す。 |
| height | FLOAT | 4 | +12 | +12 | 矩形の高さを浮動小数点で示す。 |
各言語での定義
#include <windows.h>
// XPS_RECT (x64 16 / x86 16 バイト)
typedef struct XPS_RECT {
FLOAT x;
FLOAT y;
FLOAT width;
FLOAT height;
} XPS_RECT;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XPS_RECT
{
public float x;
public float y;
public float width;
public float height;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XPS_RECT
Public x As Single
Public y As Single
Public width As Single
Public height As Single
End Structureimport ctypes
from ctypes import wintypes
class XPS_RECT(ctypes.Structure):
_fields_ = [
("x", ctypes.c_float),
("y", ctypes.c_float),
("width", ctypes.c_float),
("height", ctypes.c_float),
]#[repr(C)]
pub struct XPS_RECT {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}import "golang.org/x/sys/windows"
type XPS_RECT struct {
x float32
y float32
width float32
height float32
}type
XPS_RECT = record
x: Single;
y: Single;
width: Single;
height: Single;
end;const XPS_RECT = extern struct {
x: f32,
y: f32,
width: f32,
height: f32,
};type
XPS_RECT {.bycopy.} = object
x: float32
y: float32
width: float32
height: float32struct XPS_RECT
{
float x;
float y;
float width;
float height;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XPS_RECT サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; x : FLOAT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; y : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; width : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; height : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XPS_RECT
#field float x
#field float y
#field float width
#field float height
#endstruct
stdim st, XPS_RECT ; NSTRUCT 変数を確保
st->x = 100
mes "x=" + st->x