Win32 API 日本語リファレンス
ホームGraphics.DirectWrite › DWRITE_COLOR_GLYPH_RUN

DWRITE_COLOR_GLYPH_RUN

構造体
サイズx64: 88 バイト / x86: 64 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
glyphRunDWRITE_GLYPH_RUN48/32+0+0描画対象となる色付きグリフラン(DWRITE_GLYPH_RUN)。
glyphRunDescriptionDWRITE_GLYPH_RUN_DESCRIPTION*8/4+48+32グリフランの補足情報を示すDWRITE_GLYPH_RUN_DESCRIPTIONへのポインタ。
baselineOriginXFLOAT4+56+36グリフランを描画するベースライン原点のX座標。
baselineOriginYFLOAT4+60+40グリフランを描画するベースライン原点のY座標。
runColorDWRITE_COLOR_F16+64+44このランに適用する色をDWRITE_COLOR_F(RGBA)で表す値。
paletteIndexWORD2+80+60使用するカラーパレット内のエントリ番号。0xFFFFは前景色を表す。

各言語での定義

#include <windows.h>

// DWRITE_GLYPH_RUN  (x64 48 / x86 32 バイト)
typedef struct DWRITE_GLYPH_RUN {
    IDWriteFontFace* fontFace;
    FLOAT fontEmSize;
    DWORD glyphCount;
    WORD* glyphIndices;
    FLOAT* glyphAdvances;
    DWRITE_GLYPH_OFFSET* glyphOffsets;
    BOOL isSideways;
    DWORD bidiLevel;
} DWRITE_GLYPH_RUN;

// DWRITE_COLOR_F  (x64 16 / x86 16 バイト)
typedef struct DWRITE_COLOR_F {
    FLOAT r;
    FLOAT g;
    FLOAT b;
    FLOAT a;
} DWRITE_COLOR_F;

