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

D2D1_IMAGE_BRUSH_PROPERTIES

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

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

フィールド

フィールドサイズx64x86説明
sourceRectangleD2D_RECT_F16+0+0イメージから使用する元矩形領域。
extendModeXD2D1_EXTEND_MODE4+16+16X方向の拡張モード。
extendModeYD2D1_EXTEND_MODE4+20+20Y方向の拡張モード。
interpolationModeD2D1_INTERPOLATION_MODE4+24+24拡大縮小時の補間モード。

各言語での定義

#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;

// D2D1_IMAGE_BRUSH_PROPERTIES  (x64 28 / x86 28 バイト)
typedef struct D2D1_IMAGE_BRUSH_PROPERTIES {
    D2D_RECT_F sourceRectangle;
    D2D1_EXTEND_MODE extendModeX;
    D2D1_EXTEND_MODE extendModeY;
    D2D1_INTERPOLATION_MODE interpolationMode;
} D2D1_IMAGE_BRUSH_PROPERTIES;
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 D2D1_IMAGE_BRUSH_PROPERTIES
{
    public D2D_RECT_F sourceRectangle;
    public int extendModeX;
    public int extendModeY;
    public int interpolationMode;
}
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 D2D1_IMAGE_BRUSH_PROPERTIES
    Public sourceRectangle As D2D_RECT_F
    Public extendModeX As Integer
    Public extendModeY As Integer
    Public interpolationMode 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 D2D1_IMAGE_BRUSH_PROPERTIES(ctypes.Structure):
    _fields_ = [
        ("sourceRectangle", D2D_RECT_F),
        ("extendModeX", ctypes.c_int),
        ("extendModeY", ctypes.c_int),
        ("interpolationMode", 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 D2D1_IMAGE_BRUSH_PROPERTIES {
    pub sourceRectangle: D2D_RECT_F,
    pub extendModeX: i32,
    pub extendModeY: i32,
    pub interpolationMode: i32,
}
import "golang.org/x/sys/windows"

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

type D2D1_IMAGE_BRUSH_PROPERTIES struct {
	sourceRectangle D2D_RECT_F
	extendModeX int32
	extendModeY int32
	interpolationMode int32
}
type
  D2D_RECT_F = record
    left: Single;
    top: Single;
    right: Single;
    bottom: Single;
  end;

  D2D1_IMAGE_BRUSH_PROPERTIES = record
    sourceRectangle: D2D_RECT_F;
    extendModeX: Integer;
    extendModeY: Integer;
    interpolationMode: Integer;
  end;
const D2D_RECT_F = extern struct {
    left: f32,
    top: f32,
    right: f32,
    bottom: f32,
};

const D2D1_IMAGE_BRUSH_PROPERTIES = extern struct {
    sourceRectangle: D2D_RECT_F,
    extendModeX: i32,
    extendModeY: i32,
    interpolationMode: i32,
};
type
  D2D_RECT_F {.bycopy.} = object
    left: float32
    top: float32
    right: float32
    bottom: float32

  D2D1_IMAGE_BRUSH_PROPERTIES {.bycopy.} = object
    sourceRectangle: D2D_RECT_F
    extendModeX: int32
    extendModeY: int32
    interpolationMode: int32
struct D2D_RECT_F
{
    float left;
    float top;
    float right;
    float bottom;
}

struct D2D1_IMAGE_BRUSH_PROPERTIES
{
    D2D_RECT_F sourceRectangle;
    int extendModeX;
    int extendModeY;
    int interpolationMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D2D1_IMAGE_BRUSH_PROPERTIES サイズ: 28 バイト(x64)
dim st, 7    ; 4byte整数×7(構造体サイズ 28 / 4 切り上げ)
; sourceRectangle : D2D_RECT_F (+0, 16byte)  varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; extendModeX : D2D1_EXTEND_MODE (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; extendModeY : D2D1_EXTEND_MODE (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; interpolationMode : D2D1_INTERPOLATION_MODE (+24, 4byte)  st.6 = 値  /  値 = st.6   (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 D2D1_IMAGE_BRUSH_PROPERTIES
    #field D2D_RECT_F sourceRectangle
    #field int extendModeX
    #field int extendModeY
    #field int interpolationMode
#endstruct

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