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

COLORADJUSTMENT

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

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

フィールド

フィールドサイズx64x86説明
caSizeWORD2+0+0この構造体のサイズをバイト単位で表す。
caFlagsWORD2+2+2色調整の動作を制御するフラグ。CA_NEGATIVEやCA_LOG_FILTER等。
caIlluminantIndexWORD2+4+4色温度を決定する光源(イルミナント)のインデックスを表す。
caRedGammaWORD2+6+6赤チャネルのガンマ補正値を表す。範囲は2500〜65000。
caGreenGammaWORD2+8+8緑チャネルのガンマ補正値を表す。範囲は2500〜65000。
caBlueGammaWORD2+10+10青チャネルのガンマ補正値を表す。範囲は2500〜65000。
caReferenceBlackWORD2+12+12黒の参照値(これ以下を黒にする)を表す。範囲は0〜4000。
caReferenceWhiteWORD2+14+14白の参照値(これ以上を白にする)を表す。範囲は6000〜10000。
caContrastSHORT2+16+16コントラスト調整量を表す。範囲は-100〜100。
caBrightnessSHORT2+18+18明度調整量を表す。範囲は-100〜100。
caColorfulnessSHORT2+20+20色彩(彩度)調整量を表す。範囲は-100〜100。
caRedGreenTintSHORT2+22+22赤緑の色合い調整量を表す。範囲は-100〜100。

各言語での定義

#include <windows.h>

