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

D2D1_ELLIPSE

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

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

フィールド

フィールドサイズx64x86説明
pointD2D_POINT_2F8+0+0楕円の中心点。
radiusXFLOAT4+8+8楕円のX方向半径。
radiusYFLOAT4+12+12楕円のY方向半径。

各言語での定義

#include <windows.h>

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

// D2D1_ELLIPSE  (x64 16 / x86 16 バイト)
typedef struct D2D1_ELLIPSE {
    D2D_POINT_2F point;
    FLOAT radiusX;
    FLOAT radiusY;
} D2D1_ELLIPSE;
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_ELLIPSE
{
    public D2D_POINT_2F point;
    public float radiusX;
    public float radiusY;
}
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_ELLIPSE
    Public point As D2D_POINT_2F
    Public radiusX As Single
    Public radiusY As Single
End Structure
import ctypes
from ctypes import wintypes

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

class D2D1_ELLIPSE(ctypes.Structure):
    _fields_ = [
        ("point", D2D_POINT_2F),
        ("radiusX", ctypes.c_float),
        ("radiusY", ctypes.c_float),
    ]
#[repr(C)]
pub struct D2D_POINT_2F {
    pub x: f32,
    pub y: f32,
}

#[repr(C)]
pub struct D2D1_ELLIPSE {
    pub point: D2D_POINT_2F,
    pub radiusX: f32,
    pub radiusY: f32,
}
import "golang.org/x/sys/windows"

type D2D_POINT_2F struct {
	x float32
	y float32
}

type D2D1_ELLIPSE struct {
	point D2D_POINT_2F
	radiusX float32
	radiusY float32
}
type
  D2D_POINT_2F = record
    x: Single;
    y: Single;
  end;

  D2D1_ELLIPSE = record
    point: D2D_POINT_2F;
    radiusX: Single;
    radiusY: Single;
  end;
const D2D_POINT_2F = extern struct {
    x: f32,
    y: f32,
};

const D2D1_ELLIPSE = extern struct {
    point: D2D_POINT_2F,
    radiusX: f32,
    radiusY: f32,
};
type
  D2D_POINT_2F {.bycopy.} = object
    x: float32
    y: float32

  D2D1_ELLIPSE {.bycopy.} = object
    point: D2D_POINT_2F
    radiusX: float32
    radiusY: float32
struct D2D_POINT_2F
{
    float x;
    float y;
}

struct D2D1_ELLIPSE
{
    D2D_POINT_2F point;
    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_ELLIPSE サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; point : D2D_POINT_2F (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; radiusX : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; radiusY : FLOAT (+12, 4byte)  st.3 = 値  /  値 = st.3   (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_ELLIPSE
    #field D2D_POINT_2F point
    #field float radiusX
    #field float radiusY
#endstruct

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