ホーム › Graphics.Direct2D › D2D1_GRADIENT_MESH_PATCH
D2D1_GRADIENT_MESH_PATCH
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| point00 | D2D_POINT_2F | 8 | +0 | +0 | クーンズパッチの格子点(0,0)。 |
| point01 | D2D_POINT_2F | 8 | +8 | +8 | クーンズパッチの格子点(0,1)。 |
| point02 | D2D_POINT_2F | 8 | +16 | +16 | クーンズパッチの格子点(0,2)。 |
| point03 | D2D_POINT_2F | 8 | +24 | +24 | クーンズパッチの格子点(0,3)。 |
| point10 | D2D_POINT_2F | 8 | +32 | +32 | クーンズパッチの格子点(1,0)。 |
| point11 | D2D_POINT_2F | 8 | +40 | +40 | クーンズパッチの内部制御点(1,1)。 |
| point12 | D2D_POINT_2F | 8 | +48 | +48 | クーンズパッチの内部制御点(1,2)。 |
| point13 | D2D_POINT_2F | 8 | +56 | +56 | クーンズパッチの格子点(1,3)。 |
| point20 | D2D_POINT_2F | 8 | +64 | +64 | クーンズパッチの格子点(2,0)。 |
| point21 | D2D_POINT_2F | 8 | +72 | +72 | クーンズパッチの内部制御点(2,1)。 |
| point22 | D2D_POINT_2F | 8 | +80 | +80 | クーンズパッチの内部制御点(2,2)。 |
| point23 | D2D_POINT_2F | 8 | +88 | +88 | クーンズパッチの格子点(2,3)。 |
| point30 | D2D_POINT_2F | 8 | +96 | +96 | クーンズパッチの格子点(3,0)。 |
| point31 | D2D_POINT_2F | 8 | +104 | +104 | クーンズパッチの格子点(3,1)。 |
| point32 | D2D_POINT_2F | 8 | +112 | +112 | クーンズパッチの格子点(3,2)。 |
| point33 | D2D_POINT_2F | 8 | +120 | +120 | クーンズパッチの格子点(3,3)。 |
| color00 | D2D1_COLOR_F | 16 | +128 | +128 | 角(0,0)の色。 |
| color03 | D2D1_COLOR_F | 16 | +144 | +144 | 角(0,3)の色。 |
| color30 | D2D1_COLOR_F | 16 | +160 | +160 | 角(3,0)の色。 |
| color33 | D2D1_COLOR_F | 16 | +176 | +176 | 角(3,3)の色。 |
| topEdgeMode | D2D1_PATCH_EDGE_MODE | 4 | +192 | +192 | 上端の色補間エッジモード。 |
| leftEdgeMode | D2D1_PATCH_EDGE_MODE | 4 | +196 | +196 | 左端の色補間エッジモード。 |
| bottomEdgeMode | D2D1_PATCH_EDGE_MODE | 4 | +200 | +200 | 下端の色補間エッジモード。 |
| rightEdgeMode | D2D1_PATCH_EDGE_MODE | 4 | +204 | +204 | 右端の色補間エッジモード。 |
各言語での定義
#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 Structureimport 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: int32struct 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