Win32 API 日本語リファレンス
ホームGraphics.Direct2D › D2D1_ARC_SEGMENT

D2D1_ARC_SEGMENT

構造体
サイズx64: 28 バイト / x86: 28 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
pointD2D_POINT_2F8+0+0円弧の終点。
sizeD2D_SIZE_F8+8+8円弧を構成する楕円のXY半径サイズ。
rotationAngleFLOAT4+16+16楕円のX軸からの回転角度(度)。
sweepDirectionD2D1_SWEEP_DIRECTION4+20+20円弧を描く回転方向(時計回り/反時計回り)。
arcSizeD2D1_ARC_SIZE4+24+24描く円弧が小さい方か大きい方かを示す値。

各言語での定義

#include <windows.h>

// D2D_POINT_2F  (x64 8 / x86 8 バイト)
typedef struct D2D_POINT_2F {
    FLOAT x;
    FLOAT y;
} D2D_POINT_2F;

// D2D_SIZE_F  (x64 8 / x86 8 バイト)
typedef struct D2D_SIZE_F {
    FLOAT width;
    FLOAT height;
} D2D_SIZE_F;

// D2D1_ARC_SEGMENT  (x64 28 / x86 28 バイト)
typedef struct D2D1_ARC_SEGMENT {
    D2D_POINT_2F point;
    D2D_SIZE_F size;
    FLOAT rotationAngle;
    D2D1_SWEEP_DIRECTION sweepDirection;
    D2D1_ARC_SIZE arcSize;
} D2D1_ARC_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 D2D_SIZE_F
{
    public float width;
    public float height;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_ARC_SEGMENT
{
    public D2D_POINT_2F point;
    public D2D_SIZE_F size;
    public float rotationAngle;
    public int sweepDirection;
    public int arcSize;
}
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 D2D_SIZE_F
    Public width As Single
    Public height As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_ARC_SEGMENT
    Public point As D2D_POINT_2F
    Public size As D2D_SIZE_F
    Public rotationAngle As Single
    Public sweepDirection As Integer
    Public arcSize As Integer
End Structure
import ctypes
from ctypes import wintypes

class D2D_POINT_2F(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_float),
        ("y", ctypes.c_float),
    ]

class D2D_SIZE_F(ctypes.Structure):
    _fields_ = [
        ("width", ctypes.c_float),
        ("height", ctypes.c_float),
    ]

class D2D1_ARC_SEGMENT(ctypes.Structure):
    _fields_ = [
        ("point", D2D_POINT_2F),
        ("size", D2D_SIZE_F),
        ("rotationAngle", ctypes.c_float),
        ("sweepDirection", ctypes.c_int),
        ("arcSize", ctypes.c_int),
    ]
#[repr(C)]
pub struct D2D_POINT_2F {
    pub x: f32,
    pub y: f32,
}

#[repr(C)]
pub struct D2D_SIZE_F {
    pub width: f32,
    pub height: f32,
}

#[repr(C)]
pub struct D2D1_ARC_SEGMENT {
    pub point: D2D_POINT_2F,
    pub size: D2D_SIZE_F,
    pub rotationAngle: f32,
    pub sweepDirection: i32,
    pub arcSize: i32,
}
import "golang.org/x/sys/windows"

type D2D_POINT_2F struct {
	x float32
	y float32
}

type D2D_SIZE_F struct {
	width float32
	height float32
}

type D2D1_ARC_SEGMENT struct {
	point D2D_POINT_2F
	size D2D_SIZE_F
	rotationAngle float32
	sweepDirection int32
	arcSize int32
}
type
  D2D_POINT_2F = record
    x: Single;
    y: Single;
  end;

  D2D_SIZE_F = record
    width: Single;
    height: Single;
  end;

  D2D1_ARC_SEGMENT = record
    point: D2D_POINT_2F;
    size: D2D_SIZE_F;
    rotationAngle: Single;
    sweepDirection: Integer;
    arcSize: Integer;
  end;
const D2D_POINT_2F = extern struct {
    x: f32,
    y: f32,
};

const D2D_SIZE_F = extern struct {
    width: f32,
    height: f32,
};

const D2D1_ARC_SEGMENT = extern struct {
    point: D2D_POINT_2F,
    size: D2D_SIZE_F,
    rotationAngle: f32,
    sweepDirection: i32,
    arcSize: i32,
};
type
  D2D_POINT_2F {.bycopy.} = object
    x: float32
    y: float32

  D2D_SIZE_F {.bycopy.} = object
    width: float32
    height: float32

  D2D1_ARC_SEGMENT {.bycopy.} = object
    point: D2D_POINT_2F
    size: D2D_SIZE_F
    rotationAngle: float32
    sweepDirection: int32
    arcSize: int32
struct D2D_POINT_2F
{
    float x;
    float y;
}

struct D2D_SIZE_F
{
    float width;
    float height;
}

struct D2D1_ARC_SEGMENT
{
    D2D_POINT_2F point;
    D2D_SIZE_F size;
    float rotationAngle;
    int sweepDirection;
    int arcSize;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_ARC_SEGMENT サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; point : D2D_POINT_2F (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; size : D2D_SIZE_F (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; rotationAngle : FLOAT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; sweepDirection : D2D1_SWEEP_DIRECTION (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; arcSize : D2D1_ARC_SIZE (+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 D2D_SIZE_F
    #field float width
    #field float height
#endstruct

#defstruct global D2D1_ARC_SEGMENT
    #field D2D_POINT_2F point
    #field D2D_SIZE_F size
    #field float rotationAngle
    #field int sweepDirection
    #field int arcSize
#endstruct

stdim st, D2D1_ARC_SEGMENT        ; NSTRUCT 変数を確保
st->rotationAngle = 100
mes "rotationAngle=" + st->rotationAngle