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

D3DCOMPOSERECTDESTINATION

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

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

フィールド

フィールドサイズx64x86説明
SrcRectIndexWORD2+0+0対応するソース矩形のインデックス(WORD)。
ReservedWORD2+2+2予約フィールド。0でなければならない。
XSHORT2+4+4合成先のX座標(符号付きSHORT)。
YSHORT2+6+6合成先のY座標(符号付きSHORT)。

各言語での定義

#include <windows.h>

// D3DCOMPOSERECTDESTINATION  (x64 8 / x86 8 バイト)
typedef struct D3DCOMPOSERECTDESTINATION {
    WORD SrcRectIndex;
    WORD Reserved;
    SHORT X;
    SHORT Y;
} D3DCOMPOSERECTDESTINATION;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DCOMPOSERECTDESTINATION
{
    public ushort SrcRectIndex;
    public ushort Reserved;
    public short X;
    public short Y;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DCOMPOSERECTDESTINATION
    Public SrcRectIndex As UShort
    Public Reserved As UShort
    Public X As Short
    Public Y As Short
End Structure
import ctypes
from ctypes import wintypes

class D3DCOMPOSERECTDESTINATION(ctypes.Structure):
    _fields_ = [
        ("SrcRectIndex", ctypes.c_ushort),
        ("Reserved", ctypes.c_ushort),
        ("X", ctypes.c_short),
        ("Y", ctypes.c_short),
    ]
#[repr(C)]
pub struct D3DCOMPOSERECTDESTINATION {
    pub SrcRectIndex: u16,
    pub Reserved: u16,
    pub X: i16,
    pub Y: i16,
}
import "golang.org/x/sys/windows"

type D3DCOMPOSERECTDESTINATION struct {
	SrcRectIndex uint16
	Reserved uint16
	X int16
	Y int16
}
type
  D3DCOMPOSERECTDESTINATION = record
    SrcRectIndex: Word;
    Reserved: Word;
    X: Smallint;
    Y: Smallint;
  end;
const D3DCOMPOSERECTDESTINATION = extern struct {
    SrcRectIndex: u16,
    Reserved: u16,
    X: i16,
    Y: i16,
};
type
  D3DCOMPOSERECTDESTINATION {.bycopy.} = object
    SrcRectIndex: uint16
    Reserved: uint16
    X: int16
    Y: int16
struct D3DCOMPOSERECTDESTINATION
{
    ushort SrcRectIndex;
    ushort Reserved;
    short X;
    short Y;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DCOMPOSERECTDESTINATION サイズ: 8 バイト(x64)
dim st, 2    ; 4byte整数×2(構造体サイズ 8 / 4 切り上げ)
; SrcRectIndex : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; Reserved : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; X : SHORT (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; Y : SHORT (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DCOMPOSERECTDESTINATION
    #field short SrcRectIndex
    #field short Reserved
    #field short X
    #field short Y
#endstruct

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