ホーム › Graphics.Direct2D › D2D1_ROUNDED_RECT
D2D1_ROUNDED_RECT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| rect | D2D_RECT_F | 16 | +0 | +0 | 角丸矩形の基となる矩形領域。 |
| radiusX | FLOAT | 4 | +16 | +16 | 角の丸めのX方向半径。 |
| radiusY | FLOAT | 4 | +20 | +20 | 角の丸めの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;
// D2D1_ROUNDED_RECT (x64 24 / x86 24 バイト)
typedef struct D2D1_ROUNDED_RECT {
D2D_RECT_F rect;
FLOAT radiusX;
FLOAT radiusY;
} D2D1_ROUNDED_RECT;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;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_ROUNDED_RECT
{
public D2D_RECT_F rect;
public float radiusX;
public float radiusY;
}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 Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_ROUNDED_RECT
Public rect As D2D_RECT_F
Public radiusX As Single
Public radiusY 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),
]
class D2D1_ROUNDED_RECT(ctypes.Structure):
_fields_ = [
("rect", D2D_RECT_F),
("radiusX", ctypes.c_float),
("radiusY", ctypes.c_float),
]#[repr(C)]
pub struct D2D_RECT_F {
pub left: f32,
pub top: f32,
pub right: f32,
pub bottom: f32,
}
#[repr(C)]
pub struct D2D1_ROUNDED_RECT {
pub rect: D2D_RECT_F,
pub radiusX: f32,
pub radiusY: f32,
}import "golang.org/x/sys/windows"
type D2D_RECT_F struct {
left float32
top float32
right float32
bottom float32
}
type D2D1_ROUNDED_RECT struct {
rect D2D_RECT_F
radiusX float32
radiusY float32
}type
D2D_RECT_F = record
left: Single;
top: Single;
right: Single;
bottom: Single;
end;
D2D1_ROUNDED_RECT = record
rect: D2D_RECT_F;
radiusX: Single;
radiusY: Single;
end;const D2D_RECT_F = extern struct {
left: f32,
top: f32,
right: f32,
bottom: f32,
};
const D2D1_ROUNDED_RECT = extern struct {
rect: D2D_RECT_F,
radiusX: f32,
radiusY: f32,
};type
D2D_RECT_F {.bycopy.} = object
left: float32
top: float32
right: float32
bottom: float32
D2D1_ROUNDED_RECT {.bycopy.} = object
rect: D2D_RECT_F
radiusX: float32
radiusY: float32struct D2D_RECT_F
{
float left;
float top;
float right;
float bottom;
}
struct D2D1_ROUNDED_RECT
{
D2D_RECT_F rect;
float radiusX;
float radiusY;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_ROUNDED_RECT サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; rect : D2D_RECT_F (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; radiusX : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; radiusY : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D2D_RECT_F
#field float left
#field float top
#field float right
#field float bottom
#endstruct
#defstruct global D2D1_ROUNDED_RECT
#field D2D_RECT_F rect
#field float radiusX
#field float radiusY
#endstruct
stdim st, D2D1_ROUNDED_RECT ; NSTRUCT 変数を確保
st->radiusX = 100
mes "radiusX=" + st->radiusX