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

GAMMARAMP

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

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

フィールド

フィールドサイズx64x86説明
RedWORD512+0+0赤チャネルのガンマ補正テーブル(256エントリのWORD配列)。
GreenWORD512+512+512緑チャネルのガンマ補正テーブル(256エントリ)。
BlueWORD512+1024+1024青チャネルのガンマ補正テーブル(256エントリ)。

各言語での定義

#include <windows.h>

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

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct GAMMARAMP
{
    [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 GAMMARAMP
    <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 GAMMARAMP(ctypes.Structure):
    _fields_ = [
        ("Red", ctypes.c_ushort * 256),
        ("Green", ctypes.c_ushort * 256),
        ("Blue", ctypes.c_ushort * 256),
    ]
#[repr(C)]
pub struct GAMMARAMP {
    pub Red: [u16; 256],
    pub Green: [u16; 256],
    pub Blue: [u16; 256],
}
import "golang.org/x/sys/windows"

type GAMMARAMP struct {
	Red [256]uint16
	Green [256]uint16
	Blue [256]uint16
}
type
  GAMMARAMP = record
    Red: array[0..255] of Word;
    Green: array[0..255] of Word;
    Blue: array[0..255] of Word;
  end;
const GAMMARAMP = extern struct {
    Red: [256]u16,
    Green: [256]u16,
    Blue: [256]u16,
};
type
  GAMMARAMP {.bycopy.} = object
    Red: array[256, uint16]
    Green: array[256, uint16]
    Blue: array[256, uint16]
struct GAMMARAMP
{
    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 レイアウト)
; GAMMARAMP サイズ: 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 GAMMARAMP
    #field short Red 256
    #field short Green 256
    #field short Blue 256
#endstruct

stdim st, GAMMARAMP        ; NSTRUCT 変数を確保