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