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

D3D11_VIDEO_COLOR_YCbCrA

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

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

フィールド

フィールドサイズx64x86説明
YFLOAT4+0+0輝度(ルマ)成分。0.0〜1.0の浮動小数で表す。
CbFLOAT4+4+4青色差(クロマ)成分。0.0〜1.0の浮動小数で表す。
CrFLOAT4+8+8赤色差(クロマ)成分。0.0〜1.0の浮動小数で表す。
AFLOAT4+12+12アルファ(不透明度)成分。0.0〜1.0の浮動小数で表す。

各言語での定義

#include <windows.h>

// D3D11_VIDEO_COLOR_YCbCrA  (x64 16 / x86 16 バイト)
typedef struct D3D11_VIDEO_COLOR_YCbCrA {
    FLOAT Y;
    FLOAT Cb;
    FLOAT Cr;
    FLOAT A;
} D3D11_VIDEO_COLOR_YCbCrA;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct D3D11_VIDEO_COLOR_YCbCrA
{
    public float Y;
    public float Cb;
    public float Cr;
    public float A;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure D3D11_VIDEO_COLOR_YCbCrA
    Public Y As Single
    Public Cb As Single
    Public Cr As Single
    Public A As Single
End Structure
import ctypes
from ctypes import wintypes

class D3D11_VIDEO_COLOR_YCbCrA(ctypes.Structure):
    _fields_ = [
        ("Y", ctypes.c_float),
        ("Cb", ctypes.c_float),
        ("Cr", ctypes.c_float),
        ("A", ctypes.c_float),
    ]
#[repr(C)]
pub struct D3D11_VIDEO_COLOR_YCbCrA {
    pub Y: f32,
    pub Cb: f32,
    pub Cr: f32,
    pub A: f32,
}
import "golang.org/x/sys/windows"

type D3D11_VIDEO_COLOR_YCbCrA struct {
	Y float32
	Cb float32
	Cr float32
	A float32
}
type
  D3D11_VIDEO_COLOR_YCbCrA = record
    Y: Single;
    Cb: Single;
    Cr: Single;
    A: Single;
  end;
const D3D11_VIDEO_COLOR_YCbCrA = extern struct {
    Y: f32,
    Cb: f32,
    Cr: f32,
    A: f32,
};
type
  D3D11_VIDEO_COLOR_YCbCrA {.bycopy.} = object
    Y: float32
    Cb: float32
    Cr: float32
    A: float32
struct D3D11_VIDEO_COLOR_YCbCrA
{
    float Y;
    float Cb;
    float Cr;
    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 レイアウト)
; D3D11_VIDEO_COLOR_YCbCrA サイズ: 16 バイト(x64)
dim st, 4    ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; Y : FLOAT (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; Cb : FLOAT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; Cr : 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 D3D11_VIDEO_COLOR_YCbCrA
    #field float Y
    #field float Cb
    #field float Cr
    #field float A
#endstruct

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