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

D2D1_LAYER_PARAMETERS

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

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

フィールド

フィールドサイズx64x86説明
contentBoundsD2D_RECT_F16+0+0レイヤー内容を制限する境界矩形。
geometricMaskID2D1Geometry*8/4+16+16レイヤーをクリップするジオメトリマスク。NULL可。
maskAntialiasModeD2D1_ANTIALIAS_MODE4+24+20マスクに適用するアンチエイリアスモード。
maskTransformD2D_MATRIX_3X2_F24+32+24マスクに適用する変換行列。
opacityFLOAT4+56+48レイヤー全体の不透明度。0.0〜1.0。
opacityBrushID2D1Brush*8/4+64+52不透明度を変調するブラシ。NULL可。
layerOptionsD2D1_LAYER_OPTIONS4+72+56レイヤーの追加オプションフラグ。

各言語での定義

#include <windows.h>

// D2D_RECT_F  (x64 16 / x86 16 バイト)
typedef struct D2D_RECT_F {
    FLOAT left;
    FLOAT top;
    FLOAT right;
    FLOAT bottom;
} D2D_RECT_F;

// D2D_MATRIX_3X2_F  (x64 24 / x86 24 バイト)
typedef struct D2D_MATRIX_3X2_F {
    _Anonymous_e__Union Anonymous;
} D2D_MATRIX_3X2_F;

