ホーム › UI.ColorSystem › JChColorF
JChColorF
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| J | FLOAT | 4 | +0 | +0 | CIECAM02のJ(明度)成分(浮動小数)。 |
| C | FLOAT | 4 | +4 | +4 | CIECAM02のC(クロマ・彩度)成分(浮動小数)。 |
| h | FLOAT | 4 | +8 | +8 | CIECAM02のh(色相角)成分(浮動小数)。 |
各言語での定義
#include <windows.h>
// JChColorF (x64 12 / x86 12 バイト)
typedef struct JChColorF {
FLOAT J;
FLOAT C;
FLOAT h;
} JChColorF;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct JChColorF
{
public float J;
public float C;
public float h;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure JChColorF
Public J As Single
Public C As Single
Public h As Single
End Structureimport ctypes
from ctypes import wintypes
class JChColorF(ctypes.Structure):
_fields_ = [
("J", ctypes.c_float),
("C", ctypes.c_float),
("h", ctypes.c_float),
]#[repr(C)]
pub struct JChColorF {
pub J: f32,
pub C: f32,
pub h: f32,
}import "golang.org/x/sys/windows"
type JChColorF struct {
J float32
C float32
h float32
}type
JChColorF = record
J: Single;
C: Single;
h: Single;
end;const JChColorF = extern struct {
J: f32,
C: f32,
h: f32,
};type
JChColorF {.bycopy.} = object
J: float32
C: float32
h: float32struct JChColorF
{
float J;
float C;
float h;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; JChColorF サイズ: 12 バイト(x64)
dim st, 3 ; 4byte整数×3(構造体サイズ 12 / 4 切り上げ)
; J : FLOAT (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; C : FLOAT (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; h : FLOAT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global JChColorF
#field float J
#field float C
#field float h
#endstruct
stdim st, JChColorF ; NSTRUCT 変数を確保
st->J = 100
mes "J=" + st->J