ホーム › UI.Xaml.Diagnostics › BitmapDescription
BitmapDescription
構造体サイズ=各フィールドのバイト数(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 | ビットマップのピクセル形式(DXGI_FORMAT)である。 |
| AlphaMode | DXGI_ALPHA_MODE | 4 | +12 | +12 | ビットマップのアルファモード(DXGI_ALPHA_MODE)である。 |
各言語での定義
#include <windows.h>
// BitmapDescription (x64 16 / x86 16 バイト)
typedef struct BitmapDescription {
DWORD Width;
DWORD Height;
DXGI_FORMAT Format;
DXGI_ALPHA_MODE AlphaMode;
} BitmapDescription;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct BitmapDescription
{
public uint Width;
public uint Height;
public int Format;
public int AlphaMode;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure BitmapDescription
Public Width As UInteger
Public Height As UInteger
Public Format As Integer
Public AlphaMode As Integer
End Structureimport ctypes
from ctypes import wintypes
class BitmapDescription(ctypes.Structure):
_fields_ = [
("Width", wintypes.DWORD),
("Height", wintypes.DWORD),
("Format", ctypes.c_int),
("AlphaMode", ctypes.c_int),
]#[repr(C)]
pub struct BitmapDescription {
pub Width: u32,
pub Height: u32,
pub Format: i32,
pub AlphaMode: i32,
}import "golang.org/x/sys/windows"
type BitmapDescription struct {
Width uint32
Height uint32
Format int32
AlphaMode int32
}type
BitmapDescription = record
Width: DWORD;
Height: DWORD;
Format: Integer;
AlphaMode: Integer;
end;const BitmapDescription = extern struct {
Width: u32,
Height: u32,
Format: i32,
AlphaMode: i32,
};type
BitmapDescription {.bycopy.} = object
Width: uint32
Height: uint32
Format: int32
AlphaMode: int32struct BitmapDescription
{
uint Width;
uint Height;
int Format;
int AlphaMode;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; BitmapDescription サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 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 も可)
; AlphaMode : DXGI_ALPHA_MODE (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global BitmapDescription
#field int Width
#field int Height
#field int Format
#field int AlphaMode
#endstruct
stdim st, BitmapDescription ; NSTRUCT 変数を確保
st->Width = 100
mes "Width=" + st->Width