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

DDCOLORCONTROL

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

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

フィールド

フィールドサイズx64x86説明
dwSizeDWORD4+0+0構造体サイズ(バイト数)。呼び出し前に設定する。
dwFlagsDWORD4+4+4有効なメンバを示すDDCOLOR_系フラグの組み合わせ。
lBrightnessINT4+8+8明るさの調整値を示す。
lContrastINT4+12+12コントラストの調整値を示す。
lHueINT4+16+16色相の調整値を示す。
lSaturationINT4+20+20彩度の調整値を示す。
lSharpnessINT4+24+24シャープネスの調整値を示す。
lGammaINT4+28+28ガンマの調整値を示す。
lColorEnableINT4+32+32カラー有効/無効の状態を示す。
dwReserved1DWORD4+36+36予約フィールド。0とする。

各言語での定義

#include <windows.h>

// DDCOLORCONTROL  (x64 40 / x86 40 バイト)
typedef struct DDCOLORCONTROL {
    DWORD dwSize;
    DWORD dwFlags;
    INT lBrightness;
    INT lContrast;
    INT lHue;
    INT lSaturation;
    INT lSharpness;
    INT lGamma;
    INT lColorEnable;
    DWORD dwReserved1;
} DDCOLORCONTROL;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DDCOLORCONTROL
{
    public uint dwSize;
    public uint dwFlags;
    public int lBrightness;
    public int lContrast;
    public int lHue;
    public int lSaturation;
    public int lSharpness;
    public int lGamma;
    public int lColorEnable;
    public uint dwReserved1;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DDCOLORCONTROL
    Public dwSize As UInteger
    Public dwFlags As UInteger
    Public lBrightness As Integer
    Public lContrast As Integer
    Public lHue As Integer
    Public lSaturation As Integer
    Public lSharpness As Integer
    Public lGamma As Integer
    Public lColorEnable As Integer
    Public dwReserved1 As UInteger
End Structure
import ctypes
from ctypes import wintypes

class DDCOLORCONTROL(ctypes.Structure):
    _fields_ = [
        ("dwSize", wintypes.DWORD),
        ("dwFlags", wintypes.DWORD),
        ("lBrightness", ctypes.c_int),
        ("lContrast", ctypes.c_int),
        ("lHue", ctypes.c_int),
        ("lSaturation", ctypes.c_int),
        ("lSharpness", ctypes.c_int),
        ("lGamma", ctypes.c_int),
        ("lColorEnable", ctypes.c_int),
        ("dwReserved1", wintypes.DWORD),
    ]
#[repr(C)]
pub struct DDCOLORCONTROL {
    pub dwSize: u32,
    pub dwFlags: u32,
    pub lBrightness: i32,
    pub lContrast: i32,
    pub lHue: i32,
    pub lSaturation: i32,
    pub lSharpness: i32,
    pub lGamma: i32,
    pub lColorEnable: i32,
    pub dwReserved1: u32,
}
import "golang.org/x/sys/windows"

type DDCOLORCONTROL struct {
	dwSize uint32
	dwFlags uint32
	lBrightness int32
	lContrast int32
	lHue int32
	lSaturation int32
	lSharpness int32
	lGamma int32
	lColorEnable int32
	dwReserved1 uint32
}
type
  DDCOLORCONTROL = record
    dwSize: DWORD;
    dwFlags: DWORD;
    lBrightness: Integer;
    lContrast: Integer;
    lHue: Integer;
    lSaturation: Integer;
    lSharpness: Integer;
    lGamma: Integer;
    lColorEnable: Integer;
    dwReserved1: DWORD;
  end;
const DDCOLORCONTROL = extern struct {
    dwSize: u32,
    dwFlags: u32,
    lBrightness: i32,
    lContrast: i32,
    lHue: i32,
    lSaturation: i32,
    lSharpness: i32,
    lGamma: i32,
    lColorEnable: i32,
    dwReserved1: u32,
};
type
  DDCOLORCONTROL {.bycopy.} = object
    dwSize: uint32
    dwFlags: uint32
    lBrightness: int32
    lContrast: int32
    lHue: int32
    lSaturation: int32
    lSharpness: int32
    lGamma: int32
    lColorEnable: int32
    dwReserved1: uint32
struct DDCOLORCONTROL
{
    uint dwSize;
    uint dwFlags;
    int lBrightness;
    int lContrast;
    int lHue;
    int lSaturation;
    int lSharpness;
    int lGamma;
    int lColorEnable;
    uint dwReserved1;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DDCOLORCONTROL サイズ: 40 バイト(x64)
dim st, 10    ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; dwSize : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; dwFlags : DWORD (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; lBrightness : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; lContrast : INT (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; lHue : INT (+16, 4byte)  st.4 = 値  /  値 = st.4   (lpoke/lpeek も可)
; lSaturation : INT (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; lSharpness : INT (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; lGamma : INT (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; lColorEnable : INT (+32, 4byte)  st.8 = 値  /  値 = st.8   (lpoke/lpeek も可)
; dwReserved1 : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DDCOLORCONTROL
    #field int dwSize
    #field int dwFlags
    #field int lBrightness
    #field int lContrast
    #field int lHue
    #field int lSaturation
    #field int lSharpness
    #field int lGamma
    #field int lColorEnable
    #field int dwReserved1
#endstruct

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