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

MFGetStrideForBitmapInfoHeader

関数
指定形式と幅からビットマップ行の既定ストライドを取得する。
DLLMFPlat.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// MFPlat.dll
#include <windows.h>

HRESULT MFGetStrideForBitmapInfoHeader(
    DWORD format,
    DWORD dwWidth,
    INT* pStride
);

パラメーター

名前方向
formatDWORDin
dwWidthDWORDin
pStrideINT*out

戻り値の型: HRESULT

各言語での呼び出し定義

// MFPlat.dll
#include <windows.h>

HRESULT MFGetStrideForBitmapInfoHeader(
    DWORD format,
    DWORD dwWidth,
    INT* pStride
);
[DllImport("MFPlat.dll", ExactSpelling = true)]
static extern int MFGetStrideForBitmapInfoHeader(
    uint format,   // DWORD
    uint dwWidth,   // DWORD
    out int pStride   // INT* out
);
<DllImport("MFPlat.dll", ExactSpelling:=True)>
Public Shared Function MFGetStrideForBitmapInfoHeader(
    format As UInteger,   ' DWORD
    dwWidth As UInteger,   ' DWORD
    <Out> ByRef pStride As Integer   ' INT* out
) As Integer
End Function
' format : DWORD
' dwWidth : DWORD
' pStride : INT* out
Declare PtrSafe Function MFGetStrideForBitmapInfoHeader Lib "mfplat" ( _
    ByVal format As Long, _
    ByVal dwWidth As Long, _
    ByRef pStride As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

MFGetStrideForBitmapInfoHeader = ctypes.windll.mfplat.MFGetStrideForBitmapInfoHeader
MFGetStrideForBitmapInfoHeader.restype = ctypes.c_int
MFGetStrideForBitmapInfoHeader.argtypes = [
    wintypes.DWORD,  # format : DWORD
    wintypes.DWORD,  # dwWidth : DWORD
    ctypes.POINTER(ctypes.c_int),  # pStride : INT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('MFPlat.dll')
MFGetStrideForBitmapInfoHeader = Fiddle::Function.new(
  lib['MFGetStrideForBitmapInfoHeader'],
  [
    -Fiddle::TYPE_INT,  # format : DWORD
    -Fiddle::TYPE_INT,  # dwWidth : DWORD
    Fiddle::TYPE_VOIDP,  # pStride : INT* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "mfplat")]
extern "system" {
    fn MFGetStrideForBitmapInfoHeader(
        format: u32,  // DWORD
        dwWidth: u32,  // DWORD
        pStride: *mut i32  // INT* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("MFPlat.dll")]
public static extern int MFGetStrideForBitmapInfoHeader(uint format, uint dwWidth, out int pStride);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MFPlat_MFGetStrideForBitmapInfoHeader' -Namespace Win32 -PassThru
# $api::MFGetStrideForBitmapInfoHeader(format, dwWidth, pStride)
#uselib "MFPlat.dll"
#func global MFGetStrideForBitmapInfoHeader "MFGetStrideForBitmapInfoHeader" sptr, sptr, sptr
; MFGetStrideForBitmapInfoHeader format, dwWidth, varptr(pStride)   ; 戻り値は stat
; format : DWORD -> "sptr"
; dwWidth : DWORD -> "sptr"
; pStride : INT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "MFPlat.dll"
#cfunc global MFGetStrideForBitmapInfoHeader "MFGetStrideForBitmapInfoHeader" int, int, var
; res = MFGetStrideForBitmapInfoHeader(format, dwWidth, pStride)
; format : DWORD -> "int"
; dwWidth : DWORD -> "int"
; pStride : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT MFGetStrideForBitmapInfoHeader(DWORD format, DWORD dwWidth, INT* pStride)
#uselib "MFPlat.dll"
#cfunc global MFGetStrideForBitmapInfoHeader "MFGetStrideForBitmapInfoHeader" int, int, var
; res = MFGetStrideForBitmapInfoHeader(format, dwWidth, pStride)
; format : DWORD -> "int"
; dwWidth : DWORD -> "int"
; pStride : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	mfplat = windows.NewLazySystemDLL("MFPlat.dll")
	procMFGetStrideForBitmapInfoHeader = mfplat.NewProc("MFGetStrideForBitmapInfoHeader")
)

// format (DWORD), dwWidth (DWORD), pStride (INT* out)
r1, _, err := procMFGetStrideForBitmapInfoHeader.Call(
	uintptr(format),
	uintptr(dwWidth),
	uintptr(pStride),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function MFGetStrideForBitmapInfoHeader(
  format: DWORD;   // DWORD
  dwWidth: DWORD;   // DWORD
  pStride: Pointer   // INT* out
): Integer; stdcall;
  external 'MFPlat.dll' name 'MFGetStrideForBitmapInfoHeader';
result := DllCall("MFPlat\MFGetStrideForBitmapInfoHeader"
    , "UInt", format   ; DWORD
    , "UInt", dwWidth   ; DWORD
    , "Ptr", pStride   ; INT* out
    , "Int")   ; return: HRESULT
●MFGetStrideForBitmapInfoHeader(format, dwWidth, pStride) = DLL("MFPlat.dll", "int MFGetStrideForBitmapInfoHeader(dword, dword, void*)")
# 呼び出し: MFGetStrideForBitmapInfoHeader(format, dwWidth, pStride)
# format : DWORD -> "dword"
# dwWidth : DWORD -> "dword"
# pStride : INT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。