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

GdipDrawImageRectRectI

関数
画像の元矩形を整数の変換先矩形に属性付きで描画する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipDrawImageRectRectI(
    GpGraphics* graphics,
    GpImage* image,
    INT dstx,
    INT dsty,
    INT dstwidth,
    INT dstheight,
    INT srcx,
    INT srcy,
    INT srcwidth,
    INT srcheight,
    Unit srcUnit,
    const GpImageAttributes* imageAttributes,
    INT_PTR callback,
    void* callbackData
);

パラメーター

名前方向
graphicsGpGraphics*inout
imageGpImage*inout
dstxINTin
dstyINTin
dstwidthINTin
dstheightINTin
srcxINTin
srcyINTin
srcwidthINTin
srcheightINTin
srcUnitUnitin
imageAttributesGpImageAttributes*in
callbackINT_PTRin
callbackDatavoid*inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipDrawImageRectRectI(
    GpGraphics* graphics,
    GpImage* image,
    INT dstx,
    INT dsty,
    INT dstwidth,
    INT dstheight,
    INT srcx,
    INT srcy,
    INT srcwidth,
    INT srcheight,
    Unit srcUnit,
    const GpImageAttributes* imageAttributes,
    INT_PTR callback,
    void* callbackData
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipDrawImageRectRectI(
    IntPtr graphics,   // GpGraphics* in/out
    IntPtr image,   // GpImage* in/out
    int dstx,   // INT
    int dsty,   // INT
    int dstwidth,   // INT
    int dstheight,   // INT
    int srcx,   // INT
    int srcy,   // INT
    int srcwidth,   // INT
    int srcheight,   // INT
    int srcUnit,   // Unit
    IntPtr imageAttributes,   // GpImageAttributes*
    IntPtr callback,   // INT_PTR
    IntPtr callbackData   // void* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipDrawImageRectRectI(
    graphics As IntPtr,   ' GpGraphics* in/out
    image As IntPtr,   ' GpImage* in/out
    dstx As Integer,   ' INT
    dsty As Integer,   ' INT
    dstwidth As Integer,   ' INT
    dstheight As Integer,   ' INT
    srcx As Integer,   ' INT
    srcy As Integer,   ' INT
    srcwidth As Integer,   ' INT
    srcheight As Integer,   ' INT
    srcUnit As Integer,   ' Unit
    imageAttributes As IntPtr,   ' GpImageAttributes*
    callback As IntPtr,   ' INT_PTR
    callbackData As IntPtr   ' void* in/out
) As Integer
End Function
' graphics : GpGraphics* in/out
' image : GpImage* in/out
' dstx : INT
' dsty : INT
' dstwidth : INT
' dstheight : INT
' srcx : INT
' srcy : INT
' srcwidth : INT
' srcheight : INT
' srcUnit : Unit
' imageAttributes : GpImageAttributes*
' callback : INT_PTR
' callbackData : void* in/out
Declare PtrSafe Function GdipDrawImageRectRectI Lib "gdiplus" ( _
    ByVal graphics As LongPtr, _
    ByVal image As LongPtr, _
    ByVal dstx As Long, _
    ByVal dsty As Long, _
    ByVal dstwidth As Long, _
    ByVal dstheight As Long, _
    ByVal srcx As Long, _
    ByVal srcy As Long, _
    ByVal srcwidth As Long, _
    ByVal srcheight As Long, _
    ByVal srcUnit As Long, _
    ByVal imageAttributes As LongPtr, _
    ByVal callback As LongPtr, _
    ByVal callbackData As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipDrawImageRectRectI = ctypes.windll.gdiplus.GdipDrawImageRectRectI
GdipDrawImageRectRectI.restype = ctypes.c_int
GdipDrawImageRectRectI.argtypes = [
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_void_p,  # image : GpImage* in/out
    ctypes.c_int,  # dstx : INT
    ctypes.c_int,  # dsty : INT
    ctypes.c_int,  # dstwidth : INT
    ctypes.c_int,  # dstheight : INT
    ctypes.c_int,  # srcx : INT
    ctypes.c_int,  # srcy : INT
    ctypes.c_int,  # srcwidth : INT
    ctypes.c_int,  # srcheight : INT
    ctypes.c_int,  # srcUnit : Unit
    ctypes.c_void_p,  # imageAttributes : GpImageAttributes*
    ctypes.c_ssize_t,  # callback : INT_PTR
    ctypes.POINTER(None),  # callbackData : void* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipDrawImageRectRectI = Fiddle::Function.new(
  lib['GdipDrawImageRectRectI'],
  [
    Fiddle::TYPE_VOIDP,  # graphics : GpGraphics* in/out
    Fiddle::TYPE_VOIDP,  # image : GpImage* in/out
    Fiddle::TYPE_INT,  # dstx : INT
    Fiddle::TYPE_INT,  # dsty : INT
    Fiddle::TYPE_INT,  # dstwidth : INT
    Fiddle::TYPE_INT,  # dstheight : INT
    Fiddle::TYPE_INT,  # srcx : INT
    Fiddle::TYPE_INT,  # srcy : INT
    Fiddle::TYPE_INT,  # srcwidth : INT
    Fiddle::TYPE_INT,  # srcheight : INT
    Fiddle::TYPE_INT,  # srcUnit : Unit
    Fiddle::TYPE_VOIDP,  # imageAttributes : GpImageAttributes*
    Fiddle::TYPE_INTPTR_T,  # callback : INT_PTR
    Fiddle::TYPE_VOIDP,  # callbackData : void* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipDrawImageRectRectI(
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        image: *mut GpImage,  // GpImage* in/out
        dstx: i32,  // INT
        dsty: i32,  // INT
        dstwidth: i32,  // INT
        dstheight: i32,  // INT
        srcx: i32,  // INT
        srcy: i32,  // INT
        srcwidth: i32,  // INT
        srcheight: i32,  // INT
        srcUnit: i32,  // Unit
        imageAttributes: *const GpImageAttributes,  // GpImageAttributes*
        callback: isize,  // INT_PTR
        callbackData: *mut ()  // void* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipDrawImageRectRectI(IntPtr graphics, IntPtr image, int dstx, int dsty, int dstwidth, int dstheight, int srcx, int srcy, int srcwidth, int srcheight, int srcUnit, IntPtr imageAttributes, IntPtr callback, IntPtr callbackData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipDrawImageRectRectI' -Namespace Win32 -PassThru
# $api::GdipDrawImageRectRectI(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
#uselib "gdiplus.dll"
#func global GdipDrawImageRectRectI "GdipDrawImageRectRectI" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipDrawImageRectRectI varptr(graphics), varptr(image), dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, varptr(imageAttributes), callback, callbackData   ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; image : GpImage* in/out -> "sptr"
; dstx : INT -> "sptr"
; dsty : INT -> "sptr"
; dstwidth : INT -> "sptr"
; dstheight : INT -> "sptr"
; srcx : INT -> "sptr"
; srcy : INT -> "sptr"
; srcwidth : INT -> "sptr"
; srcheight : INT -> "sptr"
; srcUnit : Unit -> "sptr"
; imageAttributes : GpImageAttributes* -> "sptr"
; callback : INT_PTR -> "sptr"
; callbackData : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipDrawImageRectRectI "GdipDrawImageRectRectI" var, var, int, int, int, int, int, int, int, int, int, var, sptr, sptr
; res = GdipDrawImageRectRectI(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
; graphics : GpGraphics* in/out -> "var"
; image : GpImage* in/out -> "var"
; dstx : INT -> "int"
; dsty : INT -> "int"
; dstwidth : INT -> "int"
; dstheight : INT -> "int"
; srcx : INT -> "int"
; srcy : INT -> "int"
; srcwidth : INT -> "int"
; srcheight : INT -> "int"
; srcUnit : Unit -> "int"
; imageAttributes : GpImageAttributes* -> "var"
; callback : INT_PTR -> "sptr"
; callbackData : void* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipDrawImageRectRectI(GpGraphics* graphics, GpImage* image, INT dstx, INT dsty, INT dstwidth, INT dstheight, INT srcx, INT srcy, INT srcwidth, INT srcheight, Unit srcUnit, GpImageAttributes* imageAttributes, INT_PTR callback, void* callbackData)
#uselib "gdiplus.dll"
#cfunc global GdipDrawImageRectRectI "GdipDrawImageRectRectI" var, var, int, int, int, int, int, int, int, int, int, var, intptr, intptr
; res = GdipDrawImageRectRectI(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
; graphics : GpGraphics* in/out -> "var"
; image : GpImage* in/out -> "var"
; dstx : INT -> "int"
; dsty : INT -> "int"
; dstwidth : INT -> "int"
; dstheight : INT -> "int"
; srcx : INT -> "int"
; srcy : INT -> "int"
; srcwidth : INT -> "int"
; srcheight : INT -> "int"
; srcUnit : Unit -> "int"
; imageAttributes : GpImageAttributes* -> "var"
; callback : INT_PTR -> "intptr"
; callbackData : void* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipDrawImageRectRectI = gdiplus.NewProc("GdipDrawImageRectRectI")
)

// graphics (GpGraphics* in/out), image (GpImage* in/out), dstx (INT), dsty (INT), dstwidth (INT), dstheight (INT), srcx (INT), srcy (INT), srcwidth (INT), srcheight (INT), srcUnit (Unit), imageAttributes (GpImageAttributes*), callback (INT_PTR), callbackData (void* in/out)
r1, _, err := procGdipDrawImageRectRectI.Call(
	uintptr(graphics),
	uintptr(image),
	uintptr(dstx),
	uintptr(dsty),
	uintptr(dstwidth),
	uintptr(dstheight),
	uintptr(srcx),
	uintptr(srcy),
	uintptr(srcwidth),
	uintptr(srcheight),
	uintptr(srcUnit),
	uintptr(imageAttributes),
	uintptr(callback),
	uintptr(callbackData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipDrawImageRectRectI(
  graphics: Pointer;   // GpGraphics* in/out
  image: Pointer;   // GpImage* in/out
  dstx: Integer;   // INT
  dsty: Integer;   // INT
  dstwidth: Integer;   // INT
  dstheight: Integer;   // INT
  srcx: Integer;   // INT
  srcy: Integer;   // INT
  srcwidth: Integer;   // INT
  srcheight: Integer;   // INT
  srcUnit: Integer;   // Unit
  imageAttributes: Pointer;   // GpImageAttributes*
  callback: NativeInt;   // INT_PTR
  callbackData: Pointer   // void* in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipDrawImageRectRectI';
result := DllCall("gdiplus\GdipDrawImageRectRectI"
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Ptr", image   ; GpImage* in/out
    , "Int", dstx   ; INT
    , "Int", dsty   ; INT
    , "Int", dstwidth   ; INT
    , "Int", dstheight   ; INT
    , "Int", srcx   ; INT
    , "Int", srcy   ; INT
    , "Int", srcwidth   ; INT
    , "Int", srcheight   ; INT
    , "Int", srcUnit   ; Unit
    , "Ptr", imageAttributes   ; GpImageAttributes*
    , "Ptr", callback   ; INT_PTR
    , "Ptr", callbackData   ; void* in/out
    , "Int")   ; return: Status
●GdipDrawImageRectRectI(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData) = DLL("gdiplus.dll", "int GdipDrawImageRectRectI(void*, void*, int, int, int, int, int, int, int, int, int, void*, int, void*)")
# 呼び出し: GdipDrawImageRectRectI(graphics, image, dstx, dsty, dstwidth, dstheight, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
# graphics : GpGraphics* in/out -> "void*"
# image : GpImage* in/out -> "void*"
# dstx : INT -> "int"
# dsty : INT -> "int"
# dstwidth : INT -> "int"
# dstheight : INT -> "int"
# srcx : INT -> "int"
# srcy : INT -> "int"
# srcwidth : INT -> "int"
# srcheight : INT -> "int"
# srcUnit : Unit -> "int"
# imageAttributes : GpImageAttributes* -> "void*"
# callback : INT_PTR -> "int"
# callbackData : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。