// D2D1_LAYER_PARAMETERS  (x64 80 / x86 60 バイト)
typedef struct D2D1_LAYER_PARAMETERS {
    D2D_RECT_F contentBounds;
    ID2D1Geometry* geometricMask;
    D2D1_ANTIALIAS_MODE maskAntialiasMode;
    D2D_MATRIX_3X2_F maskTransform;
    FLOAT opacity;
    ID2D1Brush* opacityBrush;
    D2D1_LAYER_OPTIONS layerOptions;
} D2D1_LAYER_PARAMETERS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D_RECT_F
{
    public float left;
    public float top;
    public float right;
    public float bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D_MATRIX_3X2_F
{
    public _Anonymous_e__Union Anonymous;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_LAYER_PARAMETERS
{
    public D2D_RECT_F contentBounds;
    public IntPtr geometricMask;
    public int maskAntialiasMode;
    public D2D_MATRIX_3X2_F maskTransform;
    public float opacity;
    public IntPtr opacityBrush;
    public int layerOptions;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D_RECT_F
    Public left As Single
    Public top As Single
    Public right As Single
    Public bottom As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D_MATRIX_3X2_F
    Public Anonymous As _Anonymous_e__Union
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_LAYER_PARAMETERS
    Public contentBounds As D2D_RECT_F
    Public geometricMask As IntPtr
    Public maskAntialiasMode As Integer
    Public maskTransform As D2D_MATRIX_3X2_F
    Public opacity As Single
    Public opacityBrush As IntPtr
    Public layerOptions As Integer
End Structure
import ctypes
from ctypes import wintypes

class D2D_RECT_F(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_float),
        ("top", ctypes.c_float),
        ("right", ctypes.c_float),
        ("bottom", ctypes.c_float),
    ]

class D2D_MATRIX_3X2_F(ctypes.Structure):
    _fields_ = [
        ("Anonymous", _Anonymous_e__Union),
    ]

class D2D1_LAYER_PARAMETERS(ctypes.Structure):
    _fields_ = [
        ("contentBounds", D2D_RECT_F),
        ("geometricMask", ctypes.c_void_p),
        ("maskAntialiasMode", ctypes.c_int),
        ("maskTransform", D2D_MATRIX_3X2_F),
        ("opacity", ctypes.c_float),
        ("opacityBrush", ctypes.c_void_p),
        ("layerOptions", ctypes.c_int),
    ]
#[repr(C)]
pub struct D2D_RECT_F {
    pub left: f32,
    pub top: f32,
    pub right: f32,
    pub bottom: f32,
}

#[repr(C)]
pub struct D2D_MATRIX_3X2_F {
    pub Anonymous: _Anonymous_e__Union,
}

#[repr(C)]
pub struct D2D1_LAYER_PARAMETERS {
    pub contentBounds: D2D_RECT_F,
    pub geometricMask: *mut core::ffi::c_void,
    pub maskAntialiasMode: i32,
    pub maskTransform: D2D_MATRIX_3X2_F,
    pub opacity: f32,
    pub opacityBrush: *mut core::ffi::c_void,
    pub layerOptions: i32,
}
import "golang.org/x/sys/windows"

type D2D_RECT_F struct {
	left float32
	top float32
	right float32
	bottom float32
}

type D2D_MATRIX_3X2_F struct {
	Anonymous _Anonymous_e__Union
}

type D2D1_LAYER_PARAMETERS struct {
	contentBounds D2D_RECT_F
	geometricMask uintptr
	maskAntialiasMode int32
	maskTransform D2D_MATRIX_3X2_F
	opacity float32
	opacityBrush uintptr
	layerOptions int32
}
type
  D2D_RECT_F = record
    left: Single;
    top: Single;
    right: Single;
    bottom: Single;
  end;

  D2D_MATRIX_3X2_F = record
    Anonymous: _Anonymous_e__Union;
  end;

  D2D1_LAYER_PARAMETERS = record
    contentBounds: D2D_RECT_F;
    geometricMask: Pointer;
    maskAntialiasMode: Integer;
    maskTransform: D2D_MATRIX_3X2_F;
    opacity: Single;
    opacityBrush: Pointer;
    layerOptions: Integer;
  end;
const D2D_RECT_F = extern struct {
    left: f32,
    top: f32,
    right: f32,
    bottom: f32,
};

const D2D_MATRIX_3X2_F = extern struct {
    Anonymous: _Anonymous_e__Union,
};

const D2D1_LAYER_PARAMETERS = extern struct {
    contentBounds: D2D_RECT_F,
    geometricMask: ?*anyopaque,
    maskAntialiasMode: i32,
    maskTransform: D2D_MATRIX_3X2_F,
    opacity: f32,
    opacityBrush: ?*anyopaque,
    layerOptions: i32,
};
type
  D2D_RECT_F {.bycopy.} = object
    left: float32
    top: float32
    right: float32
    bottom: float32

  D2D_MATRIX_3X2_F {.bycopy.} = object
    Anonymous: _Anonymous_e__Union

  D2D1_LAYER_PARAMETERS {.bycopy.} = object
    contentBounds: D2D_RECT_F
    geometricMask: pointer
    maskAntialiasMode: int32
    maskTransform: D2D_MATRIX_3X2_F
    opacity: float32
    opacityBrush: pointer
    layerOptions: int32
struct D2D_RECT_F
{
    float left;
    float top;
    float right;
    float bottom;
}

struct D2D_MATRIX_3X2_F
{
    _Anonymous_e__Union Anonymous;
}

struct D2D1_LAYER_PARAMETERS
{
    D2D_RECT_F contentBounds;
    void* geometricMask;
    int maskAntialiasMode;
    D2D_MATRIX_3X2_F maskTransform;
    float opacity;
    void* opacityBrush;
    int layerOptions;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; D2D1_LAYER_PARAMETERS サイズ: 60 バイト(x86)
dim st, 15    ; 4byte整数×15(構造体サイズ 60 / 4 切り上げ)
; contentBounds : D2D_RECT_F (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; geometricMask : ID2D1Geometry* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; maskAntialiasMode : D2D1_ANTIALIAS_MODE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; maskTransform : D2D_MATRIX_3X2_F (+24, 24byte)  varptr(st)+24 を基点に操作(24byte:入れ子/配列)
; opacity : FLOAT (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; opacityBrush : ID2D1Brush* (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; layerOptions : D2D1_LAYER_OPTIONS (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_LAYER_PARAMETERS サイズ: 80 バイト(x64)
dim st, 20    ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; contentBounds : D2D_RECT_F (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; geometricMask : ID2D1Geometry* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; maskAntialiasMode : D2D1_ANTIALIAS_MODE (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; maskTransform : D2D_MATRIX_3X2_F (+32, 24byte)  varptr(st)+32 を基点に操作(24byte:入れ子/配列)
; opacity : FLOAT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; opacityBrush : ID2D1Brush* (+64, 8byte)  qpoke st,64,値 / qpeek(st,64)  ※IronHSPのみ。3.7/3.8は lpoke st,64,下位 : lpoke st,68,上位
; layerOptions : D2D1_LAYER_OPTIONS (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global D2D_RECT_F
    #field float left
    #field float top
    #field float right
    #field float bottom
#endstruct

#defstruct global D2D_MATRIX_3X2_F
    #field byte Anonymous 24
#endstruct

#defstruct global D2D1_LAYER_PARAMETERS
    #field D2D_RECT_F contentBounds
    #field intptr geometricMask
    #field int maskAntialiasMode
    #field D2D_MATRIX_3X2_F maskTransform
    #field float opacity
    #field intptr opacityBrush
    #field int layerOptions
#endstruct

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