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