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

VMR9AlphaBitmap

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0VMR9AlphaBitmapFlags 列挙型のフラグのビット単位の OR です。
hdcHDC8/4+8+4ビットマップの GDI デバイス コンテキスト (HDC) へのハンドルです。このメンバーに NULL 以外の値を格納する場合は、pDDSNULL に設定し、dwFlags メンバーに VMR9AlphaBitmap_hDC フラグを設定します。このデバイス コンテキストは GDI+ と互換性がありません。
pDDSIDirect3DSurface9*8/4+16+8ビットマップを格納する Direct3D サーフェスの IDirect3DSurface9 インターフェイスへのポインターです。このメンバーに有効なポインターを格納する場合は、hdc メンバーを NULL に設定します。サーフェスの形式は D3DFMT_X8R8G8B8 (32 ビット RGB) または D3DFMT_A8R8G8B8 (ピクセルごとのアルファを持つ 32 ビット RGB) でなければなりません。サーフェスは D3DPOOL_SYSTEMMEM プールから割り当てる必要があります。
rSrcRECT16+24+12

ソース イメージからコピーする矩形を指定します。この矩形は、GDI デバイス コンテキストまたは DirectDraw サーフェスを基準として指定します。

IVMRMixerBitmap9::SetAlphaBitmap を呼び出すとき、hdc メンバーで GDI ビットマップを指定する場合は、ソース矩形が有効でなければなりません。一方、pDDS メンバーで Direct3D サーフェスを指定する場合は、rSrc に有効な矩形を設定するか、dwFlags に VMR9AlphaBitmap_EntireDDS フラグを設定してサーフェス全体を使用できます。

IVMRMixerBitmap9::UpdateAlphaBitmapParameters を呼び出すとき、rSrc は常に省略可能であり、dwFlags に VMR9AlphaBitmap_SrcRect フラグが含まれている場合に使用されます。

rDestVMR9NormalizedRect16+40+28合成空間における転送先の矩形を指定します。
fAlphaFLOAT4+56+44アルファ ブレンディングの値を指定します。0.0 から 1.0 (両端を含む) までの値でなければなりません。
clrSrcKeyCOLORREF4+60+48ソースのカラー キーを指定します。この値は、dwFlags メンバーに VMR9AlphaBitmap_SrcColorKey が含まれている場合に使用されます。カラー キーは、ピクセルごとのアルファを含む Direct3D サーフェスでは使用できません。
dwFilterModeDWORD4+64+52

VMR9MixerPrefs 列挙型の次のいずれかのフラグ、またはフィルター処理を行わないことを指定する 0 です。

意味
MixerPref9_BiLinearFiltering
0x00000010
バイリニア補間フィルター処理です。
MixerPref9_PointFiltering
0x00000020
ポイント フィルター処理です。
MixerPref9_AnisotropicFiltering
0x00000040
異方性フィルター処理です。
MixerPref9_PyramidalQuadFiltering
0x00000080
4 サンプルのテント フィルター処理です。
MixerPref9_GaussianQuadFiltering
0x00000100
4 サンプルのガウス フィルター処理です。

この構造体メンバーは、dwFlags メンバーに VMR9AlphaBitmap_FilterMode フラグが含まれている場合にのみ使用されます。

ポイント フィルター処理は、テキストを含み、ミキシング前に引き伸ばす必要がないイメージに特に有効です。

公式ドキュメント

[このページに関連する機能 DirectShow はレガシー機能です。この機能は MediaPlayerIMFMediaEngine、および Media Foundation でのオーディオ/ビデオ キャプチャ に置き換えられました。これらの機能は Windows 10 および Windows 11 向けに最適化されています。Microsoft は、可能な場合は新しいコードで DirectShow ではなく MediaPlayerIMFMediaEngineAudio/Video Capture in Media Foundation を使用することを強く推奨します。また、レガシー API を使用している既存のコードについても、可能であれば新しい API を使用するように書き換えることを推奨します。]

VMR9AlphaBitmap 構造体は、アプリケーションがビデオ フレームとのアルファ ブレンディング用に静的なビットマップを提供する場合に、IVMRMixerBitmap9 インターフェイスとともに使用されます。

