ホーム › Graphics.DirectWrite › DWRITE_HIT_TEST_METRICS
DWRITE_HIT_TEST_METRICS
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| textPosition | DWORD | 4 | +0 | +0 | ヒットテスト範囲の先頭テキスト位置。 |
| length | DWORD | 4 | +4 | +4 | 範囲に含まれるテキストの文字数。 |
| left | FLOAT | 4 | +8 | +8 | 範囲を囲む矩形の左端座標をDIP単位で表す値。 |
| top | FLOAT | 4 | +12 | +12 | 範囲を囲む矩形の上端座標をDIP単位で表す値。 |
| width | FLOAT | 4 | +16 | +16 | 範囲を囲む矩形の幅をDIP単位で表す値。 |
| height | FLOAT | 4 | +20 | +20 | 範囲を囲む矩形の高さをDIP単位で表す値。 |
| bidiLevel | DWORD | 4 | +24 | +24 | 範囲の双方向(BiDi)レベル。偶数は左から右、奇数は右から左。 |
| isText | BOOL | 4 | +28 | +28 | 範囲が実テキストか(インラインオブジェクトでないか)を示すブール値。 |
| isTrimmed | BOOL | 4 | +32 | +32 | 範囲が省略(トリミング)されているかを示すブール値。 |
各言語での定義
#include <windows.h>
// DWRITE_HIT_TEST_METRICS (x64 36 / x86 36 バイト)
typedef struct DWRITE_HIT_TEST_METRICS {
DWORD textPosition;
DWORD length;
FLOAT left;
FLOAT top;
FLOAT width;
FLOAT height;
DWORD bidiLevel;
BOOL isText;
BOOL isTrimmed;
} DWRITE_HIT_TEST_METRICS;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_HIT_TEST_METRICS
{
public uint textPosition;
public uint length;
public float left;
public float top;
public float width;
public float height;
public uint bidiLevel;
[MarshalAs(UnmanagedType.Bool)] public bool isText;
[MarshalAs(UnmanagedType.Bool)] public bool isTrimmed;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_HIT_TEST_METRICS
Public textPosition As UInteger
Public length As UInteger
Public left As Single
Public top As Single
Public width As Single
Public height As Single
Public bidiLevel As UInteger
<MarshalAs(UnmanagedType.Bool)> Public isText As Boolean
<MarshalAs(UnmanagedType.Bool)> Public isTrimmed As Boolean
End Structureimport ctypes
from ctypes import wintypes
class DWRITE_HIT_TEST_METRICS(ctypes.Structure):
_fields_ = [
("textPosition", wintypes.DWORD),
("length", wintypes.DWORD),
("left", ctypes.c_float),
("top", ctypes.c_float),
("width", ctypes.c_float),
("height", ctypes.c_float),
("bidiLevel", wintypes.DWORD),
("isText", wintypes.BOOL),
("isTrimmed", wintypes.BOOL),
]#[repr(C)]
pub struct DWRITE_HIT_TEST_METRICS {
pub textPosition: u32,
pub length: u32,
pub left: f32,
pub top: f32,
pub width: f32,
pub height: f32,
pub bidiLevel: u32,
pub isText: i32,
pub isTrimmed: i32,
}import "golang.org/x/sys/windows"
type DWRITE_HIT_TEST_METRICS struct {
textPosition uint32
length uint32
left float32
top float32
width float32
height float32
bidiLevel uint32
isText int32
isTrimmed int32
}type
DWRITE_HIT_TEST_METRICS = record
textPosition: DWORD;
length: DWORD;
left: Single;
top: Single;
width: Single;
height: Single;
bidiLevel: DWORD;
isText: BOOL;
isTrimmed: BOOL;
end;const DWRITE_HIT_TEST_METRICS = extern struct {
textPosition: u32,
length: u32,
left: f32,
top: f32,
width: f32,
height: f32,
bidiLevel: u32,
isText: i32,
isTrimmed: i32,
};type
DWRITE_HIT_TEST_METRICS {.bycopy.} = object
textPosition: uint32
length: uint32
left: float32
top: float32
width: float32
height: float32
bidiLevel: uint32
isText: int32
isTrimmed: int32struct DWRITE_HIT_TEST_METRICS
{
uint textPosition;
uint length;
float left;
float top;
float width;
float height;
uint bidiLevel;
int isText;
int isTrimmed;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_HIT_TEST_METRICS サイズ: 36 バイト(x64)
dim st, 9 ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; textPosition : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; length : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; left : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; top : FLOAT (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; width : FLOAT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; height : FLOAT (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; bidiLevel : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; isText : BOOL (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; isTrimmed : BOOL (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DWRITE_HIT_TEST_METRICS
#field int textPosition
#field int length
#field float left
#field float top
#field float width
#field float height
#field int bidiLevel
#field bool isText
#field bool isTrimmed
#endstruct
stdim st, DWRITE_HIT_TEST_METRICS ; NSTRUCT 変数を確保
st->textPosition = 100
mes "textPosition=" + st->textPosition