ホーム › Graphics.Direct2D › D2D1_POINT_DESCRIPTION
D2D1_POINT_DESCRIPTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| point | D2D_POINT_2F | 8 | +0 | +0 | パス上の点の座標。 |
| unitTangentVector | D2D_POINT_2F | 8 | +8 | +8 | その点での単位接ベクトル。 |
| endSegment | DWORD | 4 | +16 | +16 | セグメント終端かどうかのインデックス情報。 |
| endFigure | DWORD | 4 | +20 | +20 | フィギュア終端かどうかのインデックス情報。 |
| lengthToEndSegment | FLOAT | 4 | +24 | +24 | 現在点からセグメント終端までの長さ。 |
各言語での定義
#include <windows.h>
// D2D_POINT_2F (x64 8 / x86 8 バイト)
typedef struct D2D_POINT_2F {
FLOAT x;
FLOAT y;
} D2D_POINT_2F;
// D2D1_POINT_DESCRIPTION (x64 28 / x86 28 バイト)
typedef struct D2D1_POINT_DESCRIPTION {
D2D_POINT_2F point;
D2D_POINT_2F unitTangentVector;
DWORD endSegment;
DWORD endFigure;
FLOAT lengthToEndSegment;
} D2D1_POINT_DESCRIPTION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D_POINT_2F
{
public float x;
public float y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_POINT_DESCRIPTION
{
public D2D_POINT_2F point;
public D2D_POINT_2F unitTangentVector;
public uint endSegment;
public uint endFigure;
public float lengthToEndSegment;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D_POINT_2F
Public x As Single
Public y As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_POINT_DESCRIPTION
Public point As D2D_POINT_2F
Public unitTangentVector As D2D_POINT_2F
Public endSegment As UInteger
Public endFigure As UInteger
Public lengthToEndSegment As Single
End Structureimport ctypes
from ctypes import wintypes
class D2D_POINT_2F(ctypes.Structure):
_fields_ = [
("x", ctypes.c_float),
("y", ctypes.c_float),
]
class D2D1_POINT_DESCRIPTION(ctypes.Structure):
_fields_ = [
("point", D2D_POINT_2F),
("unitTangentVector", D2D_POINT_2F),
("endSegment", wintypes.DWORD),
("endFigure", wintypes.DWORD),
("lengthToEndSegment", ctypes.c_float),
]#[repr(C)]
pub struct D2D_POINT_2F {
pub x: f32,
pub y: f32,
}
#[repr(C)]
pub struct D2D1_POINT_DESCRIPTION {
pub point: D2D_POINT_2F,
pub unitTangentVector: D2D_POINT_2F,
pub endSegment: u32,
pub endFigure: u32,
pub lengthToEndSegment: f32,
}import "golang.org/x/sys/windows"
type D2D_POINT_2F struct {
x float32
y float32
}
type D2D1_POINT_DESCRIPTION struct {
point D2D_POINT_2F
unitTangentVector D2D_POINT_2F
endSegment uint32
endFigure uint32
lengthToEndSegment float32
}type
D2D_POINT_2F = record
x: Single;
y: Single;
end;
D2D1_POINT_DESCRIPTION = record
point: D2D_POINT_2F;
unitTangentVector: D2D_POINT_2F;
endSegment: DWORD;
endFigure: DWORD;
lengthToEndSegment: Single;
end;const D2D_POINT_2F = extern struct {
x: f32,
y: f32,
};
const D2D1_POINT_DESCRIPTION = extern struct {
point: D2D_POINT_2F,
unitTangentVector: D2D_POINT_2F,
endSegment: u32,
endFigure: u32,
lengthToEndSegment: f32,
};type
D2D_POINT_2F {.bycopy.} = object
x: float32
y: float32
D2D1_POINT_DESCRIPTION {.bycopy.} = object
point: D2D_POINT_2F
unitTangentVector: D2D_POINT_2F
endSegment: uint32
endFigure: uint32
lengthToEndSegment: float32struct D2D_POINT_2F
{
float x;
float y;
}
struct D2D1_POINT_DESCRIPTION
{
D2D_POINT_2F point;
D2D_POINT_2F unitTangentVector;
uint endSegment;
uint endFigure;
float lengthToEndSegment;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_POINT_DESCRIPTION サイズ: 28 バイト(x64)
dim st, 7 ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; point : D2D_POINT_2F (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; unitTangentVector : D2D_POINT_2F (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; endSegment : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; endFigure : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; lengthToEndSegment : FLOAT (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D2D_POINT_2F
#field float x
#field float y
#endstruct
#defstruct global D2D1_POINT_DESCRIPTION
#field D2D_POINT_2F point
#field D2D_POINT_2F unitTangentVector
#field int endSegment
#field int endFigure
#field float lengthToEndSegment
#endstruct
stdim st, D2D1_POINT_DESCRIPTION ; NSTRUCT 変数を確保
st->endSegment = 100
mes "endSegment=" + st->endSegment