// DWRITE_COLOR_GLYPH_RUN  (x64 88 / x86 64 バイト)
typedef struct DWRITE_COLOR_GLYPH_RUN {
    DWRITE_GLYPH_RUN glyphRun;
    DWRITE_GLYPH_RUN_DESCRIPTION* glyphRunDescription;
    FLOAT baselineOriginX;
    FLOAT baselineOriginY;
    DWRITE_COLOR_F runColor;
    WORD paletteIndex;
} DWRITE_COLOR_GLYPH_RUN;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_GLYPH_RUN
{
    public IntPtr fontFace;
    public float fontEmSize;
    public uint glyphCount;
    public IntPtr glyphIndices;
    public IntPtr glyphAdvances;
    public IntPtr glyphOffsets;
    [MarshalAs(UnmanagedType.Bool)] public bool isSideways;
    public uint bidiLevel;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_COLOR_F
{
    public float r;
    public float g;
    public float b;
    public float a;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DWRITE_COLOR_GLYPH_RUN
{
    public DWRITE_GLYPH_RUN glyphRun;
    public IntPtr glyphRunDescription;
    public float baselineOriginX;
    public float baselineOriginY;
    public DWRITE_COLOR_F runColor;
    public ushort paletteIndex;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_GLYPH_RUN
    Public fontFace As IntPtr
    Public fontEmSize As Single
    Public glyphCount As UInteger
    Public glyphIndices As IntPtr
    Public glyphAdvances As IntPtr
    Public glyphOffsets As IntPtr
    <MarshalAs(UnmanagedType.Bool)> Public isSideways As Boolean
    Public bidiLevel As UInteger
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_COLOR_F
    Public r As Single
    Public g As Single
    Public b As Single
    Public a As Single
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DWRITE_COLOR_GLYPH_RUN
    Public glyphRun As DWRITE_GLYPH_RUN
    Public glyphRunDescription As IntPtr
    Public baselineOriginX As Single
    Public baselineOriginY As Single
    Public runColor As DWRITE_COLOR_F
    Public paletteIndex As UShort
End Structure
import ctypes
from ctypes import wintypes

class DWRITE_GLYPH_RUN(ctypes.Structure):
    _fields_ = [
        ("fontFace", ctypes.c_void_p),
        ("fontEmSize", ctypes.c_float),
        ("glyphCount", wintypes.DWORD),
        ("glyphIndices", ctypes.c_void_p),
        ("glyphAdvances", ctypes.c_void_p),
        ("glyphOffsets", ctypes.c_void_p),
        ("isSideways", wintypes.BOOL),
        ("bidiLevel", wintypes.DWORD),
    ]

class DWRITE_COLOR_F(ctypes.Structure):
    _fields_ = [
        ("r", ctypes.c_float),
        ("g", ctypes.c_float),
        ("b", ctypes.c_float),
        ("a", ctypes.c_float),
    ]

class DWRITE_COLOR_GLYPH_RUN(ctypes.Structure):
    _fields_ = [
        ("glyphRun", DWRITE_GLYPH_RUN),
        ("glyphRunDescription", ctypes.c_void_p),
        ("baselineOriginX", ctypes.c_float),
        ("baselineOriginY", ctypes.c_float),
        ("runColor", DWRITE_COLOR_F),
        ("paletteIndex", ctypes.c_ushort),
    ]
#[repr(C)]
pub struct DWRITE_GLYPH_RUN {
    pub fontFace: *mut core::ffi::c_void,
    pub fontEmSize: f32,
    pub glyphCount: u32,
    pub glyphIndices: *mut core::ffi::c_void,
    pub glyphAdvances: *mut core::ffi::c_void,
    pub glyphOffsets: *mut core::ffi::c_void,
    pub isSideways: i32,
    pub bidiLevel: u32,
}

#[repr(C)]
pub struct DWRITE_COLOR_F {
    pub r: f32,
    pub g: f32,
    pub b: f32,
    pub a: f32,
}

#[repr(C)]
pub struct DWRITE_COLOR_GLYPH_RUN {
    pub glyphRun: DWRITE_GLYPH_RUN,
    pub glyphRunDescription: *mut core::ffi::c_void,
    pub baselineOriginX: f32,
    pub baselineOriginY: f32,
    pub runColor: DWRITE_COLOR_F,
    pub paletteIndex: u16,
}
import "golang.org/x/sys/windows"

type DWRITE_GLYPH_RUN struct {
	fontFace uintptr
	fontEmSize float32
	glyphCount uint32
	glyphIndices uintptr
	glyphAdvances uintptr
	glyphOffsets uintptr
	isSideways int32
	bidiLevel uint32
}

type DWRITE_COLOR_F struct {
	r float32
	g float32
	b float32
	a float32
}

type DWRITE_COLOR_GLYPH_RUN struct {
	glyphRun DWRITE_GLYPH_RUN
	glyphRunDescription uintptr
	baselineOriginX float32
	baselineOriginY float32
	runColor DWRITE_COLOR_F
	paletteIndex uint16
}
type
  DWRITE_GLYPH_RUN = record
    fontFace: Pointer;
    fontEmSize: Single;
    glyphCount: DWORD;
    glyphIndices: Pointer;
    glyphAdvances: Pointer;
    glyphOffsets: Pointer;
    isSideways: BOOL;
    bidiLevel: DWORD;
  end;

  DWRITE_COLOR_F = record
    r: Single;
    g: Single;
    b: Single;
    a: Single;
  end;

  DWRITE_COLOR_GLYPH_RUN = record
    glyphRun: DWRITE_GLYPH_RUN;
    glyphRunDescription: Pointer;
    baselineOriginX: Single;
    baselineOriginY: Single;
    runColor: DWRITE_COLOR_F;
    paletteIndex: Word;
  end;
const DWRITE_GLYPH_RUN = extern struct {
    fontFace: ?*anyopaque,
    fontEmSize: f32,
    glyphCount: u32,
    glyphIndices: ?*anyopaque,
    glyphAdvances: ?*anyopaque,
    glyphOffsets: ?*anyopaque,
    isSideways: i32,
    bidiLevel: u32,
};

const DWRITE_COLOR_F = extern struct {
    r: f32,
    g: f32,
    b: f32,
    a: f32,
};

const DWRITE_COLOR_GLYPH_RUN = extern struct {
    glyphRun: DWRITE_GLYPH_RUN,
    glyphRunDescription: ?*anyopaque,
    baselineOriginX: f32,
    baselineOriginY: f32,
    runColor: DWRITE_COLOR_F,
    paletteIndex: u16,
};
type
  DWRITE_GLYPH_RUN {.bycopy.} = object
    fontFace: pointer
    fontEmSize: float32
    glyphCount: uint32
    glyphIndices: pointer
    glyphAdvances: pointer
    glyphOffsets: pointer
    isSideways: int32
    bidiLevel: uint32

  DWRITE_COLOR_F {.bycopy.} = object
    r: float32
    g: float32
    b: float32
    a: float32

  DWRITE_COLOR_GLYPH_RUN {.bycopy.} = object
    glyphRun: DWRITE_GLYPH_RUN
    glyphRunDescription: pointer
    baselineOriginX: float32
    baselineOriginY: float32
    runColor: DWRITE_COLOR_F
    paletteIndex: uint16
struct DWRITE_GLYPH_RUN
{
    void* fontFace;
    float fontEmSize;
    uint glyphCount;
    void* glyphIndices;
    void* glyphAdvances;
    void* glyphOffsets;
    int isSideways;
    uint bidiLevel;
}

struct DWRITE_COLOR_F
{
    float r;
    float g;
    float b;
    float a;
}

struct DWRITE_COLOR_GLYPH_RUN
{
    DWRITE_GLYPH_RUN glyphRun;
    void* glyphRunDescription;
    float baselineOriginX;
    float baselineOriginY;
    DWRITE_COLOR_F runColor;
    ushort paletteIndex;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DWRITE_COLOR_GLYPH_RUN サイズ: 64 バイト(x86)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; glyphRun : DWRITE_GLYPH_RUN (+0, 32byte)  varptr(st)+0 を基点に操作(32byte:入れ子/配列)
; glyphRunDescription : DWRITE_GLYPH_RUN_DESCRIPTION* (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; baselineOriginX : FLOAT (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; baselineOriginY : FLOAT (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; runColor : DWRITE_COLOR_F (+44, 16byte)  varptr(st)+44 を基点に操作(16byte:入れ子/配列)
; paletteIndex : WORD (+60, 2byte)  wpoke st,60,値  /  値 = wpeek(st,60)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DWRITE_COLOR_GLYPH_RUN サイズ: 88 バイト(x64)
dim st, 22    ; 4byte整数×22(構造体サイズ 88 / 4 切り上げ)
; glyphRun : DWRITE_GLYPH_RUN (+0, 48byte)  varptr(st)+0 を基点に操作(48byte:入れ子/配列)
; glyphRunDescription : DWRITE_GLYPH_RUN_DESCRIPTION* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; baselineOriginX : FLOAT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; baselineOriginY : FLOAT (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; runColor : DWRITE_COLOR_F (+64, 16byte)  varptr(st)+64 を基点に操作(16byte:入れ子/配列)
; paletteIndex : WORD (+80, 2byte)  wpoke st,80,値  /  値 = wpeek(st,80)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DWRITE_GLYPH_RUN
    #field intptr fontFace
    #field float fontEmSize
    #field int glyphCount
    #field intptr glyphIndices
    #field intptr glyphAdvances
    #field intptr glyphOffsets
    #field bool isSideways
    #field int bidiLevel
#endstruct

#defstruct global DWRITE_COLOR_F
    #field float r
    #field float g
    #field float b
    #field float a
#endstruct

#defstruct global DWRITE_COLOR_GLYPH_RUN
    #field DWRITE_GLYPH_RUN glyphRun
    #field intptr glyphRunDescription
    #field float baselineOriginX
    #field float baselineOriginY
    #field DWRITE_COLOR_F runColor
    #field short paletteIndex
#endstruct

stdim st, DWRITE_COLOR_GLYPH_RUN        ; NSTRUCT 変数を確保
st->baselineOriginX = 100
mes "baselineOriginX=" + st->baselineOriginX