ホーム › Graphics.GdiPlus › GdipLoadImageFromStream
GdipLoadImageFromStream
関数ストリームから画像を読み込んでイメージオブジェクトを作成する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipLoadImageFromStream(
IStream* stream,
GpImage** image
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| stream | IStream* | in |
| image | GpImage** | inout |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipLoadImageFromStream(
IStream* stream,
GpImage** image
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipLoadImageFromStream(
IntPtr stream, // IStream*
IntPtr image // GpImage** in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipLoadImageFromStream(
stream As IntPtr, ' IStream*
image As IntPtr ' GpImage** in/out
) As Integer
End Function' stream : IStream*
' image : GpImage** in/out
Declare PtrSafe Function GdipLoadImageFromStream Lib "gdiplus" ( _
ByVal stream As LongPtr, _
ByVal image As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipLoadImageFromStream = ctypes.windll.gdiplus.GdipLoadImageFromStream
GdipLoadImageFromStream.restype = ctypes.c_int
GdipLoadImageFromStream.argtypes = [
ctypes.c_void_p, # stream : IStream*
ctypes.c_void_p, # image : GpImage** in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipLoadImageFromStream = Fiddle::Function.new(
lib['GdipLoadImageFromStream'],
[
Fiddle::TYPE_VOIDP, # stream : IStream*
Fiddle::TYPE_VOIDP, # image : GpImage** in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipLoadImageFromStream(
stream: *mut core::ffi::c_void, // IStream*
image: *mut *mut GpImage // GpImage** in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipLoadImageFromStream(IntPtr stream, IntPtr image);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipLoadImageFromStream' -Namespace Win32 -PassThru
# $api::GdipLoadImageFromStream(stream, image)#uselib "gdiplus.dll"
#func global GdipLoadImageFromStream "GdipLoadImageFromStream" sptr, sptr
; GdipLoadImageFromStream stream, varptr(image) ; 戻り値は stat
; stream : IStream* -> "sptr"
; image : GpImage** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipLoadImageFromStream "GdipLoadImageFromStream" sptr, var ; res = GdipLoadImageFromStream(stream, image) ; stream : IStream* -> "sptr" ; image : GpImage** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipLoadImageFromStream "GdipLoadImageFromStream" sptr, sptr ; res = GdipLoadImageFromStream(stream, varptr(image)) ; stream : IStream* -> "sptr" ; image : GpImage** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipLoadImageFromStream(IStream* stream, GpImage** image) #uselib "gdiplus.dll" #cfunc global GdipLoadImageFromStream "GdipLoadImageFromStream" intptr, var ; res = GdipLoadImageFromStream(stream, image) ; stream : IStream* -> "intptr" ; image : GpImage** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipLoadImageFromStream(IStream* stream, GpImage** image) #uselib "gdiplus.dll" #cfunc global GdipLoadImageFromStream "GdipLoadImageFromStream" intptr, intptr ; res = GdipLoadImageFromStream(stream, varptr(image)) ; stream : IStream* -> "intptr" ; image : GpImage** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipLoadImageFromStream = gdiplus.NewProc("GdipLoadImageFromStream")
)
// stream (IStream*), image (GpImage** in/out)
r1, _, err := procGdipLoadImageFromStream.Call(
uintptr(stream),
uintptr(image),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipLoadImageFromStream(
stream: Pointer; // IStream*
image: Pointer // GpImage** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipLoadImageFromStream';result := DllCall("gdiplus\GdipLoadImageFromStream"
, "Ptr", stream ; IStream*
, "Ptr", image ; GpImage** in/out
, "Int") ; return: Status●GdipLoadImageFromStream(stream, image) = DLL("gdiplus.dll", "int GdipLoadImageFromStream(void*, void*)")
# 呼び出し: GdipLoadImageFromStream(stream, image)
# stream : IStream* -> "void*"
# image : GpImage** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。