ホーム › Media.MediaFoundation › MFVideoAlphaBitmap
MFVideoAlphaBitmap
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| GetBitmapFromDC | BOOL | 4 | +0 | +0 | ビットマップをDCから取得する場合はTRUE、サーフェスから取得する場合はFALSE。 |
| bitmap | _bitmap_e__Union | 8/4 | +8 | +4 | DCハンドルまたはDirect3Dサーフェスを保持する無名共用体。 |
| params | MFVideoAlphaBitmapParams | 48 | +16 | +8 | アルファブレンド表示のパラメータを示すMFVideoAlphaBitmapParams。 |
共用体: _bitmap_e__Union x64 8B / x86 4B
| フィールド | 型 | サイズ | x64 | x86 |
|---|---|---|---|---|
| hdc | HDC | 8/4 | +0 | +0 |
| pDDS | IDirect3DSurface9* | 8/4 | +0 | +0 |
各言語での定義
#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 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),
]
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: MFVideoAlphaBitmapParamsstruct 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 非対応)。必要に応じ手動でアクセス。