ホーム › Graphics.Direct3D11 › D3D11_VIDEO_COLOR_YCbCrA
D3D11_VIDEO_COLOR_YCbCrA
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| Y | FLOAT | 4 | +0 | +0 | Y の輝度 (luma) 値です。 |
| Cb | FLOAT | 4 | +4 | +4 | Cb の彩度 (chroma) 値です。 |
| Cr | FLOAT | 4 | +8 | +8 | Cr の彩度 (chroma) 値です。 |
| A | FLOAT | 4 | +12 | +12 | アルファ値です。値の範囲は 0 (透明) から 1 (不透明) までです。 |
公式ドキュメント
YCbCr の色値を指定します。
解説(Remarks)
値の公称範囲は [0...1] です。1 チャネルあたり n ビットの形式の場合、各色コンポーネントの値は次のように計算されます。
val = f * ((1 << n)-1)
たとえば 8 ビットの YUV 形式では val = BYTE(f * 255.0) となります。基準黒 (reference black) は (0.0625, 0.5, 0.5) で、8 ビット表現では (16, 128, 128) に対応します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#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 Structureimport 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: float32struct 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