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