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

GAMMA_RAMP_RGB

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

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

フィールド

フィールドサイズx64x86説明
RedFLOAT4+0+0赤チャネルの値を単精度浮動小数点で保持する。スケールやオフセットなどに用いる。
GreenFLOAT4+4+4緑チャネルの値を単精度浮動小数点で保持する。スケールやオフセットなどに用いる。
BlueFLOAT4+8+8青チャネルの値を単精度浮動小数点で保持する。スケールやオフセットなどに用いる。

各言語での定義

#include <windows.h>

// GAMMA_RAMP_RGB  (x64 12 / x86 12 バイト)
typedef struct GAMMA_RAMP_RGB {
    FLOAT Red;
    FLOAT Green;
    FLOAT Blue;
} GAMMA_RAMP_RGB;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GAMMA_RAMP_RGB
{
    public float Red;
    public float Green;
    public float Blue;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GAMMA_RAMP_RGB
    Public Red As Single
    Public Green As Single
    Public Blue As Single
End Structure
import ctypes
from ctypes import wintypes

class GAMMA_RAMP_RGB(ctypes.Structure):
    _fields_ = [
        ("Red", ctypes.c_float),
        ("Green", ctypes.c_float),
        ("Blue", ctypes.c_float),
    ]
#[repr(C)]
pub struct GAMMA_RAMP_RGB {
    pub Red: f32,
    pub Green: f32,
    pub Blue: f32,
}
import "golang.org/x/sys/windows"

type GAMMA_RAMP_RGB struct {
	Red float32
	Green float32
	Blue float32
}
type
  GAMMA_RAMP_RGB = record
    Red: Single;
    Green: Single;
    Blue: Single;
  end;
const GAMMA_RAMP_RGB = extern struct {
    Red: f32,
    Green: f32,
    Blue: f32,
};
type
  GAMMA_RAMP_RGB {.bycopy.} = object
    Red: float32
    Green: float32
    Blue: float32
struct GAMMA_RAMP_RGB
{
    float Red;
    float Green;
    float Blue;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; GAMMA_RAMP_RGB サイズ: 12 バイト(x64)
dim st, 3    ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; Red : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Green : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Blue : FLOAT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GAMMA_RAMP_RGB
    #field float Red
    #field float Green
    #field float Blue
#endstruct

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