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

VMRALPHABITMAP

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

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

フィールド

フィールドサイズx64x86説明
dwFlagsDWORD4+0+0アルファビットマップの指定方法を示すフラグ(VMRBITMAP_*)を示す。
hdcHDC8/4+8+4ビットマップのソースとなるデバイスコンテキストのハンドル。
pDDSIDirectDrawSurface7*8/4+16+8ビットマップのソースとなるIDirectDrawSurface7へのポインター。
rSrcRECT16+24+12ソースビットマップの矩形を示すRECT構造体。
rDestNORMALIZEDRECT16+40+28描画先の正規化矩形を示すNORMALIZEDRECT構造体。
fAlphaFLOAT4+56+44ビットマップ全体のアルファ値を0から1の範囲で示す。
clrSrcKeyCOLORREF4+60+48透過色として扱うソースカラーキーを示すCOLORREF値。

各言語での定義

#include <windows.h>

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

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

// VMRALPHABITMAP  (x64 64 / x86 52 バイト)
typedef struct VMRALPHABITMAP {
    DWORD dwFlags;
    HDC hdc;
    IDirectDrawSurface7* pDDS;
    RECT rSrc;
    NORMALIZEDRECT rDest;
    FLOAT fAlpha;
    COLORREF clrSrcKey;
} VMRALPHABITMAP;
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 NORMALIZEDRECT
{
    public float left;
    public float top;
    public float right;
    public float bottom;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

struct VMRALPHABITMAP
{
    uint dwFlags;
    void* hdc;
    void* pDDS;
    RECT rSrc;
    NORMALIZEDRECT rDest;
    float fAlpha;
    uint clrSrcKey;
}

HSP用 定義

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

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

#defstruct global VMRALPHABITMAP
    #field int dwFlags
    #field intptr hdc
    #field intptr pDDS
    #field RECT rSrc
    #field NORMALIZEDRECT rDest
    #field float fAlpha
    #field int clrSrcKey
#endstruct

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