ホーム › Media.Multimedia › ICImageDecompress
ICImageDecompress
関数圧縮された単一画像を映像コーデックで伸張する。
シグネチャ
// MSVFW32.dll
#include <windows.h>
HANDLE ICImageDecompress(
HIC hic, // optional
DWORD uiFlags,
BITMAPINFO* lpbiIn,
void* lpBits,
BITMAPINFO* lpbiOut // optional
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hic | HIC | inoptional | ICOpen 関数で開いた展開器へのハンドルです。NULL を指定すると、圧縮されたイメージに対して VCM が適切な展開器を選択します。 |
| uiFlags | DWORD | in | 予約済みです。0 にする必要があります。 |
| lpbiIn | BITMAPINFO* | in | 圧縮された入力データの形式です。 |
| lpBits | void* | in | 圧縮する入力データビットへのポインターです。データビットにはヘッダーや形式情報は含まれません。 |
| lpbiOut | BITMAPINFO* | inoptional | 展開後の出力形式です。NULL を指定すると、展開器が適切な形式を使用します。 |
戻り値の型: HANDLE
公式ドキュメント
ICImageDecompress 関数は、初期化関数を使用せずにイメージを展開します。
戻り値
成功した場合は CF_DIB 形式の非圧縮 DIB へのハンドルを返し、失敗した場合は NULL を返します。イメージデータは形式ヘッダーの後に続きます。
解説(Remarks)
LPBITMAPINFOHEADER 構造体から形式情報を取得するには、GlobalLock 関数を使用してデータをロックします。処理が完了したら、GlobalFree 関数を使用して DIB を解放します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// MSVFW32.dll
#include <windows.h>
HANDLE ICImageDecompress(
HIC hic, // optional
DWORD uiFlags,
BITMAPINFO* lpbiIn,
void* lpBits,
BITMAPINFO* lpbiOut // optional
);[DllImport("MSVFW32.dll", ExactSpelling = true)]
static extern IntPtr ICImageDecompress(
IntPtr hic, // HIC optional
uint uiFlags, // DWORD
IntPtr lpbiIn, // BITMAPINFO*
IntPtr lpBits, // void*
IntPtr lpbiOut // BITMAPINFO* optional
);<DllImport("MSVFW32.dll", ExactSpelling:=True)>
Public Shared Function ICImageDecompress(
hic As IntPtr, ' HIC optional
uiFlags As UInteger, ' DWORD
lpbiIn As IntPtr, ' BITMAPINFO*
lpBits As IntPtr, ' void*
lpbiOut As IntPtr ' BITMAPINFO* optional
) As IntPtr
End Function' hic : HIC optional
' uiFlags : DWORD
' lpbiIn : BITMAPINFO*
' lpBits : void*
' lpbiOut : BITMAPINFO* optional
Declare PtrSafe Function ICImageDecompress Lib "msvfw32" ( _
ByVal hic As LongPtr, _
ByVal uiFlags As Long, _
ByVal lpbiIn As LongPtr, _
ByVal lpBits As LongPtr, _
ByVal lpbiOut As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ICImageDecompress = ctypes.windll.msvfw32.ICImageDecompress
ICImageDecompress.restype = ctypes.c_void_p
ICImageDecompress.argtypes = [
wintypes.HANDLE, # hic : HIC optional
wintypes.DWORD, # uiFlags : DWORD
ctypes.c_void_p, # lpbiIn : BITMAPINFO*
ctypes.POINTER(None), # lpBits : void*
ctypes.c_void_p, # lpbiOut : BITMAPINFO* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('MSVFW32.dll')
ICImageDecompress = Fiddle::Function.new(
lib['ICImageDecompress'],
[
Fiddle::TYPE_VOIDP, # hic : HIC optional
-Fiddle::TYPE_INT, # uiFlags : DWORD
Fiddle::TYPE_VOIDP, # lpbiIn : BITMAPINFO*
Fiddle::TYPE_VOIDP, # lpBits : void*
Fiddle::TYPE_VOIDP, # lpbiOut : BITMAPINFO* optional
],
Fiddle::TYPE_VOIDP)#[link(name = "msvfw32")]
extern "system" {
fn ICImageDecompress(
hic: *mut core::ffi::c_void, // HIC optional
uiFlags: u32, // DWORD
lpbiIn: *mut BITMAPINFO, // BITMAPINFO*
lpBits: *mut (), // void*
lpbiOut: *mut BITMAPINFO // BITMAPINFO* optional
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("MSVFW32.dll")]
public static extern IntPtr ICImageDecompress(IntPtr hic, uint uiFlags, IntPtr lpbiIn, IntPtr lpBits, IntPtr lpbiOut);
"@
$api = Add-Type -MemberDefinition $sig -Name 'MSVFW32_ICImageDecompress' -Namespace Win32 -PassThru
# $api::ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut)#uselib "MSVFW32.dll"
#func global ICImageDecompress "ICImageDecompress" sptr, sptr, sptr, sptr, sptr
; ICImageDecompress hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut) ; 戻り値は stat
; hic : HIC optional -> "sptr"
; uiFlags : DWORD -> "sptr"
; lpbiIn : BITMAPINFO* -> "sptr"
; lpBits : void* -> "sptr"
; lpbiOut : BITMAPINFO* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "MSVFW32.dll" #cfunc global ICImageDecompress "ICImageDecompress" sptr, int, var, sptr, var ; res = ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut) ; hic : HIC optional -> "sptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "var" ; lpBits : void* -> "sptr" ; lpbiOut : BITMAPINFO* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "MSVFW32.dll" #cfunc global ICImageDecompress "ICImageDecompress" sptr, int, sptr, sptr, sptr ; res = ICImageDecompress(hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut)) ; hic : HIC optional -> "sptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "sptr" ; lpBits : void* -> "sptr" ; lpbiOut : BITMAPINFO* optional -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HANDLE ICImageDecompress(HIC hic, DWORD uiFlags, BITMAPINFO* lpbiIn, void* lpBits, BITMAPINFO* lpbiOut) #uselib "MSVFW32.dll" #cfunc global ICImageDecompress "ICImageDecompress" intptr, int, var, intptr, var ; res = ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut) ; hic : HIC optional -> "intptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "var" ; lpBits : void* -> "intptr" ; lpbiOut : BITMAPINFO* optional -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HANDLE ICImageDecompress(HIC hic, DWORD uiFlags, BITMAPINFO* lpbiIn, void* lpBits, BITMAPINFO* lpbiOut) #uselib "MSVFW32.dll" #cfunc global ICImageDecompress "ICImageDecompress" intptr, int, intptr, intptr, intptr ; res = ICImageDecompress(hic, uiFlags, varptr(lpbiIn), lpBits, varptr(lpbiOut)) ; hic : HIC optional -> "intptr" ; uiFlags : DWORD -> "int" ; lpbiIn : BITMAPINFO* -> "intptr" ; lpBits : void* -> "intptr" ; lpbiOut : BITMAPINFO* optional -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
msvfw32 = windows.NewLazySystemDLL("MSVFW32.dll")
procICImageDecompress = msvfw32.NewProc("ICImageDecompress")
)
// hic (HIC optional), uiFlags (DWORD), lpbiIn (BITMAPINFO*), lpBits (void*), lpbiOut (BITMAPINFO* optional)
r1, _, err := procICImageDecompress.Call(
uintptr(hic),
uintptr(uiFlags),
uintptr(lpbiIn),
uintptr(lpBits),
uintptr(lpbiOut),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HANDLEfunction ICImageDecompress(
hic: THandle; // HIC optional
uiFlags: DWORD; // DWORD
lpbiIn: Pointer; // BITMAPINFO*
lpBits: Pointer; // void*
lpbiOut: Pointer // BITMAPINFO* optional
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICImageDecompress';result := DllCall("MSVFW32\ICImageDecompress"
, "Ptr", hic ; HIC optional
, "UInt", uiFlags ; DWORD
, "Ptr", lpbiIn ; BITMAPINFO*
, "Ptr", lpBits ; void*
, "Ptr", lpbiOut ; BITMAPINFO* optional
, "Ptr") ; return: HANDLE●ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut) = DLL("MSVFW32.dll", "void* ICImageDecompress(void*, dword, void*, void*, void*)")
# 呼び出し: ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut)
# hic : HIC optional -> "void*"
# uiFlags : DWORD -> "dword"
# lpbiIn : BITMAPINFO* -> "void*"
# lpBits : void* -> "void*"
# lpbiOut : BITMAPINFO* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "msvfw32" fn ICImageDecompress(
hic: ?*anyopaque, // HIC optional
uiFlags: u32, // DWORD
lpbiIn: [*c]BITMAPINFO, // BITMAPINFO*
lpBits: ?*anyopaque, // void*
lpbiOut: [*c]BITMAPINFO // BITMAPINFO* optional
) callconv(std.os.windows.WINAPI) ?*anyopaque;proc ICImageDecompress(
hic: pointer, # HIC optional
uiFlags: uint32, # DWORD
lpbiIn: ptr BITMAPINFO, # BITMAPINFO*
lpBits: pointer, # void*
lpbiOut: ptr BITMAPINFO # BITMAPINFO* optional
): pointer {.importc: "ICImageDecompress", stdcall, dynlib: "MSVFW32.dll".}pragma(lib, "msvfw32");
extern(Windows)
void* ICImageDecompress(
void* hic, // HIC optional
uint uiFlags, // DWORD
BITMAPINFO* lpbiIn, // BITMAPINFO*
void* lpBits, // void*
BITMAPINFO* lpbiOut // BITMAPINFO* optional
);ccall((:ICImageDecompress, "MSVFW32.dll"), stdcall, Ptr{Cvoid},
(Ptr{Cvoid}, UInt32, Ptr{BITMAPINFO}, Ptr{Cvoid}, Ptr{BITMAPINFO}),
hic, uiFlags, lpbiIn, lpBits, lpbiOut)
# hic : HIC optional -> Ptr{Cvoid}
# uiFlags : DWORD -> UInt32
# lpbiIn : BITMAPINFO* -> Ptr{BITMAPINFO}
# lpBits : void* -> Ptr{Cvoid}
# lpbiOut : BITMAPINFO* optional -> Ptr{BITMAPINFO}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
void* ICImageDecompress(
void* hic,
uint32_t uiFlags,
void* lpbiIn,
void* lpBits,
void* lpbiOut);
]]
local msvfw32 = ffi.load("msvfw32")
-- msvfw32.ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut)
-- hic : HIC optional
-- uiFlags : DWORD
-- lpbiIn : BITMAPINFO*
-- lpBits : void*
-- lpbiOut : BITMAPINFO* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('MSVFW32.dll');
const ICImageDecompress = lib.func('__stdcall', 'ICImageDecompress', 'void *', ['void *', 'uint32_t', 'void *', 'void *', 'void *']);
// ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut)
// hic : HIC optional -> 'void *'
// uiFlags : DWORD -> 'uint32_t'
// lpbiIn : BITMAPINFO* -> 'void *'
// lpBits : void* -> 'void *'
// lpbiOut : BITMAPINFO* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("MSVFW32.dll", {
ICImageDecompress: { parameters: ["pointer", "u32", "pointer", "pointer", "pointer"], result: "pointer" },
});
// lib.symbols.ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut)
// hic : HIC optional -> "pointer"
// uiFlags : DWORD -> "u32"
// lpbiIn : BITMAPINFO* -> "pointer"
// lpBits : void* -> "pointer"
// lpbiOut : BITMAPINFO* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
void* ICImageDecompress(
void* hic,
uint32_t uiFlags,
void* lpbiIn,
void* lpBits,
void* lpbiOut);
C, "MSVFW32.dll");
// $ffi->ICImageDecompress(hic, uiFlags, lpbiIn, lpBits, lpbiOut);
// hic : HIC optional
// uiFlags : DWORD
// lpbiIn : BITMAPINFO*
// lpBits : void*
// lpbiOut : BITMAPINFO* optional
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Msvfw32 extends StdCallLibrary {
Msvfw32 INSTANCE = Native.load("msvfw32", Msvfw32.class);
Pointer ICImageDecompress(
Pointer hic, // HIC optional
int uiFlags, // DWORD
Pointer lpbiIn, // BITMAPINFO*
Pointer lpBits, // void*
Pointer lpbiOut // BITMAPINFO* optional
);
}@[Link("msvfw32")]
lib LibMSVFW32
fun ICImageDecompress = ICImageDecompress(
hic : Void*, # HIC optional
uiFlags : UInt32, # DWORD
lpbiIn : BITMAPINFO*, # BITMAPINFO*
lpBits : Void*, # void*
lpbiOut : BITMAPINFO* # BITMAPINFO* optional
) : Void*
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef ICImageDecompressNative = Pointer<Void> Function(Pointer<Void>, Uint32, Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef ICImageDecompressDart = Pointer<Void> Function(Pointer<Void>, int, Pointer<Void>, Pointer<Void>, Pointer<Void>);
final ICImageDecompress = DynamicLibrary.open('MSVFW32.dll')
.lookupFunction<ICImageDecompressNative, ICImageDecompressDart>('ICImageDecompress');
// hic : HIC optional -> Pointer<Void>
// uiFlags : DWORD -> Uint32
// lpbiIn : BITMAPINFO* -> Pointer<Void>
// lpBits : void* -> Pointer<Void>
// lpbiOut : BITMAPINFO* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function ICImageDecompress(
hic: THandle; // HIC optional
uiFlags: DWORD; // DWORD
lpbiIn: Pointer; // BITMAPINFO*
lpBits: Pointer; // void*
lpbiOut: Pointer // BITMAPINFO* optional
): THandle; stdcall;
external 'MSVFW32.dll' name 'ICImageDecompress';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "ICImageDecompress"
c_ICImageDecompress :: Ptr () -> Word32 -> Ptr () -> Ptr () -> Ptr () -> IO (Ptr ())
-- hic : HIC optional -> Ptr ()
-- uiFlags : DWORD -> Word32
-- lpbiIn : BITMAPINFO* -> Ptr ()
-- lpBits : void* -> Ptr ()
-- lpbiOut : BITMAPINFO* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let icimagedecompress =
foreign "ICImageDecompress"
((ptr void) @-> uint32_t @-> (ptr void) @-> (ptr void) @-> (ptr void) @-> returning (ptr void))
(* hic : HIC optional -> (ptr void) *)
(* uiFlags : DWORD -> uint32_t *)
(* lpbiIn : BITMAPINFO* -> (ptr void) *)
(* lpBits : void* -> (ptr void) *)
(* lpbiOut : BITMAPINFO* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library msvfw32 (t "MSVFW32.dll"))
(cffi:use-foreign-library msvfw32)
(cffi:defcfun ("ICImageDecompress" icimage-decompress :convention :stdcall) :pointer
(hic :pointer) ; HIC optional
(ui-flags :uint32) ; DWORD
(lpbi-in :pointer) ; BITMAPINFO*
(lp-bits :pointer) ; void*
(lpbi-out :pointer)) ; BITMAPINFO* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $ICImageDecompress = Win32::API::More->new('MSVFW32',
'HANDLE ICImageDecompress(HANDLE hic, DWORD uiFlags, LPVOID lpbiIn, LPVOID lpBits, LPVOID lpbiOut)');
# my $ret = $ICImageDecompress->Call($hic, $uiFlags, $lpbiIn, $lpBits, $lpbiOut);
# hic : HIC optional -> HANDLE
# uiFlags : DWORD -> DWORD
# lpbiIn : BITMAPINFO* -> LPVOID
# lpBits : void* -> LPVOID
# lpbiOut : BITMAPINFO* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型