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

DEVHTINFO

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

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

フィールド

フィールドサイズx64x86説明
HTFlagsDWORD4+0+0ハーフトーン処理フラグ(DEVHTADJF_*)。
HTPatternSizeDWORD4+4+4ハーフトーンパターンのサイズ(HT_PATSIZE_*)。
DevPelsDPIDWORD4+8+8デバイスピクセルのDPI。
ColorInfoCOLORINFO120+12+12デバイスの色特性情報(COLORINFO)。

各言語での定義

#include <windows.h>

// CIECHROMA  (x64 12 / x86 12 バイト)
typedef struct CIECHROMA {
    INT x;
    INT y;
    INT Y;
} CIECHROMA;

// COLORINFO  (x64 120 / x86 120 バイト)
typedef struct COLORINFO {
    CIECHROMA Red;
    CIECHROMA Green;
    CIECHROMA Blue;
    CIECHROMA Cyan;
    CIECHROMA Magenta;
    CIECHROMA Yellow;
    CIECHROMA AlignmentWhite;
    INT RedGamma;
    INT GreenGamma;
    INT BlueGamma;
    INT MagentaInCyanDye;
    INT YellowInCyanDye;
    INT CyanInMagentaDye;
    INT YellowInMagentaDye;
    INT CyanInYellowDye;
    INT MagentaInYellowDye;
} COLORINFO;

