ホーム › Media.MediaFoundation › DXVAHD_COLOR
DXVAHD_COLOR
共用体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| RGB | DXVAHD_COLOR_RGBA | 16 | +0 | +0 | RGBA形式で色を表現するメンバである。共用体のため択一で使用。 |
| YCbCr | DXVAHD_COLOR_YCbCrA | 16 | +0 | +0 | YCbCrA形式で色を表現するメンバである。共用体のため択一で使用。 |
各言語での定義
#include <windows.h>
// DXVAHD_COLOR_RGBA (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR_RGBA {
FLOAT R;
FLOAT G;
FLOAT B;
FLOAT A;
} DXVAHD_COLOR_RGBA;
// DXVAHD_COLOR_YCbCrA (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR_YCbCrA {
FLOAT Y;
FLOAT Cb;
FLOAT Cr;
FLOAT A;
} DXVAHD_COLOR_YCbCrA;
// DXVAHD_COLOR (x64 16 / x86 16 バイト)
typedef struct DXVAHD_COLOR {
DXVAHD_COLOR_RGBA RGB;
DXVAHD_COLOR_YCbCrA YCbCr;
} DXVAHD_COLOR;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR_RGBA
{
public float R;
public float G;
public float B;
public float A;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR_YCbCrA
{
public float Y;
public float Cb;
public float Cr;
public float A;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DXVAHD_COLOR
{
public DXVAHD_COLOR_RGBA RGB;
public DXVAHD_COLOR_YCbCrA YCbCr;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR_RGBA
Public R As Single
Public G As Single
Public B As Single
Public A As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR_YCbCrA
Public Y As Single
Public Cb As Single
Public Cr As Single
Public A As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DXVAHD_COLOR
Public RGB As DXVAHD_COLOR_RGBA
Public YCbCr As DXVAHD_COLOR_YCbCrA
End Structureimport ctypes
from ctypes import wintypes
class DXVAHD_COLOR_RGBA(ctypes.Structure):
_fields_ = [
("R", ctypes.c_float),
("G", ctypes.c_float),
("B", ctypes.c_float),
("A", ctypes.c_float),
]
class DXVAHD_COLOR_YCbCrA(ctypes.Structure):
_fields_ = [
("Y", ctypes.c_float),
("Cb", ctypes.c_float),
("Cr", ctypes.c_float),
("A", ctypes.c_float),
]
class DXVAHD_COLOR(ctypes.Structure):
_fields_ = [
("RGB", DXVAHD_COLOR_RGBA),
("YCbCr", DXVAHD_COLOR_YCbCrA),
]#[repr(C)]
pub struct DXVAHD_COLOR_RGBA {
pub R: f32,
pub G: f32,
pub B: f32,
pub A: f32,
}
#[repr(C)]
pub struct DXVAHD_COLOR_YCbCrA {
pub Y: f32,
pub Cb: f32,
pub Cr: f32,
pub A: f32,
}
#[repr(C)]
pub struct DXVAHD_COLOR {
pub RGB: DXVAHD_COLOR_RGBA,
pub YCbCr: DXVAHD_COLOR_YCbCrA,
}import "golang.org/x/sys/windows"
type DXVAHD_COLOR_RGBA struct {
R float32
G float32
B float32
A float32
}
type DXVAHD_COLOR_YCbCrA struct {
Y float32
Cb float32
Cr float32
A float32
}
type DXVAHD_COLOR struct {
RGB DXVAHD_COLOR_RGBA
YCbCr DXVAHD_COLOR_YCbCrA
}type
DXVAHD_COLOR_RGBA = record
R: Single;
G: Single;
B: Single;
A: Single;
end;
DXVAHD_COLOR_YCbCrA = record
Y: Single;
Cb: Single;
Cr: Single;
A: Single;
end;
DXVAHD_COLOR = record
RGB: DXVAHD_COLOR_RGBA;
YCbCr: DXVAHD_COLOR_YCbCrA;
end;const DXVAHD_COLOR_RGBA = extern struct {
R: f32,
G: f32,
B: f32,
A: f32,
};
const DXVAHD_COLOR_YCbCrA = extern struct {
Y: f32,
Cb: f32,
Cr: f32,
A: f32,
};
const DXVAHD_COLOR = extern struct {
RGB: DXVAHD_COLOR_RGBA,
YCbCr: DXVAHD_COLOR_YCbCrA,
};type
DXVAHD_COLOR_RGBA {.bycopy.} = object
R: float32
G: float32
B: float32
A: float32
DXVAHD_COLOR_YCbCrA {.bycopy.} = object
Y: float32
Cb: float32
Cr: float32
A: float32
DXVAHD_COLOR {.bycopy.} = object
RGB: DXVAHD_COLOR_RGBA
YCbCr: DXVAHD_COLOR_YCbCrAstruct DXVAHD_COLOR_RGBA
{
float R;
float G;
float B;
float A;
}
struct DXVAHD_COLOR_YCbCrA
{
float Y;
float Cb;
float Cr;
float A;
}
struct DXVAHD_COLOR
{
DXVAHD_COLOR_RGBA RGB;
DXVAHD_COLOR_YCbCrA YCbCr;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DXVAHD_COLOR サイズ: 16 バイト(x64)
dim st, 4 ; 4byte整数×4(構造体サイズ 16 / 4 切り上げ)
; RGB : DXVAHD_COLOR_RGBA (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; YCbCr : DXVAHD_COLOR_YCbCrA (+0, 16byte) varptr(st)+0 を基点に操作(16byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DXVAHD_COLOR_RGBA
#field float R
#field float G
#field float B
#field float A
#endstruct
#defstruct global DXVAHD_COLOR_YCbCrA
#field float Y
#field float Cb
#field float Cr
#field float A
#endstruct
#defstruct global DXVAHD_COLOR
#field DXVAHD_COLOR_RGBA RGB
#field DXVAHD_COLOR_YCbCrA YCbCr
#endstruct
stdim st, DXVAHD_COLOR ; NSTRUCT 変数を確保