ホーム › Graphics.Gdi › METAHEADER
METAHEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| mtType | WORD | 2 | +0 | +0 | メタファイルの種別。1でメモリ、2でディスク。 |
| mtHeaderSize | WORD | 2 | +2 | +2 | このヘッダーのサイズ(WORD単位)。 |
| mtVersion | WORD | 2 | +4 | +4 | メタファイルのバージョン番号。 |
| mtSize | DWORD | 4 | +6 | +6 | メタファイル全体のサイズ(WORD単位)。 |
| mtNoObjects | WORD | 2 | +10 | +10 | メタファイルに存在する最大オブジェクト数。 |
| mtMaxRecord | DWORD | 4 | +12 | +12 | 最大レコードのサイズ(WORD単位)。 |
| mtNoParameters | WORD | 2 | +16 | +16 | 予約フィールド。使用されない。 |
各言語での定義
#include <windows.h>
// METAHEADER (x64 18 / x86 18 バイト)
#pragma pack(push, 2)
typedef struct METAHEADER {
WORD mtType;
WORD mtHeaderSize;
WORD mtVersion;
DWORD mtSize;
WORD mtNoObjects;
DWORD mtMaxRecord;
WORD mtNoParameters;
} METAHEADER;
#pragma pack(pop)using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, Pack = 2, CharSet = CharSet.Unicode)]
public struct METAHEADER
{
public ushort mtType;
public ushort mtHeaderSize;
public ushort mtVersion;
public uint mtSize;
public ushort mtNoObjects;
public uint mtMaxRecord;
public ushort mtNoParameters;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, Pack:=2, CharSet:=CharSet.Unicode)>
Public Structure METAHEADER
Public mtType As UShort
Public mtHeaderSize As UShort
Public mtVersion As UShort
Public mtSize As UInteger
Public mtNoObjects As UShort
Public mtMaxRecord As UInteger
Public mtNoParameters As UShort
End Structureimport ctypes
from ctypes import wintypes
class METAHEADER(ctypes.Structure):
_pack_ = 2
_fields_ = [
("mtType", ctypes.c_ushort),
("mtHeaderSize", ctypes.c_ushort),
("mtVersion", ctypes.c_ushort),
("mtSize", wintypes.DWORD),
("mtNoObjects", ctypes.c_ushort),
("mtMaxRecord", wintypes.DWORD),
("mtNoParameters", ctypes.c_ushort),
]#[repr(C, packed(2))]
pub struct METAHEADER {
pub mtType: u16,
pub mtHeaderSize: u16,
pub mtVersion: u16,
pub mtSize: u32,
pub mtNoObjects: u16,
pub mtMaxRecord: u32,
pub mtNoParameters: u16,
}import "golang.org/x/sys/windows"
type METAHEADER struct {
mtType uint16
mtHeaderSize uint16
mtVersion uint16
mtSize uint32
mtNoObjects uint16
mtMaxRecord uint32
mtNoParameters uint16
}type
METAHEADER = packed record
mtType: Word;
mtHeaderSize: Word;
mtVersion: Word;
mtSize: DWORD;
mtNoObjects: Word;
mtMaxRecord: DWORD;
mtNoParameters: Word;
end;const METAHEADER = extern struct {
mtType: u16,
mtHeaderSize: u16,
mtVersion: u16,
mtSize: u32,
mtNoObjects: u16,
mtMaxRecord: u32,
mtNoParameters: u16,
};type
METAHEADER {.packed.} = object
mtType: uint16
mtHeaderSize: uint16
mtVersion: uint16
mtSize: uint32
mtNoObjects: uint16
mtMaxRecord: uint32
mtNoParameters: uint16align(2)
struct METAHEADER
{
ushort mtType;
ushort mtHeaderSize;
ushort mtVersion;
uint mtSize;
ushort mtNoObjects;
uint mtMaxRecord;
ushort mtNoParameters;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; METAHEADER サイズ: 18 バイト(x64)
dim st, 5 ; 4byte整数×5(構造体サイズ 18 / 4 切り上げ)
; mtType : WORD (+0, 2byte) wpoke st,0,値 / 値 = wpeek(st,0)
; mtHeaderSize : WORD (+2, 2byte) wpoke st,2,値 / 値 = wpeek(st,2)
; mtVersion : WORD (+4, 2byte) wpoke st,4,値 / 値 = wpeek(st,4)
; mtSize : DWORD (+6, 4byte) lpoke st,6,値 / 値 = lpeek(st,6)
; mtNoObjects : WORD (+10, 2byte) wpoke st,10,値 / 値 = wpeek(st,10)
; mtMaxRecord : DWORD (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; mtNoParameters : WORD (+16, 2byte) wpoke st,16,値 / 値 = wpeek(st,16)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global METAHEADER, pack=2
#field short mtType
#field short mtHeaderSize
#field short mtVersion
#field int mtSize
#field short mtNoObjects
#field int mtMaxRecord
#field short mtNoParameters
#endstruct
stdim st, METAHEADER ; NSTRUCT 変数を確保
st->mtType = 100
mes "mtType=" + st->mtType