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