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

D3DBOX

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

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

フィールド

フィールドサイズx64x86説明
LeftDWORD4+0+0ボックスの左端座標。
TopDWORD4+4+4ボックスの上端座標。
RightDWORD4+8+8ボックスの右端座標(排他的)。
BottomDWORD4+12+12ボックスの下端座標(排他的)。
FrontDWORD4+16+16ボックスの手前面座標。
BackDWORD4+20+20ボックスの奥面座標(排他的)。

公式ドキュメント

ボリュームを定義します。

解説(Remarks)

D3DBOX には左端、上端、前端の辺が含まれますが、右端、下端、後端の辺は含まれません。たとえば、幅が 100 単位で 0 から始まる(つまり 99 までの点を含む)ボックスは、Left メンバーの値を 0、Right メンバーの値を 100 として表現します。Right メンバーに 99 という値は使用しないことに注意してください。

D3DBOX で守られる辺の順序の制約は、左から右、上から下、前から後ろです。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp)

各言語での定義

#include <windows.h>

// D3DBOX  (x64 24 / x86 24 バイト)
typedef struct D3DBOX {
    DWORD Left;
    DWORD Top;
    DWORD Right;
    DWORD Bottom;
    DWORD Front;
    DWORD Back;
} D3DBOX;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3DBOX
{
    public uint Left;
    public uint Top;
    public uint Right;
    public uint Bottom;
    public uint Front;
    public uint Back;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3DBOX
    Public Left As UInteger
    Public Top As UInteger
    Public Right As UInteger
    Public Bottom As UInteger
    Public Front As UInteger
    Public Back As UInteger
End Structure
import ctypes
from ctypes import wintypes

class D3DBOX(ctypes.Structure):
    _fields_ = [
        ("Left", wintypes.DWORD),
        ("Top", wintypes.DWORD),
        ("Right", wintypes.DWORD),
        ("Bottom", wintypes.DWORD),
        ("Front", wintypes.DWORD),
        ("Back", wintypes.DWORD),
    ]
#[repr(C)]
pub struct D3DBOX {
    pub Left: u32,
    pub Top: u32,
    pub Right: u32,
    pub Bottom: u32,
    pub Front: u32,
    pub Back: u32,
}
import "golang.org/x/sys/windows"

type D3DBOX struct {
	Left uint32
	Top uint32
	Right uint32
	Bottom uint32
	Front uint32
	Back uint32
}
type
  D3DBOX = record
    Left: DWORD;
    Top: DWORD;
    Right: DWORD;
    Bottom: DWORD;
    Front: DWORD;
    Back: DWORD;
  end;
const D3DBOX = extern struct {
    Left: u32,
    Top: u32,
    Right: u32,
    Bottom: u32,
    Front: u32,
    Back: u32,
};
type
  D3DBOX {.bycopy.} = object
    Left: uint32
    Top: uint32
    Right: uint32
    Bottom: uint32
    Front: uint32
    Back: uint32
struct D3DBOX
{
    uint Left;
    uint Top;
    uint Right;
    uint Bottom;
    uint Front;
    uint Back;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; D3DBOX サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; Left : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Top : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Right : DWORD (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; Bottom : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; Front : DWORD (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; Back : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global D3DBOX
    #field int Left
    #field int Top
    #field int Right
    #field int Bottom
    #field int Front
    #field int Back
#endstruct

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