Win32 API 日本語リファレンス
ホームGraphics.GdiPlus › GdipDrawImageFX

GdipDrawImageFX

関数
効果と変換を適用して画像を描画する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipDrawImageFX(
    GpGraphics* graphics,
    GpImage* image,
    RectF* source,
    Matrix* xForm,
    CGpEffect* effect,
    GpImageAttributes* imageAttributes,
    Unit srcUnit
);

パラメーター

名前方向説明
graphicsGpGraphics*inout描画先のGDI+グラフィックスオブジェクトへのポインタ。
imageGpImage*inout描画する元画像オブジェクトへのポインタ。
sourceRectF*inout描画する画像内の元矩形領域を示すRectF。NULLで全体を対象とする。
xFormMatrix*inout描画時に適用する変換行列へのポインタ。NULL可。
effectCGpEffect*inout画像に適用するエフェクトオブジェクトへのポインタ。NULLでエフェクトなし。
imageAttributesGpImageAttributes*inout色調整など描画属性を指定するImageAttributesへのポインタ。NULL可。
srcUnitUnitinsource矩形の座標単位を示すUnit列挙値。

戻り値の型: 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), varptr(xForm), varptr(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, var, var, 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 -> "var"
; effect : CGpEffect* in/out -> "var"
; 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" var, var, var, var, var, 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 -> "var"
; effect : CGpEffect* in/out -> "var"
; imageAttributes : GpImageAttributes* in/out -> "var"
; srcUnit : Unit -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。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   // Status
function 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)。
const std = @import("std");

extern "gdiplus" fn GdipDrawImageFX(
    graphics: [*c]GpGraphics, // GpGraphics* in/out
    image: [*c]GpImage, // GpImage* in/out
    source: [*c]RectF, // RectF* in/out
    xForm: [*c]isize, // Matrix* in/out
    effect: [*c]isize, // CGpEffect* in/out
    imageAttributes: [*c]GpImageAttributes, // GpImageAttributes* in/out
    srcUnit: i32 // Unit
) callconv(std.os.windows.WINAPI) i32;
proc GdipDrawImageFX(
    graphics: ptr GpGraphics,  # GpGraphics* in/out
    image: ptr GpImage,  # GpImage* in/out
    source: ptr RectF,  # RectF* in/out
    xForm: ptr int,  # Matrix* in/out
    effect: ptr int,  # CGpEffect* in/out
    imageAttributes: ptr GpImageAttributes,  # GpImageAttributes* in/out
    srcUnit: int32  # Unit
): int32 {.importc: "GdipDrawImageFX", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipDrawImageFX(
    GpGraphics* graphics,   // GpGraphics* in/out
    GpImage* image,   // GpImage* in/out
    RectF* source,   // RectF* in/out
    ptrdiff_t* xForm,   // Matrix* in/out
    ptrdiff_t* effect,   // CGpEffect* in/out
    GpImageAttributes* imageAttributes,   // GpImageAttributes* in/out
    int srcUnit   // Unit
);
ccall((:GdipDrawImageFX, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpGraphics}, Ptr{GpImage}, Ptr{RectF}, Ptr{Int}, Ptr{Int}, Ptr{GpImageAttributes}, Int32),
      graphics, image, source, xForm, effect, imageAttributes, srcUnit)
# graphics : GpGraphics* in/out -> Ptr{GpGraphics}
# image : GpImage* in/out -> Ptr{GpImage}
# source : RectF* in/out -> Ptr{RectF}
# xForm : Matrix* in/out -> Ptr{Int}
# effect : CGpEffect* in/out -> Ptr{Int}
# imageAttributes : GpImageAttributes* in/out -> Ptr{GpImageAttributes}
# srcUnit : Unit -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipDrawImageFX(
    void* graphics,
    void* image,
    void* source,
    intptr_t* xForm,
    intptr_t* effect,
    void* imageAttributes,
    int32_t srcUnit);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipDrawImageFX(graphics, image, source, xForm, effect, imageAttributes, srcUnit)
-- 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
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipDrawImageFX = lib.func('__stdcall', 'GdipDrawImageFX', 'int32_t', ['void *', 'void *', 'void *', 'intptr_t *', 'intptr_t *', 'void *', 'int32_t']);
// 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 -> 'intptr_t *'
// effect : CGpEffect* in/out -> 'intptr_t *'
// imageAttributes : GpImageAttributes* in/out -> 'void *'
// srcUnit : Unit -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipDrawImageFX: { parameters: ["pointer", "pointer", "pointer", "pointer", "pointer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.GdipDrawImageFX(graphics, image, source, xForm, effect, imageAttributes, srcUnit)
// graphics : GpGraphics* in/out -> "pointer"
// image : GpImage* in/out -> "pointer"
// source : RectF* in/out -> "pointer"
// xForm : Matrix* in/out -> "pointer"
// effect : CGpEffect* in/out -> "pointer"
// imageAttributes : GpImageAttributes* in/out -> "pointer"
// srcUnit : Unit -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipDrawImageFX(
    void* graphics,
    void* image,
    void* source,
    intptr_t* xForm,
    intptr_t* effect,
    void* imageAttributes,
    int32_t srcUnit);