// COLORADJUSTMENT  (x64 24 / x86 24 バイト)
typedef struct COLORADJUSTMENT {
    WORD caSize;
    WORD caFlags;
    WORD caIlluminantIndex;
    WORD caRedGamma;
    WORD caGreenGamma;
    WORD caBlueGamma;
    WORD caReferenceBlack;
    WORD caReferenceWhite;
    SHORT caContrast;
    SHORT caBrightness;
    SHORT caColorfulness;
    SHORT caRedGreenTint;
} COLORADJUSTMENT;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct COLORADJUSTMENT
{
    public ushort caSize;
    public ushort caFlags;
    public ushort caIlluminantIndex;
    public ushort caRedGamma;
    public ushort caGreenGamma;
    public ushort caBlueGamma;
    public ushort caReferenceBlack;
    public ushort caReferenceWhite;
    public short caContrast;
    public short caBrightness;
    public short caColorfulness;
    public short caRedGreenTint;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure COLORADJUSTMENT
    Public caSize As UShort
    Public caFlags As UShort
    Public caIlluminantIndex As UShort
    Public caRedGamma As UShort
    Public caGreenGamma As UShort
    Public caBlueGamma As UShort
    Public caReferenceBlack As UShort
    Public caReferenceWhite As UShort
    Public caContrast As Short
    Public caBrightness As Short
    Public caColorfulness As Short
    Public caRedGreenTint As Short
End Structure
import ctypes
from ctypes import wintypes

class COLORADJUSTMENT(ctypes.Structure):
    _fields_ = [
        ("caSize", ctypes.c_ushort),
        ("caFlags", ctypes.c_ushort),
        ("caIlluminantIndex", ctypes.c_ushort),
        ("caRedGamma", ctypes.c_ushort),
        ("caGreenGamma", ctypes.c_ushort),
        ("caBlueGamma", ctypes.c_ushort),
        ("caReferenceBlack", ctypes.c_ushort),
        ("caReferenceWhite", ctypes.c_ushort),
        ("caContrast", ctypes.c_short),
        ("caBrightness", ctypes.c_short),
        ("caColorfulness", ctypes.c_short),
        ("caRedGreenTint", ctypes.c_short),
    ]
#[repr(C)]
pub struct COLORADJUSTMENT {
    pub caSize: u16,
    pub caFlags: u16,
    pub caIlluminantIndex: u16,
    pub caRedGamma: u16,
    pub caGreenGamma: u16,
    pub caBlueGamma: u16,
    pub caReferenceBlack: u16,
    pub caReferenceWhite: u16,
    pub caContrast: i16,
    pub caBrightness: i16,
    pub caColorfulness: i16,
    pub caRedGreenTint: i16,
}
import "golang.org/x/sys/windows"

type COLORADJUSTMENT struct {
	caSize uint16
	caFlags uint16
	caIlluminantIndex uint16
	caRedGamma uint16
	caGreenGamma uint16
	caBlueGamma uint16
	caReferenceBlack uint16
	caReferenceWhite uint16
	caContrast int16
	caBrightness int16
	caColorfulness int16
	caRedGreenTint int16
}
type
  COLORADJUSTMENT = record
    caSize: Word;
    caFlags: Word;
    caIlluminantIndex: Word;
    caRedGamma: Word;
    caGreenGamma: Word;
    caBlueGamma: Word;
    caReferenceBlack: Word;
    caReferenceWhite: Word;
    caContrast: Smallint;
    caBrightness: Smallint;
    caColorfulness: Smallint;
    caRedGreenTint: Smallint;
  end;
const COLORADJUSTMENT = extern struct {
    caSize: u16,
    caFlags: u16,
    caIlluminantIndex: u16,
    caRedGamma: u16,
    caGreenGamma: u16,
    caBlueGamma: u16,
    caReferenceBlack: u16,
    caReferenceWhite: u16,
    caContrast: i16,
    caBrightness: i16,
    caColorfulness: i16,
    caRedGreenTint: i16,
};
type
  COLORADJUSTMENT {.bycopy.} = object
    caSize: uint16
    caFlags: uint16
    caIlluminantIndex: uint16
    caRedGamma: uint16
    caGreenGamma: uint16
    caBlueGamma: uint16
    caReferenceBlack: uint16
    caReferenceWhite: uint16
    caContrast: int16
    caBrightness: int16
    caColorfulness: int16
    caRedGreenTint: int16
struct COLORADJUSTMENT
{
    ushort caSize;
    ushort caFlags;
    ushort caIlluminantIndex;
    ushort caRedGamma;
    ushort caGreenGamma;
    ushort caBlueGamma;
    ushort caReferenceBlack;
    ushort caReferenceWhite;
    short caContrast;
    short caBrightness;
    short caColorfulness;
    short caRedGreenTint;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; COLORADJUSTMENT サイズ: 24 バイト(x64)
dim st, 6    ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; caSize : WORD (+0, 2byte)  wpoke st,0,値  /  値 = wpeek(st,0)
; caFlags : WORD (+2, 2byte)  wpoke st,2,値  /  値 = wpeek(st,2)
; caIlluminantIndex : WORD (+4, 2byte)  wpoke st,4,値  /  値 = wpeek(st,4)
; caRedGamma : WORD (+6, 2byte)  wpoke st,6,値  /  値 = wpeek(st,6)
; caGreenGamma : WORD (+8, 2byte)  wpoke st,8,値  /  値 = wpeek(st,8)
; caBlueGamma : WORD (+10, 2byte)  wpoke st,10,値  /  値 = wpeek(st,10)
; caReferenceBlack : WORD (+12, 2byte)  wpoke st,12,値  /  値 = wpeek(st,12)
; caReferenceWhite : WORD (+14, 2byte)  wpoke st,14,値  /  値 = wpeek(st,14)
; caContrast : SHORT (+16, 2byte)  wpoke st,16,値  /  値 = wpeek(st,16)
; caBrightness : SHORT (+18, 2byte)  wpoke st,18,値  /  値 = wpeek(st,18)
; caColorfulness : SHORT (+20, 2byte)  wpoke st,20,値  /  値 = wpeek(st,20)
; caRedGreenTint : SHORT (+22, 2byte)  wpoke st,22,値  /  値 = wpeek(st,22)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global COLORADJUSTMENT
    #field short caSize
    #field short caFlags
    #field short caIlluminantIndex
    #field short caRedGamma
    #field short caGreenGamma
    #field short caBlueGamma
    #field short caReferenceBlack
    #field short caReferenceWhite
    #field short caContrast
    #field short caBrightness
    #field short caColorfulness
    #field short caRedGreenTint
#endstruct

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