ホーム › Graphics.Gdi › TTPOLYGONHEADER
TTPOLYGONHEADER
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cb | DWORD | 4 | +0 | +0 | このポリゴン(輪郭)を記述するデータ全体のサイズをバイト単位で表す。 |
| dwType | DWORD | 4 | +4 | +4 | ポリゴンデータの種類。常にTT_POLYGON_TYPE(24)である。 |
| pfxStart | POINTFX | 8 | +8 | +8 | 輪郭の開始点(始点)を表すPOINTFX構造体。 |
各言語での定義
#include <windows.h>
// FIXED (x64 4 / x86 4 バイト)
typedef struct FIXED {
WORD fract;
SHORT value;
} FIXED;
// POINTFX (x64 8 / x86 8 バイト)
typedef struct POINTFX {
FIXED x;
FIXED y;
} POINTFX;
// TTPOLYGONHEADER (x64 16 / x86 16 バイト)
typedef struct TTPOLYGONHEADER {
DWORD cb;
DWORD dwType;
POINTFX pfxStart;
} TTPOLYGONHEADER;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FIXED
{
public ushort fract;
public short value;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTFX
{
public FIXED x;
public FIXED y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TTPOLYGONHEADER
{
public uint cb;
public uint dwType;
public POINTFX pfxStart;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FIXED
Public fract As UShort
Public value As Short
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTFX
Public x As FIXED
Public y As FIXED
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure TTPOLYGONHEADER
Public cb As UInteger
Public dwType As UInteger
Public pfxStart As POINTFX
End Structureimport ctypes
from ctypes import wintypes
class FIXED(ctypes.Structure):
_fields_ = [
("fract", ctypes.c_ushort),
("value", ctypes.c_short),
]
class POINTFX(ctypes.Structure):
_fields_ = [
("x", FIXED),
("y", FIXED),
]
class TTPOLYGONHEADER(ctypes.Structure):
_fields_ = [
("cb", wintypes.DWORD),
("dwType", wintypes.DWORD),
("pfxStart", POINTFX),
]#[repr(C)]
pub struct FIXED {
pub fract: u16,
pub value: i16,
}
#[repr(C)]
pub struct POINTFX {
pub x: FIXED,
pub y: FIXED,
}
#[repr(C)]
pub struct TTPOLYGONHEADER {
pub cb: u32,
pub dwType: u32,
pub pfxStart: POINTFX,
}import "golang.org/x/sys/windows"
type FIXED struct {
fract uint16
value int16
}
type POINTFX struct {
x FIXED
y FIXED
}
type TTPOLYGONHEADER struct {
cb uint32
dwType uint32
pfxStart POINTFX
}type
FIXED = record
fract: Word;
value: Smallint;
end;
POINTFX = record
x: FIXED;
y: FIXED;
end;
TTPOLYGONHEADER = record
cb: DWORD;
dwType: DWORD;
pfxStart: POINTFX;
end;const FIXED = extern struct {
fract: u16,
value: i16,
};
const POINTFX = extern struct {
x: FIXED,
y: FIXED,
};
const TTPOLYGONHEADER = extern struct {
cb: u32,
dwType: u32,
pfxStart: POINTFX,
};type
FIXED {.bycopy.} = object
fract: uint16
value: int16
POINTFX {.bycopy.} = object
x: FIXED
y: FIXED
TTPOLYGONHEADER {.bycopy.} = object
cb: uint32
dwType: uint32
pfxStart: POINTFXstruct FIXED
{
ushort fract;
short value;
}
struct POINTFX
{
FIXED x;
FIXED y;
}
struct TTPOLYGONHEADER
{
uint cb;
uint dwType;
POINTFX pfxStart;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; TTPOLYGONHEADER サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; dwType : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; pfxStart : POINTFX (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global FIXED
#field short fract
#field short value
#endstruct
#defstruct global POINTFX
#field FIXED x
#field FIXED y
#endstruct
#defstruct global TTPOLYGONHEADER
#field int cb
#field int dwType
#field POINTFX pfxStart
#endstruct
stdim st, TTPOLYGONHEADER ; NSTRUCT 変数を確保
st->cb = 100
mes "cb=" + st->cb