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

GdipCloneBitmapAreaI

関数
ビットマップの指定領域を整数座標で複製して作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCloneBitmapAreaI(
    INT x,
    INT y,
    INT width,
    INT height,
    INT format,
    GpBitmap* srcBitmap,
    GpBitmap** dstBitmap
);

パラメーター

名前方向
xINTin
yINTin
widthINTin
heightINTin
formatINTin
srcBitmapGpBitmap*inout
dstBitmapGpBitmap**inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipCloneBitmapAreaI(
    INT x,
    INT y,
    INT width,
    INT height,
    INT format,
    GpBitmap* srcBitmap,
    GpBitmap** dstBitmap
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCloneBitmapAreaI(
    int x,   // INT
    int y,   // INT
    int width,   // INT
    int height,   // INT
    int format,   // INT
    IntPtr srcBitmap,   // GpBitmap* in/out
    IntPtr dstBitmap   // GpBitmap** in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCloneBitmapAreaI(
    x As Integer,   ' INT
    y As Integer,   ' INT
    width As Integer,   ' INT
    height As Integer,   ' INT
    format As Integer,   ' INT
    srcBitmap As IntPtr,   ' GpBitmap* in/out
    dstBitmap As IntPtr   ' GpBitmap** in/out
) As Integer
End Function
' x : INT
' y : INT
' width : INT
' height : INT
' format : INT
' srcBitmap : GpBitmap* in/out
' dstBitmap : GpBitmap** in/out
Declare PtrSafe Function GdipCloneBitmapAreaI Lib "gdiplus" ( _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal width As Long, _
    ByVal height As Long, _
    ByVal format As Long, _
    ByVal srcBitmap As LongPtr, _
    ByVal dstBitmap As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipCloneBitmapAreaI = ctypes.windll.gdiplus.GdipCloneBitmapAreaI
GdipCloneBitmapAreaI.restype = ctypes.c_int
GdipCloneBitmapAreaI.argtypes = [
    ctypes.c_int,  # x : INT
    ctypes.c_int,  # y : INT
    ctypes.c_int,  # width : INT
    ctypes.c_int,  # height : INT
    ctypes.c_int,  # format : INT
    ctypes.c_void_p,  # srcBitmap : GpBitmap* in/out
    ctypes.c_void_p,  # dstBitmap : GpBitmap** in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipCloneBitmapAreaI = Fiddle::Function.new(
  lib['GdipCloneBitmapAreaI'],
  [
    Fiddle::TYPE_INT,  # x : INT
    Fiddle::TYPE_INT,  # y : INT
    Fiddle::TYPE_INT,  # width : INT
    Fiddle::TYPE_INT,  # height : INT
    Fiddle::TYPE_INT,  # format : INT
    Fiddle::TYPE_VOIDP,  # srcBitmap : GpBitmap* in/out
    Fiddle::TYPE_VOIDP,  # dstBitmap : GpBitmap** in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipCloneBitmapAreaI(
        x: i32,  // INT
        y: i32,  // INT
        width: i32,  // INT
        height: i32,  // INT
        format: i32,  // INT
        srcBitmap: *mut GpBitmap,  // GpBitmap* in/out
        dstBitmap: *mut *mut GpBitmap  // GpBitmap** in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipCloneBitmapAreaI(int x, int y, int width, int height, int format, IntPtr srcBitmap, IntPtr dstBitmap);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipCloneBitmapAreaI' -Namespace Win32 -PassThru
# $api::GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
#uselib "gdiplus.dll"
#func global GdipCloneBitmapAreaI "GdipCloneBitmapAreaI" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipCloneBitmapAreaI x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap)   ; 戻り値は stat
; x : INT -> "sptr"
; y : INT -> "sptr"
; width : INT -> "sptr"
; height : INT -> "sptr"
; format : INT -> "sptr"
; srcBitmap : GpBitmap* in/out -> "sptr"
; dstBitmap : GpBitmap** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipCloneBitmapAreaI "GdipCloneBitmapAreaI" int, int, int, int, int, var, var
; res = GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; format : INT -> "int"
; srcBitmap : GpBitmap* in/out -> "var"
; dstBitmap : GpBitmap** in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipCloneBitmapAreaI(INT x, INT y, INT width, INT height, INT format, GpBitmap* srcBitmap, GpBitmap** dstBitmap)
#uselib "gdiplus.dll"
#cfunc global GdipCloneBitmapAreaI "GdipCloneBitmapAreaI" int, int, int, int, int, var, var
; res = GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
; x : INT -> "int"
; y : INT -> "int"
; width : INT -> "int"
; height : INT -> "int"
; format : INT -> "int"
; srcBitmap : GpBitmap* in/out -> "var"
; dstBitmap : GpBitmap** in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCloneBitmapAreaI = gdiplus.NewProc("GdipCloneBitmapAreaI")
)

// x (INT), y (INT), width (INT), height (INT), format (INT), srcBitmap (GpBitmap* in/out), dstBitmap (GpBitmap** in/out)
r1, _, err := procGdipCloneBitmapAreaI.Call(
	uintptr(x),
	uintptr(y),
	uintptr(width),
	uintptr(height),
	uintptr(format),
	uintptr(srcBitmap),
	uintptr(dstBitmap),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipCloneBitmapAreaI(
  x: Integer;   // INT
  y: Integer;   // INT
  width: Integer;   // INT
  height: Integer;   // INT
  format: Integer;   // INT
  srcBitmap: Pointer;   // GpBitmap* in/out
  dstBitmap: Pointer   // GpBitmap** in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipCloneBitmapAreaI';
result := DllCall("gdiplus\GdipCloneBitmapAreaI"
    , "Int", x   ; INT
    , "Int", y   ; INT
    , "Int", width   ; INT
    , "Int", height   ; INT
    , "Int", format   ; INT
    , "Ptr", srcBitmap   ; GpBitmap* in/out
    , "Ptr", dstBitmap   ; GpBitmap** in/out
    , "Int")   ; return: Status
●GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap) = DLL("gdiplus.dll", "int GdipCloneBitmapAreaI(int, int, int, int, int, void*, void*)")
# 呼び出し: GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
# x : INT -> "int"
# y : INT -> "int"
# width : INT -> "int"
# height : INT -> "int"
# format : INT -> "int"
# srcBitmap : GpBitmap* in/out -> "void*"
# dstBitmap : GpBitmap** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。