ホーム › Graphics.Dxgi › DXGI_SURFACE_DESC
DXGI_SURFACE_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Width | DWORD | 4 | +0 | +0 | サーフェスの幅(ピクセル数)。 |
| Height | DWORD | 4 | +4 | +4 | サーフェスの高さ(ピクセル数)。 |
| Format | DXGI_FORMAT | 4 | +8 | +8 | サーフェスのピクセルフォーマットを示す列挙値。 |
| SampleDesc | DXGI_SAMPLE_DESC | 8 | +12 | +12 | マルチサンプリングのパラメータを表すDXGI_SAMPLE_DESC。 |
各言語での定義
#include <windows.h>
// DXGI_SAMPLE_DESC (x64 8 / x86 8 バイト)
typedef struct DXGI_SAMPLE_DESC {
DWORD Count;
DWORD Quality;
} DXGI_SAMPLE_DESC;
// DXGI_SURFACE_DESC (x64 20 / x86 20 バイト)
typedef struct DXGI_SURFACE_DESC {
DWORD Width;
DWORD Height;
DXGI_FORMAT Format;
DXGI_SAMPLE_DESC SampleDesc;
} DXGI_SURFACE_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_SAMPLE_DESC
{
public uint Count;
public uint Quality;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXGI_SURFACE_DESC
{
public uint Width;
public uint Height;
public int Format;
public DXGI_SAMPLE_DESC SampleDesc;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_SAMPLE_DESC
Public Count As UInteger
Public Quality As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXGI_SURFACE_DESC
Public Width As UInteger
Public Height As UInteger
Public Format As Integer
Public SampleDesc As DXGI_SAMPLE_DESC
End Structureimport ctypes
from ctypes import wintypes
class DXGI_SAMPLE_DESC(ctypes.Structure):
_fields_ = [
("Count", wintypes.DWORD),
("Quality", wintypes.DWORD),
]
class DXGI_SURFACE_DESC(ctypes.Structure):
_fields_ = [
("Width", wintypes.DWORD),
("Height", wintypes.DWORD),
("Format", ctypes.c_int),
("SampleDesc", DXGI_SAMPLE_DESC),
]#[repr(C)]
pub struct DXGI_SAMPLE_DESC {
pub Count: u32,
pub Quality: u32,
}
#[repr(C)]
pub struct DXGI_SURFACE_DESC {
pub Width: u32,
pub Height: u32,
pub Format: i32,
pub SampleDesc: DXGI_SAMPLE_DESC,
}import "golang.org/x/sys/windows"
type DXGI_SAMPLE_DESC struct {
Count uint32
Quality uint32
}
type DXGI_SURFACE_DESC struct {
Width uint32
Height uint32
Format int32
SampleDesc DXGI_SAMPLE_DESC
}type
DXGI_SAMPLE_DESC = record
Count: DWORD;
Quality: DWORD;
end;
DXGI_SURFACE_DESC = record
Width: DWORD;
Height: DWORD;
Format: Integer;
SampleDesc: DXGI_SAMPLE_DESC;
end;const DXGI_SAMPLE_DESC = extern struct {
Count: u32,
Quality: u32,
};
const DXGI_SURFACE_DESC = extern struct {
Width: u32,
Height: u32,
Format: i32,
SampleDesc: DXGI_SAMPLE_DESC,
};type
DXGI_SAMPLE_DESC {.bycopy.} = object
Count: uint32
Quality: uint32
DXGI_SURFACE_DESC {.bycopy.} = object
Width: uint32
Height: uint32
Format: int32
SampleDesc: DXGI_SAMPLE_DESCstruct DXGI_SAMPLE_DESC
{
uint Count;
uint Quality;
}
struct DXGI_SURFACE_DESC
{
uint Width;
uint Height;
int Format;
DXGI_SAMPLE_DESC SampleDesc;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DXGI_SURFACE_DESC サイズ: 20 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; Width : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; Height : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; Format : DXGI_FORMAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; SampleDesc : DXGI_SAMPLE_DESC (+12, 8byte) varptr(st)+12 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DXGI_SAMPLE_DESC
#field int Count
#field int Quality
#endstruct
#defstruct global DXGI_SURFACE_DESC
#field int Width
#field int Height
#field int Format
#field DXGI_SAMPLE_DESC SampleDesc
#endstruct
stdim st, DXGI_SURFACE_DESC ; NSTRUCT 変数を確保
st->Width = 100
mes "Width=" + st->Width