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

D2D1_SIMPLE_COLOR_PROFILE

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

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

フィールド

フィールドサイズx64x86説明
redPrimaryD2D_POINT_2F8+0+0色空間の赤原色のCIE xy色度座標。
greenPrimaryD2D_POINT_2F8+8+8色空間の緑原色のCIE xy色度座標。
bluePrimaryD2D_POINT_2F8+16+16色空間の青原色のCIE xy色度座標。
whitePointXZD2D_POINT_2F8+24+24白色点のXZ色度座標。
gammaD2D1_GAMMA14+32+32色空間のガンマ特性を示すD2D1_GAMMA1。

各言語での定義

#include <windows.h>

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

// D2D1_SIMPLE_COLOR_PROFILE  (x64 36 / x86 36 バイト)
typedef struct D2D1_SIMPLE_COLOR_PROFILE {
    D2D_POINT_2F redPrimary;
    D2D_POINT_2F greenPrimary;
    D2D_POINT_2F bluePrimary;
    D2D_POINT_2F whitePointXZ;
    D2D1_GAMMA1 gamma;
} D2D1_SIMPLE_COLOR_PROFILE;
using System;
using System.Runtime.InteropServices;

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D2D1_SIMPLE_COLOR_PROFILE
{
    public D2D_POINT_2F redPrimary;
    public D2D_POINT_2F greenPrimary;
    public D2D_POINT_2F bluePrimary;
    public D2D_POINT_2F whitePointXZ;
    public int gamma;
}
Imports System.Runtime.InteropServices

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

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D2D1_SIMPLE_COLOR_PROFILE
    Public redPrimary As D2D_POINT_2F
    Public greenPrimary As D2D_POINT_2F
    Public bluePrimary As D2D_POINT_2F
    Public whitePointXZ As D2D_POINT_2F
    Public gamma As Integer
End Structure
import ctypes
from ctypes import wintypes

class D2D_POINT_2F(ctypes.Structure):
    _fields_ = [
        ("x", ctypes.c_float),
        ("y", ctypes.c_float),
    ]

class D2D1_SIMPLE_COLOR_PROFILE(ctypes.Structure):
    _fields_ = [
        ("redPrimary", D2D_POINT_2F),
        ("greenPrimary", D2D_POINT_2F),
        ("bluePrimary", D2D_POINT_2F),
        ("whitePointXZ", D2D_POINT_2F),
        ("gamma", ctypes.c_int),
    ]
#[repr(C)]
pub struct D2D_POINT_2F {
    pub x: f32,
    pub y: f32,
}

#[repr(C)]
pub struct D2D1_SIMPLE_COLOR_PROFILE {
    pub redPrimary: D2D_POINT_2F,
    pub greenPrimary: D2D_POINT_2F,
    pub bluePrimary: D2D_POINT_2F,
    pub whitePointXZ: D2D_POINT_2F,
    pub gamma: i32,
}
import "golang.org/x/sys/windows"

type D2D_POINT_2F struct {
	x float32
	y float32
}

type D2D1_SIMPLE_COLOR_PROFILE struct {
	redPrimary D2D_POINT_2F
	greenPrimary D2D_POINT_2F
	bluePrimary D2D_POINT_2F
	whitePointXZ D2D_POINT_2F
	gamma int32
}
type
  D2D_POINT_2F = record
    x: Single;
    y: Single;
  end;

  D2D1_SIMPLE_COLOR_PROFILE = record
    redPrimary: D2D_POINT_2F;
    greenPrimary: D2D_POINT_2F;
    bluePrimary: D2D_POINT_2F;
    whitePointXZ: D2D_POINT_2F;
    gamma: Integer;
  end;
const D2D_POINT_2F = extern struct {
    x: f32,
    y: f32,
};

const D2D1_SIMPLE_COLOR_PROFILE = extern struct {
    redPrimary: D2D_POINT_2F,
    greenPrimary: D2D_POINT_2F,
    bluePrimary: D2D_POINT_2F,
    whitePointXZ: D2D_POINT_2F,
    gamma: i32,
};
type
  D2D_POINT_2F {.bycopy.} = object
    x: float32
    y: float32

  D2D1_SIMPLE_COLOR_PROFILE {.bycopy.} = object
    redPrimary: D2D_POINT_2F
    greenPrimary: D2D_POINT_2F
    bluePrimary: D2D_POINT_2F
    whitePointXZ: D2D_POINT_2F
    gamma: int32
struct D2D_POINT_2F
{
    float x;
    float y;
}

struct D2D1_SIMPLE_COLOR_PROFILE
{
    D2D_POINT_2F redPrimary;
    D2D_POINT_2F greenPrimary;
    D2D_POINT_2F bluePrimary;
    D2D_POINT_2F whitePointXZ;
    int gamma;
}

HSP用 定義

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

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

#defstruct global D2D1_SIMPLE_COLOR_PROFILE
    #field D2D_POINT_2F redPrimary
    #field D2D_POINT_2F greenPrimary
    #field D2D_POINT_2F bluePrimary
    #field D2D_POINT_2F whitePointXZ
    #field int gamma
#endstruct

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