ホーム › Devices.Display › SURFOBJ
SURFOBJ
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dhsurf | DHSURF | 8/4 | +0 | +0 | ドライバ定義のサーフェスハンドル(DHSURF)。 |
| hsurf | HSURF | 8/4 | +8 | +4 | GDIサーフェスハンドル(HSURF)。 |
| dhpdev | DHPDEV | 8/4 | +16 | +8 | ドライバ定義の物理デバイスハンドル(DHPDEV)。 |
| hdev | HDEV | 8/4 | +24 | +12 | デバイスハンドル(HDEV)。 |
| sizlBitmap | SIZE | 8 | +32 | +16 | ビットマップの幅と高さ(SIZE、ピクセル単位)。 |
| cjBits | DWORD | 4 | +40 | +24 | ビットマップビット全体のバイトサイズ。 |
| pvBits | void* | 8/4 | +48 | +28 | ビットマップビットの先頭へのポインタ。 |
| pvScan0 | void* | 8/4 | +56 | +32 | スキャンライン0の先頭へのポインタ。 |
| lDelta | INT | 4 | +64 | +36 | 次のスキャンラインまでのバイト数(負なら下から上)。 |
| iUniq | DWORD | 4 | +68 | +40 | サーフェスの一意識別番号。 |
| iBitmapFormat | DWORD | 4 | +72 | +44 | ビットマップのピクセル形式(BMF_*)。 |
| iType | WORD | 2 | +76 | +48 | サーフェス種別(STYPE_BITMAP等)。 |
| fjBitmap | WORD | 2 | +78 | +50 | ビットマップ属性フラグ(BMF_TOPDOWN等)。 |
各言語での定義
#include <windows.h>
// SIZE (x64 8 / x86 8 バイト)
typedef struct SIZE {
INT cx;
INT cy;
} SIZE;
// SURFOBJ (x64 80 / x86 52 バイト)
typedef struct SURFOBJ {
DHSURF dhsurf;
HSURF hsurf;
DHPDEV dhpdev;
HDEV hdev;
SIZE sizlBitmap;
DWORD cjBits;
void* pvBits;
void* pvScan0;
INT lDelta;
DWORD iUniq;
DWORD iBitmapFormat;
WORD iType;
WORD fjBitmap;
} SURFOBJ;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
public int cx;
public int cy;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SURFOBJ
{
public IntPtr dhsurf;
public IntPtr hsurf;
public IntPtr dhpdev;
public IntPtr hdev;
public SIZE sizlBitmap;
public uint cjBits;
public IntPtr pvBits;
public IntPtr pvScan0;
public int lDelta;
public uint iUniq;
public uint iBitmapFormat;
public ushort iType;
public ushort fjBitmap;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
Public cx As Integer
Public cy As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SURFOBJ
Public dhsurf As IntPtr
Public hsurf As IntPtr
Public dhpdev As IntPtr
Public hdev As IntPtr
Public sizlBitmap As SIZE
Public cjBits As UInteger
Public pvBits As IntPtr
Public pvScan0 As IntPtr
Public lDelta As Integer
Public iUniq As UInteger
Public iBitmapFormat As UInteger
Public iType As UShort
Public fjBitmap As UShort
End Structureimport ctypes
from ctypes import wintypes
class SIZE(ctypes.Structure):
_fields_ = [
("cx", ctypes.c_int),
("cy", ctypes.c_int),
]
class SURFOBJ(ctypes.Structure):
_fields_ = [
("dhsurf", ctypes.c_void_p),
("hsurf", ctypes.c_void_p),
("dhpdev", ctypes.c_void_p),
("hdev", ctypes.c_void_p),
("sizlBitmap", SIZE),
("cjBits", wintypes.DWORD),
("pvBits", ctypes.c_void_p),
("pvScan0", ctypes.c_void_p),
("lDelta", ctypes.c_int),
("iUniq", wintypes.DWORD),
("iBitmapFormat", wintypes.DWORD),
("iType", ctypes.c_ushort),
("fjBitmap", ctypes.c_ushort),
]#[repr(C)]
pub struct SIZE {
pub cx: i32,
pub cy: i32,
}
#[repr(C)]
pub struct SURFOBJ {
pub dhsurf: *mut core::ffi::c_void,
pub hsurf: *mut core::ffi::c_void,
pub dhpdev: *mut core::ffi::c_void,
pub hdev: *mut core::ffi::c_void,
pub sizlBitmap: SIZE,
pub cjBits: u32,
pub pvBits: *mut core::ffi::c_void,
pub pvScan0: *mut core::ffi::c_void,
pub lDelta: i32,
pub iUniq: u32,
pub iBitmapFormat: u32,
pub iType: u16,
pub fjBitmap: u16,
}import "golang.org/x/sys/windows"
type SIZE struct {
cx int32
cy int32
}
type SURFOBJ struct {
dhsurf uintptr
hsurf uintptr
dhpdev uintptr
hdev uintptr
sizlBitmap SIZE
cjBits uint32
pvBits uintptr
pvScan0 uintptr
lDelta int32
iUniq uint32
iBitmapFormat uint32
iType uint16
fjBitmap uint16
}type
SIZE = record
cx: Integer;
cy: Integer;
end;
SURFOBJ = record
dhsurf: Pointer;
hsurf: Pointer;
dhpdev: Pointer;
hdev: Pointer;
sizlBitmap: SIZE;
cjBits: DWORD;
pvBits: Pointer;
pvScan0: Pointer;
lDelta: Integer;
iUniq: DWORD;
iBitmapFormat: DWORD;
iType: Word;
fjBitmap: Word;
end;const SIZE = extern struct {
cx: i32,
cy: i32,
};
const SURFOBJ = extern struct {
dhsurf: ?*anyopaque,
hsurf: ?*anyopaque,
dhpdev: ?*anyopaque,
hdev: ?*anyopaque,
sizlBitmap: SIZE,
cjBits: u32,
pvBits: ?*anyopaque,
pvScan0: ?*anyopaque,
lDelta: i32,
iUniq: u32,
iBitmapFormat: u32,
iType: u16,
fjBitmap: u16,
};type
SIZE {.bycopy.} = object
cx: int32
cy: int32
SURFOBJ {.bycopy.} = object
dhsurf: pointer
hsurf: pointer
dhpdev: pointer
hdev: pointer
sizlBitmap: SIZE
cjBits: uint32
pvBits: pointer
pvScan0: pointer
lDelta: int32
iUniq: uint32
iBitmapFormat: uint32
iType: uint16
fjBitmap: uint16struct SIZE
{
int cx;
int cy;
}
struct SURFOBJ
{
void* dhsurf;
void* hsurf;
void* dhpdev;
void* hdev;
SIZE sizlBitmap;
uint cjBits;
void* pvBits;
void* pvScan0;
int lDelta;
uint iUniq;
uint iBitmapFormat;
ushort iType;
ushort fjBitmap;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; SURFOBJ サイズ: 52 バイト(x86)
dim st, 13 ; 4byte整数×13(構造体サイズ 52 / 4 切り上げ)
; dhsurf : DHSURF (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; hsurf : HSURF (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; dhpdev : DHPDEV (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; hdev : HDEV (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; sizlBitmap : SIZE (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; cjBits : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; pvBits : void* (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; pvScan0 : void* (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; lDelta : INT (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; iUniq : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; iBitmapFormat : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; iType : WORD (+48, 2byte) wpoke st,48,値 / 値 = wpeek(st,48)
; fjBitmap : WORD (+50, 2byte) wpoke st,50,値 / 値 = wpeek(st,50)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; SURFOBJ サイズ: 80 バイト(x64)
dim st, 20 ; 4byte整数×20(構造体サイズ 80 / 4 切り上げ)
; dhsurf : DHSURF (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; hsurf : HSURF (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; dhpdev : DHPDEV (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; hdev : HDEV (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; sizlBitmap : SIZE (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; cjBits : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; pvBits : void* (+48, 8byte) qpoke st,48,値 / qpeek(st,48) ※IronHSPのみ。3.7/3.8は lpoke st,48,下位 : lpoke st,52,上位
; pvScan0 : void* (+56, 8byte) qpoke st,56,値 / qpeek(st,56) ※IronHSPのみ。3.7/3.8は lpoke st,56,下位 : lpoke st,60,上位
; lDelta : INT (+64, 4byte) st.16 = 値 / 値 = st.16 (lpoke/lpeek も可)
; iUniq : DWORD (+68, 4byte) st.17 = 値 / 値 = st.17 (lpoke/lpeek も可)
; iBitmapFormat : DWORD (+72, 4byte) st.18 = 値 / 値 = st.18 (lpoke/lpeek も可)
; iType : WORD (+76, 2byte) wpoke st,76,値 / 値 = wpeek(st,76)
; fjBitmap : WORD (+78, 2byte) wpoke st,78,値 / 値 = wpeek(st,78)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global SIZE
#field int cx
#field int cy
#endstruct
#defstruct global SURFOBJ
#field intptr dhsurf
#field intptr hsurf
#field intptr dhpdev
#field intptr hdev
#field SIZE sizlBitmap
#field int cjBits
#field intptr pvBits
#field intptr pvScan0
#field int lDelta
#field int iUniq
#field int iBitmapFormat
#field short iType
#field short fjBitmap
#endstruct
stdim st, SURFOBJ ; NSTRUCT 変数を確保
st->cjBits = 100
mes "cjBits=" + st->cjBits