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

GdipDrawImagePointsRect

関数
画像の元矩形を3点指定領域に属性付きで描画する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipDrawImagePointsRect(
    GpGraphics* graphics,
    GpImage* image,
    const PointF* points,
    INT count,
    FLOAT srcx,
    FLOAT srcy,
    FLOAT srcwidth,
    FLOAT srcheight,
    Unit srcUnit,
    const GpImageAttributes* imageAttributes,
    INT_PTR callback,
    void* callbackData
);

パラメーター

名前方向
graphicsGpGraphics*inout
imageGpImage*inout
pointsPointF*in
countINTin
srcxFLOATin
srcyFLOATin
srcwidthFLOATin
srcheightFLOATin
srcUnitUnitin
imageAttributesGpImageAttributes*in
callbackINT_PTRin
callbackDatavoid*inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipDrawImagePointsRect(
    GpGraphics* graphics,
    GpImage* image,
    const PointF* points,
    INT count,
    FLOAT srcx,
    FLOAT srcy,
    FLOAT srcwidth,
    FLOAT srcheight,
    Unit srcUnit,
    const GpImageAttributes* imageAttributes,
    INT_PTR callback,
    void* callbackData
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipDrawImagePointsRect(
    IntPtr graphics,   // GpGraphics* in/out
    IntPtr image,   // GpImage* in/out
    IntPtr points,   // PointF*
    int count,   // INT
    float srcx,   // FLOAT
    float srcy,   // FLOAT
    float srcwidth,   // FLOAT
    float srcheight,   // FLOAT
    int srcUnit,   // Unit
    IntPtr imageAttributes,   // GpImageAttributes*
    IntPtr callback,   // INT_PTR
    IntPtr callbackData   // void* in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipDrawImagePointsRect(
    graphics As IntPtr,   ' GpGraphics* in/out
    image As IntPtr,   ' GpImage* in/out
    points As IntPtr,   ' PointF*
    count As Integer,   ' INT
    srcx As Single,   ' FLOAT
    srcy As Single,   ' FLOAT
    srcwidth As Single,   ' FLOAT
    srcheight As Single,   ' FLOAT
    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
' points : PointF*
' count : INT
' srcx : FLOAT
' srcy : FLOAT
' srcwidth : FLOAT
' srcheight : FLOAT
' srcUnit : Unit
' imageAttributes : GpImageAttributes*
' callback : INT_PTR
' callbackData : void* in/out
Declare PtrSafe Function GdipDrawImagePointsRect Lib "gdiplus" ( _
    ByVal graphics As LongPtr, _
    ByVal image As LongPtr, _
    ByVal points As LongPtr, _
    ByVal count As Long, _
    ByVal srcx As Single, _
    ByVal srcy As Single, _
    ByVal srcwidth As Single, _
    ByVal srcheight As Single, _
    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

GdipDrawImagePointsRect = ctypes.windll.gdiplus.GdipDrawImagePointsRect
GdipDrawImagePointsRect.restype = ctypes.c_int
GdipDrawImagePointsRect.argtypes = [
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_void_p,  # image : GpImage* in/out
    ctypes.c_void_p,  # points : PointF*
    ctypes.c_int,  # count : INT
    ctypes.c_float,  # srcx : FLOAT
    ctypes.c_float,  # srcy : FLOAT
    ctypes.c_float,  # srcwidth : FLOAT
    ctypes.c_float,  # srcheight : FLOAT
    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')
GdipDrawImagePointsRect = Fiddle::Function.new(
  lib['GdipDrawImagePointsRect'],
  [
    Fiddle::TYPE_VOIDP,  # graphics : GpGraphics* in/out
    Fiddle::TYPE_VOIDP,  # image : GpImage* in/out
    Fiddle::TYPE_VOIDP,  # points : PointF*
    Fiddle::TYPE_INT,  # count : INT
    Fiddle::TYPE_FLOAT,  # srcx : FLOAT
    Fiddle::TYPE_FLOAT,  # srcy : FLOAT
    Fiddle::TYPE_FLOAT,  # srcwidth : FLOAT
    Fiddle::TYPE_FLOAT,  # srcheight : FLOAT
    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 GdipDrawImagePointsRect(
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        image: *mut GpImage,  // GpImage* in/out
        points: *const PointF,  // PointF*
        count: i32,  // INT
        srcx: f32,  // FLOAT
        srcy: f32,  // FLOAT
        srcwidth: f32,  // FLOAT
        srcheight: f32,  // FLOAT
        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 GdipDrawImagePointsRect(IntPtr graphics, IntPtr image, IntPtr points, int count, float srcx, float srcy, float srcwidth, float srcheight, int srcUnit, IntPtr imageAttributes, IntPtr callback, IntPtr callbackData);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipDrawImagePointsRect' -Namespace Win32 -PassThru
# $api::GdipDrawImagePointsRect(graphics, image, points, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
#uselib "gdiplus.dll"
#func global GdipDrawImagePointsRect "GdipDrawImagePointsRect" sptr, sptr, sptr, sptr, float, float, float, float, sptr, sptr, sptr, sptr
; GdipDrawImagePointsRect varptr(graphics), varptr(image), varptr(points), count, srcx, srcy, srcwidth, srcheight, srcUnit, varptr(imageAttributes), callback, callbackData   ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; image : GpImage* in/out -> "sptr"
; points : PointF* -> "sptr"
; count : INT -> "sptr"
; srcx : FLOAT -> "float"
; srcy : FLOAT -> "float"
; srcwidth : FLOAT -> "float"
; srcheight : FLOAT -> "float"
; srcUnit : Unit -> "sptr"
; imageAttributes : GpImageAttributes* -> "sptr"
; callback : INT_PTR -> "sptr"
; callbackData : void* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipDrawImagePointsRect "GdipDrawImagePointsRect" var, var, var, int, float, float, float, float, int, var, sptr, sptr
; res = GdipDrawImagePointsRect(graphics, image, points, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
; graphics : GpGraphics* in/out -> "var"
; image : GpImage* in/out -> "var"
; points : PointF* -> "var"
; count : INT -> "int"
; srcx : FLOAT -> "float"
; srcy : FLOAT -> "float"
; srcwidth : FLOAT -> "float"
; srcheight : FLOAT -> "float"
; srcUnit : Unit -> "int"
; imageAttributes : GpImageAttributes* -> "var"
; callback : INT_PTR -> "sptr"
; callbackData : void* in/out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipDrawImagePointsRect(GpGraphics* graphics, GpImage* image, PointF* points, INT count, FLOAT srcx, FLOAT srcy, FLOAT srcwidth, FLOAT srcheight, Unit srcUnit, GpImageAttributes* imageAttributes, INT_PTR callback, void* callbackData)
#uselib "gdiplus.dll"
#cfunc global GdipDrawImagePointsRect "GdipDrawImagePointsRect" var, var, var, int, float, float, float, float, int, var, intptr, intptr
; res = GdipDrawImagePointsRect(graphics, image, points, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
; graphics : GpGraphics* in/out -> "var"
; image : GpImage* in/out -> "var"
; points : PointF* -> "var"
; count : INT -> "int"
; srcx : FLOAT -> "float"
; srcy : FLOAT -> "float"
; srcwidth : FLOAT -> "float"
; srcheight : FLOAT -> "float"
; srcUnit : Unit -> "int"
; imageAttributes : GpImageAttributes* -> "var"
; callback : INT_PTR -> "intptr"
; callbackData : void* in/out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipDrawImagePointsRect = gdiplus.NewProc("GdipDrawImagePointsRect")
)

// graphics (GpGraphics* in/out), image (GpImage* in/out), points (PointF*), count (INT), srcx (FLOAT), srcy (FLOAT), srcwidth (FLOAT), srcheight (FLOAT), srcUnit (Unit), imageAttributes (GpImageAttributes*), callback (INT_PTR), callbackData (void* in/out)
r1, _, err := procGdipDrawImagePointsRect.Call(
	uintptr(graphics),
	uintptr(image),
	uintptr(points),
	uintptr(count),
	uintptr(math.Float32bits(srcx)),
	uintptr(math.Float32bits(srcy)),
	uintptr(math.Float32bits(srcwidth)),
	uintptr(math.Float32bits(srcheight)),
	uintptr(srcUnit),
	uintptr(imageAttributes),
	uintptr(callback),
	uintptr(callbackData),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。
function GdipDrawImagePointsRect(
  graphics: Pointer;   // GpGraphics* in/out
  image: Pointer;   // GpImage* in/out
  points: Pointer;   // PointF*
  count: Integer;   // INT
  srcx: Single;   // FLOAT
  srcy: Single;   // FLOAT
  srcwidth: Single;   // FLOAT
  srcheight: Single;   // FLOAT
  srcUnit: Integer;   // Unit
  imageAttributes: Pointer;   // GpImageAttributes*
  callback: NativeInt;   // INT_PTR
  callbackData: Pointer   // void* in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipDrawImagePointsRect';
result := DllCall("gdiplus\GdipDrawImagePointsRect"
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Ptr", image   ; GpImage* in/out
    , "Ptr", points   ; PointF*
    , "Int", count   ; INT
    , "Float", srcx   ; FLOAT
    , "Float", srcy   ; FLOAT
    , "Float", srcwidth   ; FLOAT
    , "Float", srcheight   ; FLOAT
    , "Int", srcUnit   ; Unit
    , "Ptr", imageAttributes   ; GpImageAttributes*
    , "Ptr", callback   ; INT_PTR
    , "Ptr", callbackData   ; void* in/out
    , "Int")   ; return: Status
●GdipDrawImagePointsRect(graphics, image, points, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData) = DLL("gdiplus.dll", "int GdipDrawImagePointsRect(void*, void*, void*, int, float, float, float, float, int, void*, int, void*)")
# 呼び出し: GdipDrawImagePointsRect(graphics, image, points, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, callbackData)
# graphics : GpGraphics* in/out -> "void*"
# image : GpImage* in/out -> "void*"
# points : PointF* -> "void*"
# count : INT -> "int"
# srcx : FLOAT -> "float"
# srcy : FLOAT -> "float"
# srcwidth : FLOAT -> "float"
# srcheight : FLOAT -> "float"
# srcUnit : Unit -> "int"
# imageAttributes : GpImageAttributes* -> "void*"
# callback : INT_PTR -> "int"
# callbackData : void* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。