ホーム › Media.Multimedia › ICImageCompress
ICImageCompress
関数単一画像を映像コーデックで圧縮する。
シグネチャ
// MSVFW32.dll
#include <windows.h>
HANDLE ICImageCompress(
HIC hic,
DWORD uiFlags,
BITMAPINFO* lpbiIn,
void* lpBits,
BITMAPINFO* lpbiOut, // optional
INT lQuality,
INT* plSize // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hic | HIC | in |
| uiFlags | DWORD | in |
| lpbiIn | BITMAPINFO* | in |
| lpBits | void* | in |
| lpbiOut | BITMAPINFO* | inoptional |
| lQuality | INT | in |
| plSize | INT* | inoutoptional |
戻り値の型: HANDLE
各言語での呼び出し定義
// MSVFW32.dll
#include <windows.h>
HANDLE ICImageCompress(
HIC hic,
DWORD uiFlags,
BITMAPINFO* lpbiIn,
void* lpBits,
BITMAPINFO* lpbiOut, // optional
INT lQuality,
INT* plSize // optional
);[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICImageCompress(
IntPtr hic, // HIC
uint uiFlags, // DWORD
IntPtr lpbiIn, // BITMAPINFO*
IntPtr lpBits, // void*
IntPtr lpbiOut, // BITMAPINFO* optional
int lQuality, // INT
IntPtr plSize // INT* optional, in/out
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICImageCompress(
hic As IntPtr, ' HIC
uiFlags As UInteger, ' DWORD
lpbiIn As IntPtr, ' BITMAPINFO*
lpBits As IntPtr, ' void*
lpbiOut As IntPtr, ' BITMAPINFO* optional
lQuality As Integer, ' INT
plSize As IntPtr ' INT* optional, in/out
) As IntPtr
End Function' hic : HIC
' uiFlags : DWORD
' lpbiIn : BITMAPINFO*
' lpBits : void*
' lpbiOut : BITMAPINFO* optional
' lQuality : INT
' plSize : INT* optional, in/out
Declare PtrSafe Function ICImageCompress Lib "msvfw32" ( _
ByVal hic As LongPtr, _
ByVal uiFlags As Long, _
ByVal lpbiIn As LongPtr, _
ByVal lpBits As LongPtr, _
ByVal lpbiOut As LongPtr, _
ByVal lQuality As Long, _
ByVal plSize As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ICImageCompress = ctypes.windll.msvfw32.ICImageCompress
ICImageCompress.restype = ctypes.c_void_p
ICImageCompress.argtypes = [
wintypes.HANDLE, # hic : HIC
wintypes.DWORD, # uiFlags : DWORD
ctypes.c_void_p, # lpbiIn : BITMAPINFO*
ctypes.POINTER(None), # lpBits : void*
ctypes.c_void_p, # lpbiOut : BITMAPINFO* optional
ctypes.c_int, # lQuality : INT
ctypes.POINTER(ctypes.c_int), # plSize : INT* optional, in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
ICImageCompress = Fiddle::Function.new(
lib['ICImageCompress'],
[
Fiddle::TYPE_VOIDP, # hic : HIC
-Fiddle::TYPE_INT, # uiFlags : DWORD
Fiddle::TYPE_VOIDP, # lpbiIn : BITMAPINFO*
Fiddle::TYPE_VOIDP, # lpBits : void*
Fiddle::TYPE_VOIDP, # lpbiOut : BITMAPINFO* optional
Fiddle::TYPE_INT, # lQuality : INT
Fiddle::TYPE_VOIDP, # plSize : INT* optional, in/out
],
Fiddle::TYPE_VOIDP)#[link(name = "msvfw32")]
extern "system" {
fn ICImageCompress(
hic: *mut core::ffi::c_void, // HIC
uiFlags: u32, // DWORD
lpbiIn: *mut BITMAPINFO, // BITMAPINFO*
lpBits: *mut (), // void*
lpbiOut: *mut BITMAPINFO, // BITMAPINFO* optional
lQuality: i32, // INT
plSize: *mut i32 // INT* optional, in/out
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICImageCompress(IntPtr hic, uint uiFlags, IntPtr lpbiIn, IntPtr lpBits, IntPtr lpbiOut, int lQuality, IntPtr plSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICImageCompress' -Namespace Win32 -PassThru
# $api::ICImageCompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize)#uselib "MSVFW32.dll"
#func global ICImageCompress "ICImageCompress" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ICImageCompress hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut), lQuality, varptr(plSize) ; 戻り値は stat
; hic : HIC -> "sptr"
; uiFlags : DWORD -> "sptr"
; lpbiIn : BITMAPINFO* -> "sptr"
; lpBits : void* -> "sptr"
; lpbiOut : BITMAPINFO* optional -> "sptr"
; lQuality : INT -> "sptr"
; plSize : INT* optional, in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSVFW32.dll" #cfunc global ICImageCompress "ICImageCompress" sptr, int, var, sptr, var, int, var ; res = ICImageCompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize) ; hic : HIC -> "sptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "var" ; lpBits : void* -> "sptr" ; lpbiOut : BITMAPINFO* optional -> "var" ; lQuality : INT -> "int" ; plSize : INT* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSVFW32.dll" #cfunc global ICImageCompress "ICImageCompress" sptr, int, sptr, sptr, sptr, int, sptr ; res = ICImageCompress(hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut), lQuality, varptr(plSize)) ; hic : HIC -> "sptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "sptr" ; lpBits : void* -> "sptr" ; lpbiOut : BITMAPINFO* optional -> "sptr" ; lQuality : INT -> "int" ; plSize : INT* optional, in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HANDLE ICImageCompress(HIC hic, DWORD uiFlags, BITMAPINFO* lpbiIn, void* lpBits, BITMAPINFO* lpbiOut, INT lQuality, INT* plSize) #uselib "MSVFW32.dll" #cfunc global ICImageCompress "ICImageCompress" intptr, int, var, intptr, var, int, var ; res = ICImageCompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize) ; hic : HIC -> "intptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "var" ; lpBits : void* -> "intptr" ; lpbiOut : BITMAPINFO* optional -> "var" ; lQuality : INT -> "int" ; plSize : INT* optional, in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HANDLE ICImageCompress(HIC hic, DWORD uiFlags, BITMAPINFO* lpbiIn, void* lpBits, BITMAPINFO* lpbiOut, INT lQuality, INT* plSize) #uselib "MSVFW32.dll" #cfunc global ICImageCompress "ICImageCompress" intptr, int, intptr, intptr, intptr, int, intptr ; res = ICImageCompress(hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut), lQuality, varptr(plSize)) ; hic : HIC -> "intptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "intptr" ; lpBits : void* -> "intptr" ; lpbiOut : BITMAPINFO* optional -> "intptr" ; lQuality : INT -> "int" ; plSize : INT* optional, in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procICImageCompress = msvfw32.NewProc("ICImageCompress")
)
// hic (HIC), uiFlags (DWORD), lpbiIn (BITMAPINFO*), lpBits (void*), lpbiOut (BITMAPINFO* optional), lQuality (INT), plSize (INT* optional, in/out)
r1, _, err := procICImageCompress.Call(
uintptr(hic),
uintptr(uiFlags),
uintptr(lpbiIn),
uintptr(lpBits),
uintptr(lpbiOut),
uintptr(lQuality),
uintptr(plSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction ICImageCompress(
hic: THandle; // HIC
uiFlags: DWORD; // DWORD
lpbiIn: Pointer; // BITMAPINFO*
lpBits: Pointer; // void*
lpbiOut: Pointer; // BITMAPINFO* optional
lQuality: Integer; // INT
plSize: Pointer // INT* optional, in/out
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICImageCompress';result := DllCall("MSVFW32\ICImageCompress"
, "Ptr", hic ; HIC
, "UInt", uiFlags ; DWORD
, "Ptr", lpbiIn ; BITMAPINFO*
, "Ptr", lpBits ; void*
, "Ptr", lpbiOut ; BITMAPINFO* optional
, "Int", lQuality ; INT
, "Ptr", plSize ; INT* optional, in/out
, "Ptr") ; return: HANDLE●ICImageCompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize) = DLL("MSVFW32.dll", "void* ICImageCompress(void*, dword, void*, void*, void*, int, void*)")
# 呼び出し: ICImageCompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut, lQuality, plSize)
# hic : HIC -> "void*"
# uiFlags : DWORD -> "dword"
# lpbiIn : BITMAPINFO* -> "void*"
# lpBits : void* -> "void*"
# lpbiOut : BITMAPINFO* optional -> "void*"
# lQuality : INT -> "int"
# plSize : INT* optional, in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。