ホーム › UI.Magnification › MAGIMAGEHEADER
MAGIMAGEHEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| width | DWORD | 4 | +0 | +0 | 画像の幅(ピクセル)。 |
| height | DWORD | 4 | +4 | +4 | 画像の高さ(ピクセル)。 |
| format | GUID | 16 | +8 | +8 | 画像のピクセルフォーマットを示すGUID。 |
| stride | DWORD | 4 | +24 | +24 | 1行分のバイト数(ストライド)。 |
| offset | DWORD | 4 | +28 | +28 | 画像データへの開始オフセット。 |
| cbSize | UINT_PTR | 8/4 | +32 | +32 | 画像データ全体のバイトサイズ。 |
各言語での定義
#include <windows.h>
// MAGIMAGEHEADER (x64 40 / x86 36 バイト)
typedef struct MAGIMAGEHEADER {
DWORD width;
DWORD height;
GUID format;
DWORD stride;
DWORD offset;
UINT_PTR cbSize;
} MAGIMAGEHEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MAGIMAGEHEADER
{
public uint width;
public uint height;
public Guid format;
public uint stride;
public uint offset;
public UIntPtr cbSize;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MAGIMAGEHEADER
Public width As UInteger
Public height As UInteger
Public format As Guid
Public stride As UInteger
Public offset As UInteger
Public cbSize As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class MAGIMAGEHEADER(ctypes.Structure):
_fields_ = [
("width", wintypes.DWORD),
("height", wintypes.DWORD),
("format", GUID),
("stride", wintypes.DWORD),
("offset", wintypes.DWORD),
("cbSize", ctypes.c_size_t),
]#[repr(C)]
pub struct MAGIMAGEHEADER {
pub width: u32,
pub height: u32,
pub format: GUID,
pub stride: u32,
pub offset: u32,
pub cbSize: usize,
}import "golang.org/x/sys/windows"
type MAGIMAGEHEADER struct {
width uint32
height uint32
format windows.GUID
stride uint32
offset uint32
cbSize uintptr
}type
MAGIMAGEHEADER = record
width: DWORD;
height: DWORD;
format: TGUID;
stride: DWORD;
offset: DWORD;
cbSize: NativeUInt;
end;const MAGIMAGEHEADER = extern struct {
width: u32,
height: u32,
format: GUID,
stride: u32,
offset: u32,
cbSize: usize,
};type
MAGIMAGEHEADER {.bycopy.} = object
width: uint32
height: uint32
format: GUID
stride: uint32
offset: uint32
cbSize: uintstruct MAGIMAGEHEADER
{
uint width;
uint height;
GUID format;
uint stride;
uint offset;
size_t cbSize;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MAGIMAGEHEADER サイズ: 36 バイト(x86)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; width : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; height : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; format : GUID (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; stride : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; offset : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cbSize : UINT_PTR (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MAGIMAGEHEADER サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; width : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; height : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; format : GUID (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; stride : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; offset : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; cbSize : UINT_PTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global GUID, pack=1
#field int Data1
#field short Data2
#field short Data3
#field byte Data4 8
#endstruct
#defstruct global MAGIMAGEHEADER
#field int width
#field int height
#field GUID format
#field int stride
#field int offset
#field intptr cbSize
#endstruct
stdim st, MAGIMAGEHEADER ; NSTRUCT 変数を確保
st->width = 100
mes "width=" + st->width