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

DDGAMMARAMP

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

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

フィールド

フィールドサイズx64x86説明
redWORD512+0+0赤チャネルのガンマ補正参照テーブル(256要素のWORD配列)。
greenWORD512+512+512緑チャネルのガンマ補正参照テーブル(256要素のWORD配列)。
blueWORD512+1024+1024青チャネルのガンマ補正参照テーブル(256要素のWORD配列)。

各言語での定義

#include <windows.h>

// DDGAMMARAMP  (x64 1536 / x86 1536 バイト)
typedef struct DDGAMMARAMP {
    WORD red[256];
    WORD green[256];
    WORD blue[256];
} DDGAMMARAMP;
using System;
using System.Runtime.InteropServices;

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

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

stdim st, DDGAMMARAMP        ; NSTRUCT 変数を確保