C, "gdiplus.dll");
// $ffi->GdipDrawImageFX(graphics, image, source, xForm, effect, imageAttributes, srcUnit);
// 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
// 構造体/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 Gdiplus extends StdCallLibrary {
    Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
    int GdipDrawImageFX(
        Pointer graphics,   // GpGraphics* in/out
        Pointer image,   // GpImage* in/out
        Pointer source,   // RectF* in/out
        LongByReference xForm,   // Matrix* in/out
        LongByReference effect,   // CGpEffect* in/out
        Pointer imageAttributes,   // GpImageAttributes* in/out
        int srcUnit   // Unit
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipDrawImageFX = GdipDrawImageFX(
    graphics : GpGraphics*,   # GpGraphics* in/out
    image : GpImage*,   # GpImage* in/out
    source : RectF*,   # RectF* in/out
    xForm : LibC::SSizeT*,   # Matrix* in/out
    effect : LibC::SSizeT*,   # CGpEffect* in/out
    imageAttributes : GpImageAttributes*,   # GpImageAttributes* in/out
    srcUnit : Int32   # Unit
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GdipDrawImageFXNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<IntPtr>, Pointer<Void>, Int32);
typedef GdipDrawImageFXDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<IntPtr>, Pointer<Void>, int);
final GdipDrawImageFX = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipDrawImageFXNative, GdipDrawImageFXDart>('GdipDrawImageFX');
// graphics : GpGraphics* in/out -> Pointer<Void>
// image : GpImage* in/out -> Pointer<Void>
// source : RectF* in/out -> Pointer<Void>
// xForm : Matrix* in/out -> Pointer<IntPtr>
// effect : CGpEffect* in/out -> Pointer<IntPtr>
// imageAttributes : GpImageAttributes* in/out -> Pointer<Void>
// srcUnit : Unit -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function 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';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipDrawImageFX"
  c_GdipDrawImageFX :: Ptr () -> Ptr () -> Ptr () -> Ptr CIntPtr -> Ptr CIntPtr -> Ptr () -> Int32 -> IO Int32
-- graphics : GpGraphics* in/out -> Ptr ()
-- image : GpImage* in/out -> Ptr ()
-- source : RectF* in/out -> Ptr ()
-- xForm : Matrix* in/out -> Ptr CIntPtr
-- effect : CGpEffect* in/out -> Ptr CIntPtr
-- imageAttributes : GpImageAttributes* in/out -> Ptr ()
-- srcUnit : Unit -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipdrawimagefx =
  foreign "GdipDrawImageFX"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> (ptr intptr_t) @-> (ptr intptr_t) @-> (ptr void) @-> int32_t @-> returning int32_t)
(* graphics : GpGraphics* in/out -> (ptr void) *)
(* image : GpImage* in/out -> (ptr void) *)
(* source : RectF* in/out -> (ptr void) *)
(* xForm : Matrix* in/out -> (ptr intptr_t) *)
(* effect : CGpEffect* in/out -> (ptr intptr_t) *)
(* imageAttributes : GpImageAttributes* in/out -> (ptr void) *)
(* srcUnit : Unit -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipDrawImageFX" gdip-draw-image-fx :convention :stdcall) :int32
  (graphics :pointer)   ; GpGraphics* in/out
  (image :pointer)   ; GpImage* in/out
  (source :pointer)   ; RectF* in/out
  (x-form :pointer)   ; Matrix* in/out
  (effect :pointer)   ; CGpEffect* in/out
  (image-attributes :pointer)   ; GpImageAttributes* in/out
  (src-unit :int32))   ; Unit
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipDrawImageFX = Win32::API::More->new('gdiplus',
    'int GdipDrawImageFX(LPVOID graphics, LPVOID image, LPVOID source, LPVOID xForm, LPVOID effect, LPVOID imageAttributes, int srcUnit)');
# my $ret = $GdipDrawImageFX->Call($graphics, $image, $source, $xForm, $effect, $imageAttributes, $srcUnit);
# graphics : GpGraphics* in/out -> LPVOID
# image : GpImage* in/out -> LPVOID
# source : RectF* in/out -> LPVOID
# xForm : Matrix* in/out -> LPVOID
# effect : CGpEffect* in/out -> LPVOID
# imageAttributes : GpImageAttributes* in/out -> LPVOID
# srcUnit : Unit -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型