ホーム › Devices.Display › LINEATTRS
LINEATTRS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| fl | DWORD | 4 | +0 | +0 | 線属性フラグ(代替線スタイル・幾何幅など)の組み合わせ。 |
| iJoin | DWORD | 4 | +4 | +4 | 線の結合スタイル(マイター/ラウンド/ベベル)。 |
| iEndCap | DWORD | 4 | +8 | +8 | 線の端点スタイル(フラット/ラウンド/角)。 |
| elWidth | FLOAT_LONG | 4 | +12 | +12 | 線の幅。FLOAT_LONG共用体で浮動小数点または整数で指定する。 |
| eMiterLimit | DWORD | 4 | +16 | +16 | マイター結合の制限比。FLOATまたはDWORDで指定する。 |
| cstyle | DWORD | 4 | +20 | +20 | 破線スタイル配列の要素数。 |
| pstyle | FLOAT_LONG* | 8/4 | +24 | +24 | 破線パターンを定義するFLOAT_LONG配列へのポインタ。 |
| elStyleState | FLOAT_LONG | 4 | +32 | +28 | 現在の破線スタイル状態(位相)を保持する。 |
各言語での定義
#include <windows.h>
// FLOAT_LONG (x64 4 / x86 4 バイト)
typedef struct FLOAT_LONG {
FLOAT e;
INT l;
} FLOAT_LONG;
// LINEATTRS (x64 40 / x86 32 バイト)
typedef struct LINEATTRS {
DWORD fl;
DWORD iJoin;
DWORD iEndCap;
FLOAT_LONG elWidth;
DWORD eMiterLimit;
DWORD cstyle;
FLOAT_LONG* pstyle;
FLOAT_LONG elStyleState;
} LINEATTRS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct FLOAT_LONG
{
public float e;
public int l;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct LINEATTRS
{
public uint fl;
public uint iJoin;
public uint iEndCap;
public FLOAT_LONG elWidth;
public uint eMiterLimit;
public uint cstyle;
public IntPtr pstyle;
public FLOAT_LONG elStyleState;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure FLOAT_LONG
Public e As Single
Public l As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure LINEATTRS
Public fl As UInteger
Public iJoin As UInteger
Public iEndCap As UInteger
Public elWidth As FLOAT_LONG
Public eMiterLimit As UInteger
Public cstyle As UInteger
Public pstyle As IntPtr
Public elStyleState As FLOAT_LONG
End Structureimport ctypes
from ctypes import wintypes
class FLOAT_LONG(ctypes.Structure):
_fields_ = [
("e", ctypes.c_float),
("l", ctypes.c_int),
]
class LINEATTRS(ctypes.Structure):
_fields_ = [
("fl", wintypes.DWORD),
("iJoin", wintypes.DWORD),
("iEndCap", wintypes.DWORD),
("elWidth", FLOAT_LONG),
("eMiterLimit", wintypes.DWORD),
("cstyle", wintypes.DWORD),
("pstyle", ctypes.c_void_p),
("elStyleState", FLOAT_LONG),
]#[repr(C)]
pub struct FLOAT_LONG {
pub e: f32,
pub l: i32,
}
#[repr(C)]
pub struct LINEATTRS {
pub fl: u32,
pub iJoin: u32,
pub iEndCap: u32,
pub elWidth: FLOAT_LONG,
pub eMiterLimit: u32,
pub cstyle: u32,
pub pstyle: *mut core::ffi::c_void,
pub elStyleState: FLOAT_LONG,
}import "golang.org/x/sys/windows"
type FLOAT_LONG struct {
e float32
l int32
}
type LINEATTRS struct {
fl uint32
iJoin uint32
iEndCap uint32
elWidth FLOAT_LONG
eMiterLimit uint32
cstyle uint32
pstyle uintptr
elStyleState FLOAT_LONG
}type
FLOAT_LONG = record
e: Single;
l: Integer;
end;
LINEATTRS = record
fl: DWORD;
iJoin: DWORD;
iEndCap: DWORD;
elWidth: FLOAT_LONG;
eMiterLimit: DWORD;
cstyle: DWORD;
pstyle: Pointer;
elStyleState: FLOAT_LONG;
end;const FLOAT_LONG = extern struct {
e: f32,
l: i32,
};
const LINEATTRS = extern struct {
fl: u32,
iJoin: u32,
iEndCap: u32,
elWidth: FLOAT_LONG,
eMiterLimit: u32,
cstyle: u32,
pstyle: ?*anyopaque,
elStyleState: FLOAT_LONG,
};type
FLOAT_LONG {.bycopy.} = object
e: float32
l: int32
LINEATTRS {.bycopy.} = object
fl: uint32
iJoin: uint32
iEndCap: uint32
elWidth: FLOAT_LONG
eMiterLimit: uint32
cstyle: uint32
pstyle: pointer
elStyleState: FLOAT_LONGstruct FLOAT_LONG
{
float e;
int l;
}
struct LINEATTRS
{
uint fl;
uint iJoin;
uint iEndCap;
FLOAT_LONG elWidth;
uint eMiterLimit;
uint cstyle;
void* pstyle;
FLOAT_LONG elStyleState;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; LINEATTRS サイズ: 32 バイト(x86)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; fl : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; iJoin : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; iEndCap : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; elWidth : FLOAT_LONG (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; eMiterLimit : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cstyle : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pstyle : FLOAT_LONG* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; elStyleState : FLOAT_LONG (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; LINEATTRS サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; fl : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; iJoin : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; iEndCap : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; elWidth : FLOAT_LONG (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; eMiterLimit : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; cstyle : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; pstyle : FLOAT_LONG* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; elStyleState : FLOAT_LONG (+32, 4byte) varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global LINEATTRS
#field int fl
#field int iJoin
#field int iEndCap
#field byte elWidth 4
#field int eMiterLimit
#field int cstyle
#field intptr pstyle
#field byte elStyleState 4
#endstruct
stdim st, LINEATTRS ; NSTRUCT 変数を確保
st->fl = 100
mes "fl=" + st->fl
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。