ホーム › Graphics.Direct2D.Common › D2D1_BEZIER_SEGMENT
D2D1_BEZIER_SEGMENT
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| point1 | D2D_POINT_2F | 8 | +0 | +0 | ベジエ セグメントの 1 番目の制御点です。 |
| point2 | D2D_POINT_2F | 8 | +8 | +8 | ベジエ セグメントの 2 番目の制御点です。 |
| point3 | D2D_POINT_2F | 8 | +16 | +16 | ベジエ セグメントの終点です。 |
公式ドキュメント
2 つの点の間に描画される 3 次ベジエ セグメントを表します。
解説(Remarks)
3 次ベジエ曲線は、始点、終点 (point3)、および 2 つの制御点 (point1 と point2) という 4 つの点によって定義されます。ベジエ セグメントには曲線の始点を表すプロパティはなく、終点のみを定義します。曲線の始点は、このベジエ曲線が追加されるパスの現在の点になります。
3 次ベジエ曲線の 2 つの制御点は磁石のように働き、本来は直線となる部分を自身の方向へ引き寄せて曲線を作り出します。1 番目の制御点 point1 は曲線の始まり側の部分に影響し、2 番目の制御点 point2 は曲線の終わり側の部分に影響します。
注意 曲線は必ずしも制御点を通るとは限りません。各制御点は線の該当部分を自身の方向へ引き寄せますが、制御点そのものを通過するわけではありません。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// D2D_POINT_2F (x64 8 / x86 8 バイト)
typedef struct D2D_POINT_2F {
FLOAT x;
FLOAT y;
} D2D_POINT_2F;
// D2D1_BEZIER_SEGMENT (x64 24 / x86 24 バイト)
typedef struct D2D1_BEZIER_SEGMENT {
D2D_POINT_2F point1;
D2D_POINT_2F point2;
D2D_POINT_2F point3;
} D2D1_BEZIER_SEGMENT;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_BEZIER_SEGMENT
{
public D2D_POINT_2F point1;
public D2D_POINT_2F point2;
public D2D_POINT_2F point3;
}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_BEZIER_SEGMENT
Public point1 As D2D_POINT_2F
Public point2 As D2D_POINT_2F
Public point3 As D2D_POINT_2F
End Structureimport ctypes
from ctypes import wintypes
class D2D_POINT_2F(ctypes.Structure):
_fields_ = [
("x", ctypes.c_float),
("y", ctypes.c_float),
]
class D2D1_BEZIER_SEGMENT(ctypes.Structure):
_fields_ = [
("point1", D2D_POINT_2F),
("point2", D2D_POINT_2F),
("point3", D2D_POINT_2F),
]#[repr(C)]
pub struct D2D_POINT_2F {
pub x: f32,
pub y: f32,
}
#[repr(C)]
pub struct D2D1_BEZIER_SEGMENT {
pub point1: D2D_POINT_2F,
pub point2: D2D_POINT_2F,
pub point3: D2D_POINT_2F,
}import "golang.org/x/sys/windows"
type D2D_POINT_2F struct {
x float32
y float32
}
type D2D1_BEZIER_SEGMENT struct {
point1 D2D_POINT_2F
point2 D2D_POINT_2F
point3 D2D_POINT_2F
}type
D2D_POINT_2F = record
x: Single;
y: Single;
end;
D2D1_BEZIER_SEGMENT = record
point1: D2D_POINT_2F;
point2: D2D_POINT_2F;
point3: D2D_POINT_2F;
end;const D2D_POINT_2F = extern struct {
x: f32,
y: f32,
};
const D2D1_BEZIER_SEGMENT = extern struct {
point1: D2D_POINT_2F,
point2: D2D_POINT_2F,
point3: D2D_POINT_2F,
};type
D2D_POINT_2F {.bycopy.} = object
x: float32
y: float32
D2D1_BEZIER_SEGMENT {.bycopy.} = object
point1: D2D_POINT_2F
point2: D2D_POINT_2F
point3: D2D_POINT_2Fstruct D2D_POINT_2F
{
float x;
float y;
}
struct D2D1_BEZIER_SEGMENT
{
D2D_POINT_2F point1;
D2D_POINT_2F point2;
D2D_POINT_2F point3;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_BEZIER_SEGMENT サイズ: 24 バイト(x64)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; point1 : D2D_POINT_2F (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; point2 : D2D_POINT_2F (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; point3 : D2D_POINT_2F (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; ※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_BEZIER_SEGMENT
#field D2D_POINT_2F point1
#field D2D_POINT_2F point2
#field D2D_POINT_2F point3
#endstruct
stdim st, D2D1_BEZIER_SEGMENT ; NSTRUCT 変数を確保