Win32 API 日本語リファレンス
ホームDevices.Display › GLYPHBITS

GLYPHBITS

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

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

フィールド

フィールドサイズx64x86説明
ptlOriginPOINTL8+0+0グリフビットマップの原点(POINTL)。
sizlBitmapSIZE8+8+8グリフビットマップのサイズ(SIZE)。
ajBYTE1+16+16グリフのモノクロビットマップデータ(可変長バイト配列)。

各言語での定義

#include <windows.h>

// POINTL  (x64 8 / x86 8 バイト)
typedef struct POINTL {
    INT x;
    INT y;
} POINTL;

// SIZE  (x64 8 / x86 8 バイト)
typedef struct SIZE {
    INT cx;
    INT cy;
} SIZE;

// GLYPHBITS  (x64 20 / x86 20 バイト)
typedef struct GLYPHBITS {
    POINTL ptlOrigin;
    SIZE sizlBitmap;
    BYTE aj[1];
} GLYPHBITS;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct POINTL
{
    public int x;
    public int y;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SIZE
{
    public int cx;
    public int cy;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GLYPHBITS
{
    public POINTL ptlOrigin;
    public SIZE sizlBitmap;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)] public byte[] aj;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure POINTL
    Public x As Integer
    Public y As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure SIZE
    Public cx As Integer
    Public cy As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GLYPHBITS
    Public ptlOrigin As POINTL
    Public sizlBitmap As SIZE
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=1)> Public aj() As Byte
End Structure
import ctypes
from ctypes import wintypes

class POINTL(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_int),
        ("y", ctypes.c_int),
    ]

class SIZE(ctypes.Structure):
    _fields_ = [
        ("cx", ctypes.c_int),
        ("cy", ctypes.c_int),
    ]

class GLYPHBITS(ctypes.Structure):
    _fields_ = [
        ("ptlOrigin", POINTL),
        ("sizlBitmap", SIZE),
        ("aj", ctypes.c_ubyte * 1),
    ]
#[repr(C)]
pub struct POINTL {
    pub x: i32,
    pub y: i32,
}

#[repr(C)]
pub struct SIZE {
    pub cx: i32,
    pub cy: i32,
}

#[repr(C)]
pub struct GLYPHBITS {
    pub ptlOrigin: POINTL,
    pub sizlBitmap: SIZE,
    pub aj: [u8; 1],
}
import "golang.org/x/sys/windows"

type POINTL struct {
	x int32
	y int32
}

type SIZE struct {
	cx int32
	cy int32
}

type GLYPHBITS struct {
	ptlOrigin POINTL
	sizlBitmap SIZE
	aj [1]byte
}
type
  POINTL = record
    x: Integer;
    y: Integer;
  end;

  SIZE = record
    cx: Integer;
    cy: Integer;
  end;

  GLYPHBITS = record
    ptlOrigin: POINTL;
    sizlBitmap: SIZE;
    aj: array[0..0] of Byte;
  end;
const POINTL = extern struct {
    x: i32,
    y: i32,
};

const SIZE = extern struct {
    cx: i32,
    cy: i32,
};

const GLYPHBITS = extern struct {
    ptlOrigin: POINTL,
    sizlBitmap: SIZE,
    aj: [1]u8,
};
type
  POINTL {.bycopy.} = object
    x: int32
    y: int32

  SIZE {.bycopy.} = object
    cx: int32
    cy: int32

  GLYPHBITS {.bycopy.} = object
    ptlOrigin: POINTL
    sizlBitmap: SIZE
    aj: array[1, uint8]
struct POINTL
{
    int x;
    int y;
}

struct SIZE
{
    int cx;
    int cy;
}

struct GLYPHBITS
{
    POINTL ptlOrigin;
    SIZE sizlBitmap;
    ubyte[1] aj;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GLYPHBITS サイズ: 20 バイト(x64)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; ptlOrigin : POINTL (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; sizlBitmap : SIZE (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; aj : BYTE (+16, 1byte)  varptr(st)+16 を基点に操作(1byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global POINTL
    #field int x
    #field int y
#endstruct

#defstruct global SIZE
    #field int cx
    #field int cy
#endstruct

#defstruct global GLYPHBITS
    #field POINTL ptlOrigin
    #field SIZE sizlBitmap
    #field byte aj 1
#endstruct

stdim st, GLYPHBITS        ; NSTRUCT 変数を確保