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

D2D1_GRADIENT_MESH_PATCH

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

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

フィールド

フィールドサイズx64x86説明
point00D2D_POINT_2F8+0+0テンソルグリッドの列 0、行 0 にある制御点の座標空間上の位置です。
point01D2D_POINT_2F8+8+8テンソルグリッドの列 0、行 1 にある制御点の座標空間上の位置です。
point02D2D_POINT_2F8+16+16テンソルグリッドの列 0、行 2 にある制御点の座標空間上の位置です。
point03D2D_POINT_2F8+24+24テンソルグリッドの列 0、行 3 にある制御点の座標空間上の位置です。
point10D2D_POINT_2F8+32+32テンソルグリッドの列 1、行 0 にある制御点の座標空間上の位置です。
point11D2D_POINT_2F8+40+40テンソルグリッドの列 1、行 1 にある制御点の座標空間上の位置です。
point12D2D_POINT_2F8+48+48テンソルグリッドの列 1、行 2 にある制御点の座標空間上の位置です。
point13D2D_POINT_2F8+56+56テンソルグリッドの列 1、行 3 にある制御点の座標空間上の位置です。
point20D2D_POINT_2F8+64+64テンソルグリッドの列 2、行 0 にある制御点の座標空間上の位置です。
point21D2D_POINT_2F8+72+72テンソルグリッドの列 2、行 1 にある制御点の座標空間上の位置です。
point22D2D_POINT_2F8+80+80テンソルグリッドの列 2、行 2 にある制御点の座標空間上の位置です。
point23D2D_POINT_2F8+88+88テンソルグリッドの列 2、行 3 にある制御点の座標空間上の位置です。
point30D2D_POINT_2F8+96+96テンソルグリッドの列 3、行 0 にある制御点の座標空間上の位置です。
point31D2D_POINT_2F8+104+104テンソルグリッドの列 3、行 1 にある制御点の座標空間上の位置です。
point32D2D_POINT_2F8+112+112テンソルグリッドの列 3、行 2 にある制御点の座標空間上の位置です。
point33D2D_POINT_2F8+120+120テンソルグリッドの列 3、行 3 にある制御点の座標空間上の位置です。
color00D2D1_COLOR_F16+128+128テンソルグリッドの列 0、行 0 にある制御点に関連付けられた色です。
color03D2D1_COLOR_F16+144+144テンソルグリッドの列 0、行 3 にある制御点に関連付けられた色です。
color30D2D1_COLOR_F16+160+160テンソルグリッドの列 3、行 0 にある制御点に関連付けられた色です。
color33D2D1_COLOR_F16+176+176テンソルグリッドの列 3、行 3 にある制御点に関連付けられた色です。
topEdgeModeD2D1_PATCH_EDGE_MODE4+192+192メッシュの上端をどのように描画するかを指定します。
leftEdgeModeD2D1_PATCH_EDGE_MODE4+196+196メッシュの左端をどのように描画するかを指定します。
bottomEdgeModeD2D1_PATCH_EDGE_MODE4+200+200メッシュの下端をどのように描画するかを指定します。
rightEdgeModeD2D1_PATCH_EDGE_MODE4+204+204メッシュの右端をどのように描画するかを指定します。

公式ドキュメント

16 個の制御点、4 個の角の色、および境界フラグを持つテンソルパッチを表します。ID2D1GradientMesh は 1 つ以上のグラデーションメッシュパッチで構成されます。 作成するには GradientMeshPatch 関数または GradientMeshPatchFromCoonsPatch 関数を使用します。

解説(Remarks)

次の図は、テンソルグリッド上の制御点の番号付けを示しています。

Number of control points on a tensor grid
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
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_COLOR_F  (x64 16 / x86 16 バイト)
typedef struct D2D1_COLOR_F {
    FLOAT r;
    FLOAT g;
    FLOAT b;
    FLOAT a;
} D2D1_COLOR_F;

