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

XLATEOBJ

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

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

フィールド

フィールドサイズx64x86説明
iUniqDWORD4+0+0色変換オブジェクトの一意識別番号。
flXlateDWORD4+4+4色変換フラグ(XO_*)。
iSrcTypeWORD2+8+8変換元の色種別(PAL_*)。
iDstTypeWORD2+10+10変換先の色種別(PAL_*)。
cEntriesDWORD4+12+12色変換テーブルのエントリ数。
pulXlateDWORD*8/4+16+16色変換テーブル(インデックス配列)へのポインタ。

各言語での定義

#include <windows.h>

// XLATEOBJ  (x64 24 / x86 20 バイト)
typedef struct XLATEOBJ {
    DWORD iUniq;
    DWORD flXlate;
    WORD iSrcType;
    WORD iDstType;
    DWORD cEntries;
    DWORD* pulXlate;
} XLATEOBJ;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct XLATEOBJ
{
    public uint iUniq;
    public uint flXlate;
    public ushort iSrcType;
    public ushort iDstType;
    public uint cEntries;
    public IntPtr pulXlate;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure XLATEOBJ
    Public iUniq As UInteger
    Public flXlate As UInteger
    Public iSrcType As UShort
    Public iDstType As UShort
    Public cEntries As UInteger
    Public pulXlate As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class XLATEOBJ(ctypes.Structure):
    _fields_ = [
        ("iUniq", wintypes.DWORD),
        ("flXlate", wintypes.DWORD),
        ("iSrcType", ctypes.c_ushort),
        ("iDstType", ctypes.c_ushort),
        ("cEntries", wintypes.DWORD),
        ("pulXlate", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct XLATEOBJ {
    pub iUniq: u32,
    pub flXlate: u32,
    pub iSrcType: u16,
    pub iDstType: u16,
    pub cEntries: u32,
    pub pulXlate: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type XLATEOBJ struct {
	iUniq uint32
	flXlate uint32
	iSrcType uint16
	iDstType uint16
	cEntries uint32
	pulXlate uintptr
}
type
  XLATEOBJ = record
    iUniq: DWORD;
    flXlate: DWORD;
    iSrcType: Word;
    iDstType: Word;
    cEntries: DWORD;
    pulXlate: Pointer;
  end;
const XLATEOBJ = extern struct {
    iUniq: u32,
    flXlate: u32,
    iSrcType: u16,
    iDstType: u16,
    cEntries: u32,
    pulXlate: ?*anyopaque,
};
type
  XLATEOBJ {.bycopy.} = object
    iUniq: uint32
    flXlate: uint32
    iSrcType: uint16
    iDstType: uint16
    cEntries: uint32
    pulXlate: pointer
struct XLATEOBJ
{
    uint iUniq;
    uint flXlate;
    ushort iSrcType;
    ushort iDstType;
    uint cEntries;
    void* pulXlate;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; XLATEOBJ サイズ: 20 バイト(x86)
dim st, 5    ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; iUniq : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flXlate : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; iSrcType : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; iDstType : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; cEntries : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pulXlate : DWORD* (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; XLATEOBJ サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; iUniq : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; flXlate : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; iSrcType : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; iDstType : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; cEntries : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; pulXlate : DWORD* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global XLATEOBJ
    #field int iUniq
    #field int flXlate
    #field short iSrcType
    #field short iDstType
    #field int cEntries
    #field intptr pulXlate
#endstruct

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