解説(Remarks)

GDI ビットマップの HDC を取得するには、次の手順を実行します。

  1. GetDC を呼び出して、アプリケーションのビデオ ウィンドウのデバイス コンテキストを取得します。
  2. CreateCompatibleDC を呼び出して、互換性のあるデバイス コンテキストを作成します。
  3. SelectObject を呼び出して、前の手順で取得したデバイス コンテキストにビットマップを選択します。
処理が終わったら、DeleteDC を呼び出してデバイス コンテキストを解放します。
出典・ライセンス: 上記「公式ドキュメント」の内容は 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;

// VMR9NormalizedRect  (x64 16 / x86 16 バイト)
typedef struct VMR9NormalizedRect {
    FLOAT left;
    FLOAT top;
    FLOAT right;
    FLOAT bottom;
} VMR9NormalizedRect;

// VMR9AlphaBitmap  (x64 72 / x86 56 バイト)
typedef struct VMR9AlphaBitmap {
    DWORD dwFlags;
    HDC hdc;
    IDirect3DSurface9* pDDS;
    RECT rSrc;
    VMR9NormalizedRect rDest;
    FLOAT fAlpha;
    COLORREF clrSrcKey;
    DWORD dwFilterMode;
} VMR9AlphaBitmap;
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 VMR9NormalizedRect
{
    public float left;
    public float top;
    public float right;
    public float bottom;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct VMR9AlphaBitmap
{
    public uint dwFlags;
    public IntPtr hdc;
    public IntPtr pDDS;
    public RECT rSrc;
    public VMR9NormalizedRect rDest;
    public float fAlpha;
    public uint clrSrcKey;
    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 VMR9NormalizedRect
    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 VMR9AlphaBitmap
    Public dwFlags As UInteger
    Public hdc As IntPtr
    Public pDDS As IntPtr
    Public rSrc As RECT
    Public rDest As VMR9NormalizedRect
    Public fAlpha As Single
    Public clrSrcKey As UInteger
    Public dwFilterMode As UInteger
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 VMR9NormalizedRect(ctypes.Structure):
    _fields_ = [
        ("left", ctypes.c_float),
        ("top", ctypes.c_float),
        ("right", ctypes.c_float),
        ("bottom", ctypes.c_float),
    ]

class VMR9AlphaBitmap(ctypes.Structure):
    _fields_ = [
        ("dwFlags", wintypes.DWORD),
        ("hdc", ctypes.c_void_p),
        ("pDDS", ctypes.c_void_p),
        ("rSrc", RECT),
        ("rDest", VMR9NormalizedRect),
        ("fAlpha", ctypes.c_float),
        ("clrSrcKey", wintypes.DWORD),
        ("dwFilterMode", wintypes.DWORD),
    ]
#[repr(C)]
pub struct RECT {
    pub left: i32,
    pub top: i32,
    pub right: i32,
    pub bottom: i32,
}

#[repr(C)]
pub struct VMR9NormalizedRect {
    pub left: f32,
    pub top: f32,
    pub right: f32,
    pub bottom: f32,
}

#[repr(C)]
pub struct VMR9AlphaBitmap {
    pub dwFlags: u32,
    pub hdc: *mut core::ffi::c_void,
    pub pDDS: *mut core::ffi::c_void,
    pub rSrc: RECT,
    pub rDest: VMR9NormalizedRect,
    pub fAlpha: f32,
    pub clrSrcKey: u32,
    pub dwFilterMode: u32,
}
import "golang.org/x/sys/windows"

type RECT struct {
	left int32
	top int32
	right int32
	bottom int32
}

type VMR9NormalizedRect struct {
	left float32
	top float32
	right float32
	bottom float32
}

type VMR9AlphaBitmap struct {
	dwFlags uint32
	hdc uintptr
	pDDS uintptr
	rSrc RECT
	rDest VMR9NormalizedRect
	fAlpha float32
	clrSrcKey uint32
	dwFilterMode uint32
}
type
  RECT = record
    left: Integer;
    top: Integer;
    right: Integer;
    bottom: Integer;
  end;

  VMR9NormalizedRect = record
    left: Single;
    top: Single;
    right: Single;
    bottom: Single;
  end;

  VMR9AlphaBitmap = record
    dwFlags: DWORD;
    hdc: Pointer;
    pDDS: Pointer;
    rSrc: RECT;
    rDest: VMR9NormalizedRect;
    fAlpha: Single;
    clrSrcKey: DWORD;
    dwFilterMode: DWORD;
  end;
const RECT = extern struct {
    left: i32,
    top: i32,
    right: i32,
    bottom: i32,
};

const VMR9NormalizedRect = extern struct {
    left: f32,
    top: f32,
    right: f32,
    bottom: f32,
};

const VMR9AlphaBitmap = extern struct {
    dwFlags: u32,
    hdc: ?*anyopaque,
    pDDS: ?*anyopaque,
    rSrc: RECT,
    rDest: VMR9NormalizedRect,
    fAlpha: f32,
    clrSrcKey: u32,
    dwFilterMode: u32,
};
type
  RECT {.bycopy.} = object
    left: int32
    top: int32
    right: int32
    bottom: int32

  VMR9NormalizedRect {.bycopy.} = object
    left: float32
    top: float32
    right: float32
    bottom: float32

  VMR9AlphaBitmap {.bycopy.} = object
    dwFlags: uint32
    hdc: pointer
    pDDS: pointer
    rSrc: RECT
    rDest: VMR9NormalizedRect
    fAlpha: float32
    clrSrcKey: uint32
    dwFilterMode: uint32
struct RECT
{
    int left;
    int top;
    int right;
    int bottom;
}

struct VMR9NormalizedRect
{
    float left;
    float top;
    float right;
    float bottom;
}

struct VMR9AlphaBitmap
{
    uint dwFlags;
    void* hdc;
    void* pDDS;
    RECT rSrc;
    VMR9NormalizedRect rDest;
    float fAlpha;
    uint clrSrcKey;
    uint dwFilterMode;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; VMR9AlphaBitmap サイズ: 56 バイト(x86)
dim st, 14    ; 4byte整数×14(構造体サイズ 56 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hdc : HDC (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; pDDS : IDirect3DSurface9* (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; rSrc : RECT (+12, 16byte)  varptr(st)+12 を基点に操作(16byte:入れ子/配列)
; rDest : VMR9NormalizedRect (+28, 16byte)  varptr(st)+28 を基点に操作(16byte:入れ子/配列)
; fAlpha : FLOAT (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; clrSrcKey : COLORREF (+48, 4byte)  st.12 = 値  /  値 = st.12   (lpoke/lpeek も可)
; dwFilterMode : DWORD (+52, 4byte)  st.13 = 値  /  値 = st.13   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; VMR9AlphaBitmap サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; dwFlags : DWORD (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; hdc : HDC (+8, 8byte)  qpoke st,8,値 / qpeek(st,8)  ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; pDDS : IDirect3DSurface9* (+16, 8byte)  qpoke st,16,値 / qpeek(st,16)  ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; rSrc : RECT (+24, 16byte)  varptr(st)+24 を基点に操作(16byte:入れ子/配列)
; rDest : VMR9NormalizedRect (+40, 16byte)  varptr(st)+40 を基点に操作(16byte:入れ子/配列)
; fAlpha : FLOAT (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; clrSrcKey : COLORREF (+60, 4byte)  st.15 = 値  /  値 = st.15   (lpoke/lpeek も可)
; dwFilterMode : DWORD (+64, 4byte)  st.16 = 値  /  値 = st.16   (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 VMR9NormalizedRect
    #field float left
    #field float top
    #field float right
    #field float bottom
#endstruct

#defstruct global VMR9AlphaBitmap
    #field int dwFlags
    #field intptr hdc
    #field intptr pDDS
    #field RECT rSrc
    #field VMR9NormalizedRect rDest
    #field float fAlpha
    #field int clrSrcKey
    #field int dwFilterMode
#endstruct

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