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

GAMMA_RAMP_RGB256x3x16

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

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

フィールド

フィールドサイズx64x86説明
RedWORD512+0+0赤チャネルのガンマランプ値を16ビット符号なし整数で保持する。256要素配列で用いられる。
GreenWORD512+512+512緑チャネルのガンマランプ値を16ビット符号なし整数で保持する。256要素配列で用いられる。
BlueWORD512+1024+1024青チャネルのガンマランプ値を16ビット符号なし整数で保持する。256要素配列で用いられる。

各言語での定義

#include <windows.h>

// GAMMA_RAMP_RGB256x3x16  (x64 1536 / x86 1536 バイト)
typedef struct GAMMA_RAMP_RGB256x3x16 {
    WORD Red[256];
    WORD Green[256];
    WORD Blue[256];
} GAMMA_RAMP_RGB256x3x16;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GAMMA_RAMP_RGB256x3x16
{
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public ushort[] Red;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public ushort[] Green;
    [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public ushort[] Blue;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure GAMMA_RAMP_RGB256x3x16
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public Red() As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public Green() As UShort
    <MarshalAs(UnmanagedType.ByValArray, SizeConst:=256)> Public Blue() As UShort
End Structure
import ctypes
from ctypes import wintypes

class GAMMA_RAMP_RGB256x3x16(ctypes.Structure):
    _fields_ = [
        ("Red", ctypes.c_ushort * 256),
        ("Green", ctypes.c_ushort * 256),
        ("Blue", ctypes.c_ushort * 256),
    ]
#[repr(C)]
pub struct GAMMA_RAMP_RGB256x3x16 {
    pub Red: [u16; 256],
    pub Green: [u16; 256],
    pub Blue: [u16; 256],
}
import "golang.org/x/sys/windows"

type GAMMA_RAMP_RGB256x3x16 struct {
	Red [256]uint16
	Green [256]uint16
	Blue [256]uint16
}
type
  GAMMA_RAMP_RGB256x3x16 = record
    Red: array[0..255] of Word;
    Green: array[0..255] of Word;
    Blue: array[0..255] of Word;
  end;
const GAMMA_RAMP_RGB256x3x16 = extern struct {
    Red: [256]u16,
    Green: [256]u16,
    Blue: [256]u16,
};
type
  GAMMA_RAMP_RGB256x3x16 {.bycopy.} = object
    Red: array[256, uint16]
    Green: array[256, uint16]
    Blue: array[256, uint16]
struct GAMMA_RAMP_RGB256x3x16
{
    ushort[256] Red;
    ushort[256] Green;
    ushort[256] 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_RGB256x3x16 サイズ: 1536 バイト(x64)
dim st, 384    ; 4byte整数×384(構造体サイズ 1536 / 4 切り上げ)
; Red : WORD (+0, 512byte)  varptr(st)+0 を基点に操作(512byte:入れ子/配列)
; Green : WORD (+512, 512byte)  varptr(st)+512 を基点に操作(512byte:入れ子/配列)
; Blue : WORD (+1024, 512byte)  varptr(st)+1024 を基点に操作(512byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global GAMMA_RAMP_RGB256x3x16
    #field short Red 256
    #field short Green 256
    #field short Blue 256
#endstruct

stdim st, GAMMA_RAMP_RGB256x3x16        ; NSTRUCT 変数を確保