ホーム › Devices.Display › CLIPLINE
CLIPLINE
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| ptfxA | POINTFIX | 8 | +0 | +0 | 線分の始点(固定小数点POINTFIX)。 |
| ptfxB | POINTFIX | 8 | +8 | +8 | 線分の終点(固定小数点POINTFIX)。 |
| lStyleState | INT | 4 | +16 | +16 | 破線スタイルの状態(位相)。 |
| c | DWORD | 4 | +20 | +20 | arun配列に含まれるラン数。 |
| arun | RUN | 8 | +24 | +24 | クリップ後に描画する区間(RUN)の配列(可変長)。 |
各言語での定義
#include <windows.h>
// POINTFIX (x64 8 / x86 8 バイト)
typedef struct POINTFIX {
INT x;
INT y;
} POINTFIX;
// RUN (x64 8 / x86 8 バイト)
typedef struct RUN {
INT iStart;
INT iStop;
} RUN;
// CLIPLINE (x64 32 / x86 32 バイト)
typedef struct CLIPLINE {
POINTFIX ptfxA;
POINTFIX ptfxB;
INT lStyleState;
DWORD c;
RUN arun[1];
} CLIPLINE;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTFIX
{
public int x;
public int y;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RUN
{
public int iStart;
public int iStop;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CLIPLINE
{
public POINTFIX ptfxA;
public POINTFIX ptfxB;
public int lStyleState;
public uint c;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public RUN[] arun;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTFIX
Public x As Integer
Public y As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RUN
Public iStart As Integer
Public iStop As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure CLIPLINE
Public ptfxA As POINTFIX
Public ptfxB As POINTFIX
Public lStyleState As Integer
Public c As UInteger
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public arun() As RUN
End Structureimport ctypes
from ctypes import wintypes
class POINTFIX(ctypes.Structure):
_fields_ = [
("x", ctypes.c_int),
("y", ctypes.c_int),
]
class RUN(ctypes.Structure):
_fields_ = [
("iStart", ctypes.c_int),
("iStop", ctypes.c_int),
]
class CLIPLINE(ctypes.Structure):
_fields_ = [
("ptfxA", POINTFIX),
("ptfxB", POINTFIX),
("lStyleState", ctypes.c_int),
("c", wintypes.DWORD),
("arun", RUN * 1),
]#[repr(C)]
pub struct POINTFIX {
pub x: i32,
pub y: i32,
}
#[repr(C)]
pub struct RUN {
pub iStart: i32,
pub iStop: i32,
}
#[repr(C)]
pub struct CLIPLINE {
pub ptfxA: POINTFIX,
pub ptfxB: POINTFIX,
pub lStyleState: i32,
pub c: u32,
pub arun: [RUN; 1],
}import "golang.org/x/sys/windows"
type POINTFIX struct {
x int32
y int32
}
type RUN struct {
iStart int32
iStop int32
}
type CLIPLINE struct {
ptfxA POINTFIX
ptfxB POINTFIX
lStyleState int32
c uint32
arun [1]RUN
}type
POINTFIX = record
x: Integer;
y: Integer;
end;
RUN = record
iStart: Integer;
iStop: Integer;
end;
CLIPLINE = record
ptfxA: POINTFIX;
ptfxB: POINTFIX;
lStyleState: Integer;
c: DWORD;
arun: array[0..0] of RUN;
end;const POINTFIX = extern struct {
x: i32,
y: i32,
};
const RUN = extern struct {
iStart: i32,
iStop: i32,
};
const CLIPLINE = extern struct {
ptfxA: POINTFIX,
ptfxB: POINTFIX,
lStyleState: i32,
c: u32,
arun: [1]RUN,
};type
POINTFIX {.bycopy.} = object
x: int32
y: int32
RUN {.bycopy.} = object
iStart: int32
iStop: int32
CLIPLINE {.bycopy.} = object
ptfxA: POINTFIX
ptfxB: POINTFIX
lStyleState: int32
c: uint32
arun: array[1, RUN]struct POINTFIX
{
int x;
int y;
}
struct RUN
{
int iStart;
int iStop;
}
struct CLIPLINE
{
POINTFIX ptfxA;
POINTFIX ptfxB;
int lStyleState;
uint c;
RUN[1] arun;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; CLIPLINE サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; ptfxA : POINTFIX (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; ptfxB : POINTFIX (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; lStyleState : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; c : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; arun : RUN (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINTFIX
#field int x
#field int y
#endstruct
#defstruct global RUN
#field int iStart
#field int iStop
#endstruct
#defstruct global CLIPLINE
#field POINTFIX ptfxA
#field POINTFIX ptfxB
#field int lStyleState
#field int c
#field RUN arun 1
#endstruct
stdim st, CLIPLINE ; NSTRUCT 変数を確保
st->lStyleState = 100
mes "lStyleState=" + st->lStyleState