MFVideoAlphaBitmapParams
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| dwFlags | DWORD | 4 | +0 | +0 | MFVideoAlphaBitmapFlags 列挙型の 1 つ以上のフラグのビット単位の OR です。これらのフラグは、この構造体の他のメンバーのうちどれに有効な情報が格納されているかを示します。 |
| clrSrcKey | COLORREF | 4 | +4 | +4 | ソースカラーキーです。このメンバーは、dwFlags メンバーに MFVideoAlphaBitmap_SrcColorKey フラグが含まれている場合に使用されます。ビットマップ内でカラーキーに一致するピクセルは、透明なピクセルとして描画されます。 ピクセル単位のアルファを持つ Direct3D サーフェス (D3DFMT_A8R8G8B8) をアルファブレンドする場合は、カラーキーを指定できません。 |
| rcSrc | RECT | 16 | +8 | +8 | ソース矩形です。ソース矩形は、ビデオにアルファブレンドされるビットマップの領域を定義します。ソース矩形はピクセル単位で指定し、元のビットマップを基準とした座標になります。 GDI ビットマップをアルファブレンドする場合は、IMFVideoMixerBitmap::SetAlphaBitmap を呼び出す際にこの構造体を設定する必要があります。 Direct3D サーフェスをアルファブレンドする場合で、dwFlags メンバーに MFVideoAlphaBitmap_EntireDDS フラグが含まれているときは、rcSrc メンバーは無視されます。このフラグが指定されていない場合は、rcSrc メンバーを設定する必要があります。 最初のビットマップを設定した後、IMFVideoMixerBitmap::UpdateAlphaBitmapParameters を呼び出してソース矩形を更新できます。ソース矩形を更新するには、dwFlags メンバーに MFVideoAlphaBitmap_SrcColorKey フラグを設定します。 ソース矩形を空の矩形にすることはできず、またビットマップの範囲を超えることもできません。 |
| nrcDest | MFVideoNormalizedRect | 16 | +24 | +24 | 転送先矩形です。転送先矩形は、アルファブレンドされたビットマップを受け取る合成後のビデオイメージの領域を定義します。転送先矩形は、MFVideoNormalizedRect 構造体を使用して正規化された矩形として指定します。 このメンバーは、dwFlags メンバーに MFVideoAlphaBitmap_DestRect フラグが含まれている場合に使用されます。含まれていない場合、既定の転送先矩形は {0, 0, 1, 1} です。 |
| fAlpha | FLOAT | 4 | +40 | +40 | アルファブレンドの値です。このメンバーは、dwFlags メンバーに MFVideoAlphaBitmap_Alpha フラグが含まれている場合に使用されます。含まれていない場合、既定値は 1.0 (不透明) です。有効な範囲は 0.0 から 1.0 まで (両端を含む) です。 この値はビットマップイメージ全体に適用されます。透明な領域を作成するには、clrSrcKey メンバーを使用するか、ピクセル単位のアルファを持つ DirectDraw サーフェスを使用します。 |
| dwFilterMode | DWORD | 4 | +44 | +44 | アルファブレンド操作を実行するときに使用する Direct3D のフィルターモードです。フィルターモードは D3DTEXTUREFILTERTYPE 値で指定します。詳細については、Direct3D のドキュメントを参照してください。 このメンバーは、dwFlags メンバーに MFVideoAlphaBitmap_FilterMode フラグが含まれている場合に使用されます。含まれていない場合、既定値は D3DTEXF_POINT です。 ポイントフィルタリングは、テキストを含み、拡大縮小されないイメージに特に有用です。 |
公式ドキュメント
[このページで説明するコンポーネント Enhanced Video Renderer はレガシー機能です。これは MediaPlayer および IMFMediaEngine コンポーネントを通じて公開される Simple Video Renderer (SVR) に置き換えられました。ビデオコンテンツを再生するには、これらのコンポーネントのいずれかにデータを送信し、新しいビデオレンダラーをインスタンス化させてください。これらのコンポーネントは Windows 10 および Windows 11 向けに最適化されています。Microsoft は、Windows でビデオメディアを再生する新しいコードでは、可能な限り EVR ではなく MediaPlayer または低レベルの IMFMediaEngine API を使用することを強く推奨します。レガシー API を使用している既存のコードについても、可能であれば新しい API を使用するように書き直すことを推奨します。]
拡張ビデオレンダラー (EVR) がビットマップをビデオにアルファブレンドする方法を指定します。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での定義
#include <windows.h>
// RECT (x64 16 / x86 16 バイト)
typedef struct RECT {
INT left;
INT top;
INT right;
INT bottom;
} RECT;
// MFVideoNormalizedRect (x64 16 / x86 16 バイト)
typedef struct MFVideoNormalizedRect {
FLOAT left;
FLOAT top;
FLOAT right;
FLOAT bottom;
} MFVideoNormalizedRect;
// MFVideoAlphaBitmapParams (x64 48 / x86 48 バイト)
typedef struct MFVideoAlphaBitmapParams {
DWORD dwFlags;
COLORREF clrSrcKey;
RECT rcSrc;
MFVideoNormalizedRect nrcDest;
FLOAT fAlpha;
DWORD dwFilterMode;
} MFVideoAlphaBitmapParams;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct RECT
{
public int left;
public int top;
public int right;
public int bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoNormalizedRect
{
public float left;
public float top;
public float right;
public float bottom;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoAlphaBitmapParams
{
public uint dwFlags;
public uint clrSrcKey;
public RECT rcSrc;
public MFVideoNormalizedRect nrcDest;
public float fAlpha;
public uint dwFilterMode;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure RECT
Public left As Integer
Public top As Integer
Public right As Integer
Public bottom As Integer
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoNormalizedRect
Public left As Single
Public top As Single
Public right As Single
Public bottom As Single
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoAlphaBitmapParams
Public dwFlags As UInteger
Public clrSrcKey As UInteger
Public rcSrc As RECT
Public nrcDest As MFVideoNormalizedRect
Public fAlpha As Single
Public dwFilterMode As UInteger
End Structureimport ctypes
from ctypes import wintypes
class RECT(ctypes.Structure):
_fields_ = [
("left", ctypes.c_int),
("top", ctypes.c_int),
("right", ctypes.c_int),
("bottom", ctypes.c_int),
]
class MFVideoNormalizedRect(ctypes.Structure):
_fields_ = [
("left", ctypes.c_float),
("top", ctypes.c_float),
("right", ctypes.c_float),
("bottom", ctypes.c_float),
]
class MFVideoAlphaBitmapParams(ctypes.Structure):
_fields_ = [
("dwFlags", wintypes.DWORD),
("clrSrcKey", wintypes.DWORD),
("rcSrc", RECT),
("nrcDest", MFVideoNormalizedRect),
("fAlpha", ctypes.c_float),
("dwFilterMode", wintypes.DWORD),
]#[repr(C)]
pub struct RECT {
pub left: i32,
pub top: i32,
pub right: i32,
pub bottom: i32,
}
#[repr(C)]
pub struct MFVideoNormalizedRect {
pub left: f32,
pub top: f32,
pub right: f32,
pub bottom: f32,
}
#[repr(C)]
pub struct MFVideoAlphaBitmapParams {
pub dwFlags: u32,
pub clrSrcKey: u32,
pub rcSrc: RECT,
pub nrcDest: MFVideoNormalizedRect,
pub fAlpha: f32,
pub dwFilterMode: u32,
}import "golang.org/x/sys/windows"
type RECT struct {
left int32
top int32
right int32
bottom int32
}
type MFVideoNormalizedRect struct {
left float32
top float32
right float32
bottom float32
}
type MFVideoAlphaBitmapParams struct {
dwFlags uint32
clrSrcKey uint32
rcSrc RECT
nrcDest MFVideoNormalizedRect
fAlpha float32
dwFilterMode uint32
}type
RECT = record
left: Integer;
top: Integer;
right: Integer;
bottom: Integer;
end;
MFVideoNormalizedRect = record
left: Single;
top: Single;
right: Single;
bottom: Single;
end;
MFVideoAlphaBitmapParams = record
dwFlags: DWORD;
clrSrcKey: DWORD;
rcSrc: RECT;
nrcDest: MFVideoNormalizedRect;
fAlpha: Single;
dwFilterMode: DWORD;
end;const RECT = extern struct {
left: i32,
top: i32,
right: i32,
bottom: i32,
};
const MFVideoNormalizedRect = extern struct {
left: f32,
top: f32,
right: f32,
bottom: f32,
};
const MFVideoAlphaBitmapParams = extern struct {
dwFlags: u32,
clrSrcKey: u32,
rcSrc: RECT,
nrcDest: MFVideoNormalizedRect,
fAlpha: f32,
dwFilterMode: u32,
};type
RECT {.bycopy.} = object
left: int32
top: int32
right: int32
bottom: int32
MFVideoNormalizedRect {.bycopy.} = object
left: float32
top: float32
right: float32
bottom: float32
MFVideoAlphaBitmapParams {.bycopy.} = object
dwFlags: uint32
clrSrcKey: uint32
rcSrc: RECT
nrcDest: MFVideoNormalizedRect
fAlpha: float32
dwFilterMode: uint32struct RECT
{
int left;
int top;
int right;
int bottom;
}
struct MFVideoNormalizedRect
{
float left;
float top;
float right;
float bottom;
}
struct MFVideoAlphaBitmapParams
{
uint dwFlags;
uint clrSrcKey;
RECT rcSrc;
MFVideoNormalizedRect nrcDest;
float fAlpha;
uint dwFilterMode;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFVideoAlphaBitmapParams サイズ: 48 バイト(x64)
dim st, 12 ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; clrSrcKey : COLORREF (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; rcSrc : RECT (+8, 16byte) varptr(st)+8 を基点に操作(16byte:入れ子/配列)
; nrcDest : MFVideoNormalizedRect (+24, 16byte) varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; fAlpha : FLOAT (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; dwFilterMode : DWORD (+44, 4byte) st.11 = 値 / 値 = st.11 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global RECT
#field int left
#field int top
#field int right
#field int bottom
#endstruct
#defstruct global MFVideoNormalizedRect
#field float left
#field float top
#field float right
#field float bottom
#endstruct
#defstruct global MFVideoAlphaBitmapParams
#field int dwFlags
#field int clrSrcKey
#field RECT rcSrc
#field MFVideoNormalizedRect nrcDest
#field float fAlpha
#field int dwFilterMode
#endstruct
stdim st, MFVideoAlphaBitmapParams ; NSTRUCT 変数を確保
st->dwFlags = 100
mes "dwFlags=" + st->dwFlags