ホーム › Graphics.Direct2D › D2D1_BLEND_DESCRIPTION
D2D1_BLEND_DESCRIPTION
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| sourceBlend | D2D1_BLEND | 4 | +0 | +0 | 色のソースブレンド係数。 |
| destinationBlend | D2D1_BLEND | 4 | +4 | +4 | 色のデスティネーションブレンド係数。 |
| blendOperation | D2D1_BLEND_OPERATION | 4 | +8 | +8 | 色のブレンド演算。 |
| sourceBlendAlpha | D2D1_BLEND | 4 | +12 | +12 | アルファのソースブレンド係数。 |
| destinationBlendAlpha | D2D1_BLEND | 4 | +16 | +16 | アルファのデスティネーションブレンド係数。 |
| blendOperationAlpha | D2D1_BLEND_OPERATION | 4 | +20 | +20 | アルファのブレンド演算。 |
| blendFactor | FLOAT | 16 | +24 | +24 | ブレンドに用いる定数係数(RGBA各成分)。 |
各言語での定義
#include <windows.h>
// D2D1_BLEND_DESCRIPTION (x64 40 / x86 40 バイト)
typedef struct D2D1_BLEND_DESCRIPTION {
D2D1_BLEND sourceBlend;
D2D1_BLEND destinationBlend;
D2D1_BLEND_OPERATION blendOperation;
D2D1_BLEND sourceBlendAlpha;
D2D1_BLEND destinationBlendAlpha;
D2D1_BLEND_OPERATION blendOperationAlpha;
FLOAT blendFactor[4];
} D2D1_BLEND_DESCRIPTION;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_BLEND_DESCRIPTION
{
public int sourceBlend;
public int destinationBlend;
public int blendOperation;
public int sourceBlendAlpha;
public int destinationBlendAlpha;
public int blendOperationAlpha;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public float[] blendFactor;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_BLEND_DESCRIPTION
Public sourceBlend As Integer
Public destinationBlend As Integer
Public blendOperation As Integer
Public sourceBlendAlpha As Integer
Public destinationBlendAlpha As Integer
Public blendOperationAlpha As Integer
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Public blendFactor() As Single
End Structureimport ctypes
from ctypes import wintypes
class D2D1_BLEND_DESCRIPTION(ctypes.Structure):
_fields_ = [
("sourceBlend", ctypes.c_int),
("destinationBlend", ctypes.c_int),
("blendOperation", ctypes.c_int),
("sourceBlendAlpha", ctypes.c_int),
("destinationBlendAlpha", ctypes.c_int),
("blendOperationAlpha", ctypes.c_int),
("blendFactor", ctypes.c_float * 4),
]#[repr(C)]
pub struct D2D1_BLEND_DESCRIPTION {
pub sourceBlend: i32,
pub destinationBlend: i32,
pub blendOperation: i32,
pub sourceBlendAlpha: i32,
pub destinationBlendAlpha: i32,
pub blendOperationAlpha: i32,
pub blendFactor: [f32; 4],
}import "golang.org/x/sys/windows"
type D2D1_BLEND_DESCRIPTION struct {
sourceBlend int32
destinationBlend int32
blendOperation int32
sourceBlendAlpha int32
destinationBlendAlpha int32
blendOperationAlpha int32
blendFactor [4]float32
}type
D2D1_BLEND_DESCRIPTION = record
sourceBlend: Integer;
destinationBlend: Integer;
blendOperation: Integer;
sourceBlendAlpha: Integer;
destinationBlendAlpha: Integer;
blendOperationAlpha: Integer;
blendFactor: array[0..3] of Single;
end;const D2D1_BLEND_DESCRIPTION = extern struct {
sourceBlend: i32,
destinationBlend: i32,
blendOperation: i32,
sourceBlendAlpha: i32,
destinationBlendAlpha: i32,
blendOperationAlpha: i32,
blendFactor: [4]f32,
};type
D2D1_BLEND_DESCRIPTION {.bycopy.} = object
sourceBlend: int32
destinationBlend: int32
blendOperation: int32
sourceBlendAlpha: int32
destinationBlendAlpha: int32
blendOperationAlpha: int32
blendFactor: array[4, float32]struct D2D1_BLEND_DESCRIPTION
{
int sourceBlend;
int destinationBlend;
int blendOperation;
int sourceBlendAlpha;
int destinationBlendAlpha;
int blendOperationAlpha;
float[4] blendFactor;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_BLEND_DESCRIPTION サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; sourceBlend : D2D1_BLEND (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; destinationBlend : D2D1_BLEND (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; blendOperation : D2D1_BLEND_OPERATION (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; sourceBlendAlpha : D2D1_BLEND (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; destinationBlendAlpha : D2D1_BLEND (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; blendOperationAlpha : D2D1_BLEND_OPERATION (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; blendFactor : FLOAT (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D2D1_BLEND_DESCRIPTION
#field int sourceBlend
#field int destinationBlend
#field int blendOperation
#field int sourceBlendAlpha
#field int destinationBlendAlpha
#field int blendOperationAlpha
#field float blendFactor 4
#endstruct
stdim st, D2D1_BLEND_DESCRIPTION ; NSTRUCT 変数を確保
st->sourceBlend = 100
mes "sourceBlend=" + st->sourceBlend