// DEVHTINFO  (x64 132 / x86 132 バイト)
typedef struct DEVHTINFO {
    DWORD HTFlags;
    DWORD HTPatternSize;
    DWORD DevPelsDPI;
    COLORINFO ColorInfo;
} DEVHTINFO;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COLORINFO
{
    public CIECHROMA Red;
    public CIECHROMA Green;
    public CIECHROMA Blue;
    public CIECHROMA Cyan;
    public CIECHROMA Magenta;
    public CIECHROMA Yellow;
    public CIECHROMA AlignmentWhite;
    public int RedGamma;
    public int GreenGamma;
    public int BlueGamma;
    public int MagentaInCyanDye;
    public int YellowInCyanDye;
    public int CyanInMagentaDye;
    public int YellowInMagentaDye;
    public int CyanInYellowDye;
    public int MagentaInYellowDye;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DEVHTINFO
{
    public uint HTFlags;
    public uint HTPatternSize;
    public uint DevPelsDPI;
    public COLORINFO ColorInfo;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COLORINFO
    Public Red As CIECHROMA
    Public Green As CIECHROMA
    Public Blue As CIECHROMA
    Public Cyan As CIECHROMA
    Public Magenta As CIECHROMA
    Public Yellow As CIECHROMA
    Public AlignmentWhite As CIECHROMA
    Public RedGamma As Integer
    Public GreenGamma As Integer
    Public BlueGamma As Integer
    Public MagentaInCyanDye As Integer
    Public YellowInCyanDye As Integer
    Public CyanInMagentaDye As Integer
    Public YellowInMagentaDye As Integer
    Public CyanInYellowDye As Integer
    Public MagentaInYellowDye As Integer
End Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DEVHTINFO
    Public HTFlags As UInteger
    Public HTPatternSize As UInteger
    Public DevPelsDPI As UInteger
    Public ColorInfo As COLORINFO
End Structure
import ctypes
from ctypes import wintypes

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

class COLORINFO(ctypes.Structure):
    _fields_ = [
        ("Red", CIECHROMA),
        ("Green", CIECHROMA),
        ("Blue", CIECHROMA),
        ("Cyan", CIECHROMA),
        ("Magenta", CIECHROMA),
        ("Yellow", CIECHROMA),
        ("AlignmentWhite", CIECHROMA),
        ("RedGamma", ctypes.c_int),
        ("GreenGamma", ctypes.c_int),
        ("BlueGamma", ctypes.c_int),
        ("MagentaInCyanDye", ctypes.c_int),
        ("YellowInCyanDye", ctypes.c_int),
        ("CyanInMagentaDye", ctypes.c_int),
        ("YellowInMagentaDye", ctypes.c_int),
        ("CyanInYellowDye", ctypes.c_int),
        ("MagentaInYellowDye", ctypes.c_int),
    ]

class DEVHTINFO(ctypes.Structure):
    _fields_ = [
        ("HTFlags", wintypes.DWORD),
        ("HTPatternSize", wintypes.DWORD),
        ("DevPelsDPI", wintypes.DWORD),
        ("ColorInfo", COLORINFO),
    ]
#[repr(C)]
pub struct CIECHROMA {
    pub x: i32,
    pub y: i32,
    pub Y: i32,
}

#[repr(C)]
pub struct COLORINFO {
    pub Red: CIECHROMA,
    pub Green: CIECHROMA,
    pub Blue: CIECHROMA,
    pub Cyan: CIECHROMA,
    pub Magenta: CIECHROMA,
    pub Yellow: CIECHROMA,
    pub AlignmentWhite: CIECHROMA,
    pub RedGamma: i32,
    pub GreenGamma: i32,
    pub BlueGamma: i32,
    pub MagentaInCyanDye: i32,
    pub YellowInCyanDye: i32,
    pub CyanInMagentaDye: i32,
    pub YellowInMagentaDye: i32,
    pub CyanInYellowDye: i32,
    pub MagentaInYellowDye: i32,
}

#[repr(C)]
pub struct DEVHTINFO {
    pub HTFlags: u32,
    pub HTPatternSize: u32,
    pub DevPelsDPI: u32,
    pub ColorInfo: COLORINFO,
}
import "golang.org/x/sys/windows"

type CIECHROMA struct {
	x int32
	y int32
	Y int32
}

type COLORINFO struct {
	Red CIECHROMA
	Green CIECHROMA
	Blue CIECHROMA
	Cyan CIECHROMA
	Magenta CIECHROMA
	Yellow CIECHROMA
	AlignmentWhite CIECHROMA
	RedGamma int32
	GreenGamma int32
	BlueGamma int32
	MagentaInCyanDye int32
	YellowInCyanDye int32
	CyanInMagentaDye int32
	YellowInMagentaDye int32
	CyanInYellowDye int32
	MagentaInYellowDye int32
}

type DEVHTINFO struct {
	HTFlags uint32
	HTPatternSize uint32
	DevPelsDPI uint32
	ColorInfo COLORINFO
}
type
  CIECHROMA = record
    x: Integer;
    y: Integer;
    Y: Integer;
  end;

  COLORINFO = record
    Red: CIECHROMA;
    Green: CIECHROMA;
    Blue: CIECHROMA;
    Cyan: CIECHROMA;
    Magenta: CIECHROMA;
    Yellow: CIECHROMA;
    AlignmentWhite: CIECHROMA;
    RedGamma: Integer;
    GreenGamma: Integer;
    BlueGamma: Integer;
    MagentaInCyanDye: Integer;
    YellowInCyanDye: Integer;
    CyanInMagentaDye: Integer;
    YellowInMagentaDye: Integer;
    CyanInYellowDye: Integer;
    MagentaInYellowDye: Integer;
  end;

  DEVHTINFO = record
    HTFlags: DWORD;
    HTPatternSize: DWORD;
    DevPelsDPI: DWORD;
    ColorInfo: COLORINFO;
  end;
const CIECHROMA = extern struct {
    x: i32,
    y: i32,
    Y: i32,
};

const COLORINFO = extern struct {
    Red: CIECHROMA,
    Green: CIECHROMA,
    Blue: CIECHROMA,
    Cyan: CIECHROMA,
    Magenta: CIECHROMA,
    Yellow: CIECHROMA,
    AlignmentWhite: CIECHROMA,
    RedGamma: i32,
    GreenGamma: i32,
    BlueGamma: i32,
    MagentaInCyanDye: i32,
    YellowInCyanDye: i32,
    CyanInMagentaDye: i32,
    YellowInMagentaDye: i32,
    CyanInYellowDye: i32,
    MagentaInYellowDye: i32,
};

const DEVHTINFO = extern struct {
    HTFlags: u32,
    HTPatternSize: u32,
    DevPelsDPI: u32,
    ColorInfo: COLORINFO,
};
type
  CIECHROMA {.bycopy.} = object
    x: int32
    y: int32
    Y: int32

  COLORINFO {.bycopy.} = object
    Red: CIECHROMA
    Green: CIECHROMA
    Blue: CIECHROMA
    Cyan: CIECHROMA
    Magenta: CIECHROMA
    Yellow: CIECHROMA
    AlignmentWhite: CIECHROMA
    RedGamma: int32
    GreenGamma: int32
    BlueGamma: int32
    MagentaInCyanDye: int32
    YellowInCyanDye: int32
    CyanInMagentaDye: int32
    YellowInMagentaDye: int32
    CyanInYellowDye: int32
    MagentaInYellowDye: int32

  DEVHTINFO {.bycopy.} = object
    HTFlags: uint32
    HTPatternSize: uint32
    DevPelsDPI: uint32
    ColorInfo: COLORINFO
struct CIECHROMA
{
    int x;
    int y;
    int Y;
}

struct COLORINFO
{
    CIECHROMA Red;
    CIECHROMA Green;
    CIECHROMA Blue;
    CIECHROMA Cyan;
    CIECHROMA Magenta;
    CIECHROMA Yellow;
    CIECHROMA AlignmentWhite;
    int RedGamma;
    int GreenGamma;
    int BlueGamma;
    int MagentaInCyanDye;
    int YellowInCyanDye;
    int CyanInMagentaDye;
    int YellowInMagentaDye;
    int CyanInYellowDye;
    int MagentaInYellowDye;
}

struct DEVHTINFO
{
    uint HTFlags;
    uint HTPatternSize;
    uint DevPelsDPI;
    COLORINFO ColorInfo;
}

HSP用 定義

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

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

#defstruct global COLORINFO
    #field CIECHROMA Red
    #field CIECHROMA Green
    #field CIECHROMA Blue
    #field CIECHROMA Cyan
    #field CIECHROMA Magenta
    #field CIECHROMA Yellow
    #field CIECHROMA AlignmentWhite
    #field int RedGamma
    #field int GreenGamma
    #field int BlueGamma
    #field int MagentaInCyanDye
    #field int YellowInCyanDye
    #field int CyanInMagentaDye
    #field int YellowInMagentaDye
    #field int CyanInYellowDye
    #field int MagentaInYellowDye
#endstruct

#defstruct global DEVHTINFO
    #field int HTFlags
    #field int HTPatternSize
    #field int DevPelsDPI
    #field COLORINFO ColorInfo
#endstruct

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