Win32 API 日本語リファレンス
ホームMedia.MediaFoundation › MFVideoAlphaBitmap

MFVideoAlphaBitmap

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

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

フィールド

フィールドサイズx64x86説明
GetBitmapFromDCBOOL4+0+0TRUE の場合、hdc メンバーが使用されます。それ以外の場合は pDDs メンバーが使用されます。
bitmap_bitmap_e__Union8/4+8+4

次のメンバーを含む共用体です。

pDDs

ビットマップを格納する Direct3D サーフェスの IDirect3DSurface9 インターフェイスへのポインターです。GetBitmapFromDCTRUE の場合、このメンバーは無視されます。

paramsMFVideoAlphaBitmapParams48+16+8アルファ ブレンド操作のパラメーターを指定する MFVideoAlphaBitmapParams 構造体です。

共用体: _bitmap_e__Union x64 8B / x86 4B

フィールドサイズx64x86説明
hdcHDC8/4+0+0GDI ビットマップのデバイス コンテキスト (DC) へのハンドルです。GetBitmapFromDCFALSE の場合、このメンバーは無視されます。
pDDSIDirect3DSurface9*8/4+0+0

公式ドキュメント

[このページで説明するコンポーネント Enhanced Video Renderer はレガシー機能です。これは MediaPlayer および IMFMediaEngine コンポーネントを通じて公開される Simple Video Renderer (SVR) に置き換えられました。ビデオ コンテンツを再生するには、これらのコンポーネントのいずれかにデータを送り、新しいビデオ レンダラーをインスタンス化させてください。これらのコンポーネントは Windows 10 および Windows 11 向けに最適化されています。Microsoft は、Windows でビデオ メディアを再生する場合、可能な限り EVR ではなく MediaPlayer または下位レベルの IMFMediaEngine API を新しいコードで使用することを強く推奨します。レガシー API を使用している既存のコードについても、可能であれば新しい API を使用するように書き換えることを Microsoft は推奨します。]

拡張ビデオ レンダラー (EVR) がビデオにアルファ ブレンドするビットマップを指定します。

解説(Remarks)

GDI ビットマップを指定するには、デバイス コンテキストを作成し、SelectObject を呼び出してビットマップを DC に選択します。次に、構造体の hdc メンバーにその DC のハンドルを設定し、GetBitmapFromDC メンバーを TRUE に設定します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
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;

// MFVideoAlphaBitmap  (x64 64 / x86 56 バイト)
typedef struct MFVideoAlphaBitmap {
    BOOL GetBitmapFromDC;
    _bitmap_e__Union bitmap;
    MFVideoAlphaBitmapParams params;
} MFVideoAlphaBitmap;
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;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MFVideoAlphaBitmap
{
    [MarshalAs(UnmanagedType.Bool)] public bool GetBitmapFromDC;
    public _bitmap_e__Union bitmap;
    public MFVideoAlphaBitmapParams params;
}
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 Structure

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MFVideoAlphaBitmap
    <MarshalAs(UnmanagedType.Bool)> Public GetBitmapFromDC As Boolean
    Public bitmap As _bitmap_e__Union
    Public params As MFVideoAlphaBitmapParams
End Structure
import 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),
    ]

class MFVideoAlphaBitmap(ctypes.Structure):
    _fields_ = [
        ("GetBitmapFromDC", wintypes.BOOL),
        ("bitmap", _bitmap_e__Union),
        ("params", MFVideoAlphaBitmapParams),
    ]
#[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,
}

#[repr(C)]
pub struct MFVideoAlphaBitmap {
    pub GetBitmapFromDC: i32,
    pub bitmap: _bitmap_e__Union,
    pub params: MFVideoAlphaBitmapParams,
}
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 MFVideoAlphaBitmap struct {
	GetBitmapFromDC int32
	bitmap _bitmap_e__Union
	params MFVideoAlphaBitmapParams
}
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;

  MFVideoAlphaBitmap = record
    GetBitmapFromDC: BOOL;
    bitmap: _bitmap_e__Union;
    params: MFVideoAlphaBitmapParams;
  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,
};

const MFVideoAlphaBitmap = extern struct {
    GetBitmapFromDC: i32,
    bitmap: _bitmap_e__Union,
    params: MFVideoAlphaBitmapParams,
};
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: uint32

  MFVideoAlphaBitmap {.bycopy.} = object
    GetBitmapFromDC: int32
    bitmap: _bitmap_e__Union
    params: MFVideoAlphaBitmapParams
struct 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;
}

struct MFVideoAlphaBitmap
{
    int GetBitmapFromDC;
    _bitmap_e__Union bitmap;
    MFVideoAlphaBitmapParams params;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MFVideoAlphaBitmap サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; GetBitmapFromDC : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; bitmap : _bitmap_e__Union (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; params : MFVideoAlphaBitmapParams (+8, 48byte)  varptr(st)+8 を基点に操作(48byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MFVideoAlphaBitmap サイズ: 64 バイト(x64)
dim st, 16    ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; GetBitmapFromDC : BOOL (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; bitmap : _bitmap_e__Union (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; params : MFVideoAlphaBitmapParams (+16, 48byte)  varptr(st)+16 を基点に操作(48byte:入れ子/配列)
; ※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

#defstruct global MFVideoAlphaBitmap
    #field bool GetBitmapFromDC
    #field byte bitmap 8
    #field MFVideoAlphaBitmapParams params
#endstruct

stdim st, MFVideoAlphaBitmap        ; NSTRUCT 変数を確保
st->GetBitmapFromDC = 100
mes "GetBitmapFromDC=" + st->GetBitmapFromDC
; ※union フィールドは byte 列で確保(NSTRUCT は union 非対応)。必要に応じ手動でアクセス。