// D2D1_GRADIENT_MESH_PATCH  (x64 208 / x86 208 バイト)
typedef struct D2D1_GRADIENT_MESH_PATCH {
    D2D_POINT_2F point00;
    D2D_POINT_2F point01;
    D2D_POINT_2F point02;
    D2D_POINT_2F point03;
    D2D_POINT_2F point10;
    D2D_POINT_2F point11;
    D2D_POINT_2F point12;
    D2D_POINT_2F point13;
    D2D_POINT_2F point20;
    D2D_POINT_2F point21;
    D2D_POINT_2F point22;
    D2D_POINT_2F point23;
    D2D_POINT_2F point30;
    D2D_POINT_2F point31;
    D2D_POINT_2F point32;
    D2D_POINT_2F point33;
    D2D1_COLOR_F color00;
    D2D1_COLOR_F color03;
    D2D1_COLOR_F color30;
    D2D1_COLOR_F color33;
    D2D1_PATCH_EDGE_MODE topEdgeMode;
    D2D1_PATCH_EDGE_MODE leftEdgeMode;
    D2D1_PATCH_EDGE_MODE bottomEdgeMode;
    D2D1_PATCH_EDGE_MODE rightEdgeMode;
} D2D1_GRADIENT_MESH_PATCH;
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_COLOR_F
{
    public float r;
    public float g;
    public float b;
    public float a;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_GRADIENT_MESH_PATCH
{
    public D2D_POINT_2F point00;
    public D2D_POINT_2F point01;
    public D2D_POINT_2F point02;
    public D2D_POINT_2F point03;
    public D2D_POINT_2F point10;
    public D2D_POINT_2F point11;
    public D2D_POINT_2F point12;
    public D2D_POINT_2F point13;
    public D2D_POINT_2F point20;
    public D2D_POINT_2F point21;
    public D2D_POINT_2F point22;
    public D2D_POINT_2F point23;
    public D2D_POINT_2F point30;
    public D2D_POINT_2F point31;
    public D2D_POINT_2F point32;
    public D2D_POINT_2F point33;
    public D2D1_COLOR_F color00;
    public D2D1_COLOR_F color03;
    public D2D1_COLOR_F color30;
    public D2D1_COLOR_F color33;
    public int topEdgeMode;
    public int leftEdgeMode;
    public int bottomEdgeMode;
    public int rightEdgeMode;
}
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_COLOR_F
    Public r As Single
    Public g As Single
    Public b As Single
    Public a As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_GRADIENT_MESH_PATCH
    Public point00 As D2D_POINT_2F
    Public point01 As D2D_POINT_2F
    Public point02 As D2D_POINT_2F
    Public point03 As D2D_POINT_2F
    Public point10 As D2D_POINT_2F
    Public point11 As D2D_POINT_2F
    Public point12 As D2D_POINT_2F
    Public point13 As D2D_POINT_2F
    Public point20 As D2D_POINT_2F
    Public point21 As D2D_POINT_2F
    Public point22 As D2D_POINT_2F
    Public point23 As D2D_POINT_2F
    Public point30 As D2D_POINT_2F
    Public point31 As D2D_POINT_2F
    Public point32 As D2D_POINT_2F
    Public point33 As D2D_POINT_2F
    Public color00 As D2D1_COLOR_F
    Public color03 As D2D1_COLOR_F
    Public color30 As D2D1_COLOR_F
    Public color33 As D2D1_COLOR_F
    Public topEdgeMode As Integer
    Public leftEdgeMode As Integer
    Public bottomEdgeMode As Integer
    Public rightEdgeMode 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 D2D1_COLOR_F(ctypes.Structure):
    _fields_ = [
        ("r", ctypes.c_float),
        ("g", ctypes.c_float),
        ("b", ctypes.c_float),
        ("a", ctypes.c_float),
    ]

class D2D1_GRADIENT_MESH_PATCH(ctypes.Structure):
    _fields_ = [
        ("point00", D2D_POINT_2F),
        ("point01", D2D_POINT_2F),
        ("point02", D2D_POINT_2F),
        ("point03", D2D_POINT_2F),
        ("point10", D2D_POINT_2F),
        ("point11", D2D_POINT_2F),
        ("point12", D2D_POINT_2F),
        ("point13", D2D_POINT_2F),
        ("point20", D2D_POINT_2F),
        ("point21", D2D_POINT_2F),
        ("point22", D2D_POINT_2F),
        ("point23", D2D_POINT_2F),
        ("point30", D2D_POINT_2F),
        ("point31", D2D_POINT_2F),
        ("point32", D2D_POINT_2F),
        ("point33", D2D_POINT_2F),
        ("color00", D2D1_COLOR_F),
        ("color03", D2D1_COLOR_F),
        ("color30", D2D1_COLOR_F),
        ("color33", D2D1_COLOR_F),
        ("topEdgeMode", ctypes.c_int),
        ("leftEdgeMode", ctypes.c_int),
        ("bottomEdgeMode", ctypes.c_int),
        ("rightEdgeMode", ctypes.c_int),
    ]
#[repr(C)]
pub struct D2D_POINT_2F {
    pub x: f32,
    pub y: f32,
}

#[repr(C)]
pub struct D2D1_COLOR_F {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}

#[repr(C)]
pub struct D2D1_GRADIENT_MESH_PATCH {
    pub point00: D2D_POINT_2F,
    pub point01: D2D_POINT_2F,
    pub point02: D2D_POINT_2F,
    pub point03: D2D_POINT_2F,
    pub point10: D2D_POINT_2F,
    pub point11: D2D_POINT_2F,
    pub point12: D2D_POINT_2F,
    pub point13: D2D_POINT_2F,
    pub point20: D2D_POINT_2F,
    pub point21: D2D_POINT_2F,
    pub point22: D2D_POINT_2F,
    pub point23: D2D_POINT_2F,
    pub point30: D2D_POINT_2F,
    pub point31: D2D_POINT_2F,
    pub point32: D2D_POINT_2F,
    pub point33: D2D_POINT_2F,
    pub color00: D2D1_COLOR_F,
    pub color03: D2D1_COLOR_F,
    pub color30: D2D1_COLOR_F,
    pub color33: D2D1_COLOR_F,
    pub topEdgeMode: i32,
    pub leftEdgeMode: i32,
    pub bottomEdgeMode: i32,
    pub rightEdgeMode: i32,
}
import "golang.org/x/sys/windows"

type D2D_POINT_2F struct {
	x float32
	y float32
}

type D2D1_COLOR_F struct {
	r float32
	g float32
	b float32
	a float32
}

type D2D1_GRADIENT_MESH_PATCH struct {
	point00 D2D_POINT_2F
	point01 D2D_POINT_2F
	point02 D2D_POINT_2F
	point03 D2D_POINT_2F
	point10 D2D_POINT_2F
	point11 D2D_POINT_2F
	point12 D2D_POINT_2F
	point13 D2D_POINT_2F
	point20 D2D_POINT_2F
	point21 D2D_POINT_2F
	point22 D2D_POINT_2F
	point23 D2D_POINT_2F
	point30 D2D_POINT_2F
	point31 D2D_POINT_2F
	point32 D2D_POINT_2F
	point33 D2D_POINT_2F
	color00 D2D1_COLOR_F
	color03 D2D1_COLOR_F
	color30 D2D1_COLOR_F
	color33 D2D1_COLOR_F
	topEdgeMode int32
	leftEdgeMode int32
	bottomEdgeMode int32
	rightEdgeMode int32
}
type
  D2D_POINT_2F = record
    x: Single;
    y: Single;
  end;

  D2D1_COLOR_F = record
    r: Single;
    g: Single;
    b: Single;
    a: Single;
  end;

  D2D1_GRADIENT_MESH_PATCH = record
    point00: D2D_POINT_2F;
    point01: D2D_POINT_2F;
    point02: D2D_POINT_2F;
    point03: D2D_POINT_2F;
    point10: D2D_POINT_2F;
    point11: D2D_POINT_2F;
    point12: D2D_POINT_2F;
    point13: D2D_POINT_2F;
    point20: D2D_POINT_2F;
    point21: D2D_POINT_2F;
    point22: D2D_POINT_2F;
    point23: D2D_POINT_2F;
    point30: D2D_POINT_2F;
    point31: D2D_POINT_2F;
    point32: D2D_POINT_2F;
    point33: D2D_POINT_2F;
    color00: D2D1_COLOR_F;
    color03: D2D1_COLOR_F;
    color30: D2D1_COLOR_F;
    color33: D2D1_COLOR_F;
    topEdgeMode: Integer;
    leftEdgeMode: Integer;
    bottomEdgeMode: Integer;
    rightEdgeMode: Integer;
  end;
const D2D_POINT_2F = extern struct {
    x: f32,
    y: f32,
};

const D2D1_COLOR_F = extern struct {
    r: f32,
    g: f32,
    b: f32,
    a: f32,
};

const D2D1_GRADIENT_MESH_PATCH = extern struct {
    point00: D2D_POINT_2F,
    point01: D2D_POINT_2F,
    point02: D2D_POINT_2F,
    point03: D2D_POINT_2F,
    point10: D2D_POINT_2F,
    point11: D2D_POINT_2F,
    point12: D2D_POINT_2F,
    point13: D2D_POINT_2F,
    point20: D2D_POINT_2F,
    point21: D2D_POINT_2F,
    point22: D2D_POINT_2F,
    point23: D2D_POINT_2F,
    point30: D2D_POINT_2F,
    point31: D2D_POINT_2F,
    point32: D2D_POINT_2F,
    point33: D2D_POINT_2F,
    color00: D2D1_COLOR_F,
    color03: D2D1_COLOR_F,
    color30: D2D1_COLOR_F,
    color33: D2D1_COLOR_F,
    topEdgeMode: i32,
    leftEdgeMode: i32,
    bottomEdgeMode: i32,
    rightEdgeMode: i32,
};
type
  D2D_POINT_2F {.bycopy.} = object
    x: float32
    y: float32

  D2D1_COLOR_F {.bycopy.} = object
    r: float32
    g: float32
    b: float32
    a: float32

  D2D1_GRADIENT_MESH_PATCH {.bycopy.} = object
    point00: D2D_POINT_2F
    point01: D2D_POINT_2F
    point02: D2D_POINT_2F
    point03: D2D_POINT_2F
    point10: D2D_POINT_2F
    point11: D2D_POINT_2F
    point12: D2D_POINT_2F
    point13: D2D_POINT_2F
    point20: D2D_POINT_2F
    point21: D2D_POINT_2F
    point22: D2D_POINT_2F
    point23: D2D_POINT_2F
    point30: D2D_POINT_2F
    point31: D2D_POINT_2F
    point32: D2D_POINT_2F
    point33: D2D_POINT_2F
    color00: D2D1_COLOR_F
    color03: D2D1_COLOR_F
    color30: D2D1_COLOR_F
    color33: D2D1_COLOR_F
    topEdgeMode: int32
    leftEdgeMode: int32
    bottomEdgeMode: int32
    rightEdgeMode: int32
struct D2D_POINT_2F
{
    float x;
    float y;
}

struct D2D1_COLOR_F
{
    float r;
    float g;
    float b;
    float a;
}

struct D2D1_GRADIENT_MESH_PATCH
{
    D2D_POINT_2F point00;
    D2D_POINT_2F point01;
    D2D_POINT_2F point02;
    D2D_POINT_2F point03;
    D2D_POINT_2F point10;
    D2D_POINT_2F point11;
    D2D_POINT_2F point12;
    D2D_POINT_2F point13;
    D2D_POINT_2F point20;
    D2D_POINT_2F point21;
    D2D_POINT_2F point22;
    D2D_POINT_2F point23;
    D2D_POINT_2F point30;
    D2D_POINT_2F point31;
    D2D_POINT_2F point32;
    D2D_POINT_2F point33;
    D2D1_COLOR_F color00;
    D2D1_COLOR_F color03;
    D2D1_COLOR_F color30;
    D2D1_COLOR_F color33;
    int topEdgeMode;
    int leftEdgeMode;
    int bottomEdgeMode;
    int rightEdgeMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_GRADIENT_MESH_PATCH サイズ: 208 バイト(x64)
dim st, 52    ; 4byte整数×52(構造体サイズ 208 / 4 切り上げ)
; point00 : D2D_POINT_2F (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; point01 : D2D_POINT_2F (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; point02 : D2D_POINT_2F (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; point03 : D2D_POINT_2F (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; point10 : D2D_POINT_2F (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; point11 : D2D_POINT_2F (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; point12 : D2D_POINT_2F (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; point13 : D2D_POINT_2F (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; point20 : D2D_POINT_2F (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; point21 : D2D_POINT_2F (+72, 8byte)  varptr(st)+72 を基点に操作(8byte:入れ子/配列)
; point22 : D2D_POINT_2F (+80, 8byte)  varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; point23 : D2D_POINT_2F (+88, 8byte)  varptr(st)+88 を基点に操作(8byte:入れ子/配列)
; point30 : D2D_POINT_2F (+96, 8byte)  varptr(st)+96 を基点に操作(8byte:入れ子/配列)
; point31 : D2D_POINT_2F (+104, 8byte)  varptr(st)+104 を基点に操作(8byte:入れ子/配列)
; point32 : D2D_POINT_2F (+112, 8byte)  varptr(st)+112 を基点に操作(8byte:入れ子/配列)
; point33 : D2D_POINT_2F (+120, 8byte)  varptr(st)+120 を基点に操作(8byte:入れ子/配列)
; color00 : D2D1_COLOR_F (+128, 16byte)  varptr(st)+128 を基点に操作(16byte:入れ子/配列)
; color03 : D2D1_COLOR_F (+144, 16byte)  varptr(st)+144 を基点に操作(16byte:入れ子/配列)
; color30 : D2D1_COLOR_F (+160, 16byte)  varptr(st)+160 を基点に操作(16byte:入れ子/配列)
; color33 : D2D1_COLOR_F (+176, 16byte)  varptr(st)+176 を基点に操作(16byte:入れ子/配列)
; topEdgeMode : D2D1_PATCH_EDGE_MODE (+192, 4byte)  st.48 = 値  /  値 = st.48   (lpoke/lpeek も可)
; leftEdgeMode : D2D1_PATCH_EDGE_MODE (+196, 4byte)  st.49 = 値  /  値 = st.49   (lpoke/lpeek も可)
; bottomEdgeMode : D2D1_PATCH_EDGE_MODE (+200, 4byte)  st.50 = 値  /  値 = st.50   (lpoke/lpeek も可)
; rightEdgeMode : D2D1_PATCH_EDGE_MODE (+204, 4byte)  st.51 = 値  /  値 = st.51   (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_COLOR_F
    #field float r
    #field float g
    #field float b
    #field float a
#endstruct

#defstruct global D2D1_GRADIENT_MESH_PATCH
    #field D2D_POINT_2F point00
    #field D2D_POINT_2F point01
    #field D2D_POINT_2F point02
    #field D2D_POINT_2F point03
    #field D2D_POINT_2F point10
    #field D2D_POINT_2F point11
    #field D2D_POINT_2F point12
    #field D2D_POINT_2F point13
    #field D2D_POINT_2F point20
    #field D2D_POINT_2F point21
    #field D2D_POINT_2F point22
    #field D2D_POINT_2F point23
    #field D2D_POINT_2F point30
    #field D2D_POINT_2F point31
    #field D2D_POINT_2F point32
    #field D2D_POINT_2F point33
    #field D2D1_COLOR_F color00
    #field D2D1_COLOR_F color03
    #field D2D1_COLOR_F color30
    #field D2D1_COLOR_F color33
    #field int topEdgeMode
    #field int leftEdgeMode
    #field int bottomEdgeMode
    #field int rightEdgeMode
#endstruct

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