ホーム › Graphics.GdiPlus › GdipCloneBitmapArea
GdipCloneBitmapArea
関数ビットマップの指定領域を複製して新しいビットマップを作成する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipCloneBitmapArea(
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height,
INT format,
GpBitmap* srcBitmap,
GpBitmap** dstBitmap
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| x | FLOAT | in |
| y | FLOAT | in |
| width | FLOAT | in |
| height | FLOAT | in |
| format | INT | in |
| srcBitmap | GpBitmap* | inout |
| dstBitmap | GpBitmap** | inout |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipCloneBitmapArea(
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height,
INT format,
GpBitmap* srcBitmap,
GpBitmap** dstBitmap
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCloneBitmapArea(
float x, // FLOAT
float y, // FLOAT
float width, // FLOAT
float height, // FLOAT
int format, // INT
IntPtr srcBitmap, // GpBitmap* in/out
IntPtr dstBitmap // GpBitmap** in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCloneBitmapArea(
x As Single, ' FLOAT
y As Single, ' FLOAT
width As Single, ' FLOAT
height As Single, ' FLOAT
format As Integer, ' INT
srcBitmap As IntPtr, ' GpBitmap* in/out
dstBitmap As IntPtr ' GpBitmap** in/out
) As Integer
End Function' x : FLOAT
' y : FLOAT
' width : FLOAT
' height : FLOAT
' format : INT
' srcBitmap : GpBitmap* in/out
' dstBitmap : GpBitmap** in/out
Declare PtrSafe Function GdipCloneBitmapArea Lib "gdiplus" ( _
ByVal x As Single, _
ByVal y As Single, _
ByVal width As Single, _
ByVal height As Single, _
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
GdipCloneBitmapArea = ctypes.windll.gdiplus.GdipCloneBitmapArea
GdipCloneBitmapArea.restype = ctypes.c_int
GdipCloneBitmapArea.argtypes = [
ctypes.c_float, # x : FLOAT
ctypes.c_float, # y : FLOAT
ctypes.c_float, # width : FLOAT
ctypes.c_float, # height : FLOAT
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')
GdipCloneBitmapArea = Fiddle::Function.new(
lib['GdipCloneBitmapArea'],
[
Fiddle::TYPE_FLOAT, # x : FLOAT
Fiddle::TYPE_FLOAT, # y : FLOAT
Fiddle::TYPE_FLOAT, # width : FLOAT
Fiddle::TYPE_FLOAT, # height : FLOAT
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 GdipCloneBitmapArea(
x: f32, // FLOAT
y: f32, // FLOAT
width: f32, // FLOAT
height: f32, // FLOAT
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 GdipCloneBitmapArea(float x, float y, float width, float height, int format, IntPtr srcBitmap, IntPtr dstBitmap);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipCloneBitmapArea' -Namespace Win32 -PassThru
# $api::GdipCloneBitmapArea(x, y, width, height, format, srcBitmap, dstBitmap)#uselib "gdiplus.dll"
#func global GdipCloneBitmapArea "GdipCloneBitmapArea" float, float, float, float, sptr, sptr, sptr
; GdipCloneBitmapArea x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap) ; 戻り値は stat
; x : FLOAT -> "float"
; y : FLOAT -> "float"
; width : FLOAT -> "float"
; height : FLOAT -> "float"
; format : INT -> "sptr"
; srcBitmap : GpBitmap* in/out -> "sptr"
; dstBitmap : GpBitmap** in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipCloneBitmapArea "GdipCloneBitmapArea" float, float, float, float, int, var, var ; res = GdipCloneBitmapArea(x, y, width, height, format, srcBitmap, dstBitmap) ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "var" ; dstBitmap : GpBitmap** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipCloneBitmapArea "GdipCloneBitmapArea" float, float, float, float, int, sptr, sptr ; res = GdipCloneBitmapArea(x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap)) ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "sptr" ; dstBitmap : GpBitmap** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipCloneBitmapArea(FLOAT x, FLOAT y, FLOAT width, FLOAT height, INT format, GpBitmap* srcBitmap, GpBitmap** dstBitmap) #uselib "gdiplus.dll" #cfunc global GdipCloneBitmapArea "GdipCloneBitmapArea" float, float, float, float, int, var, var ; res = GdipCloneBitmapArea(x, y, width, height, format, srcBitmap, dstBitmap) ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "var" ; dstBitmap : GpBitmap** in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipCloneBitmapArea(FLOAT x, FLOAT y, FLOAT width, FLOAT height, INT format, GpBitmap* srcBitmap, GpBitmap** dstBitmap) #uselib "gdiplus.dll" #cfunc global GdipCloneBitmapArea "GdipCloneBitmapArea" float, float, float, float, int, intptr, intptr ; res = GdipCloneBitmapArea(x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap)) ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "intptr" ; dstBitmap : GpBitmap** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipCloneBitmapArea = gdiplus.NewProc("GdipCloneBitmapArea")
)
// x (FLOAT), y (FLOAT), width (FLOAT), height (FLOAT), format (INT), srcBitmap (GpBitmap* in/out), dstBitmap (GpBitmap** in/out)
r1, _, err := procGdipCloneBitmapArea.Call(
uintptr(math.Float32bits(x)),
uintptr(math.Float32bits(y)),
uintptr(math.Float32bits(width)),
uintptr(math.Float32bits(height)),
uintptr(format),
uintptr(srcBitmap),
uintptr(dstBitmap),
)
_ = 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 GdipCloneBitmapArea(
x: Single; // FLOAT
y: Single; // FLOAT
width: Single; // FLOAT
height: Single; // FLOAT
format: Integer; // INT
srcBitmap: Pointer; // GpBitmap* in/out
dstBitmap: Pointer // GpBitmap** in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipCloneBitmapArea';result := DllCall("gdiplus\GdipCloneBitmapArea"
, "Float", x ; FLOAT
, "Float", y ; FLOAT
, "Float", width ; FLOAT
, "Float", height ; FLOAT
, "Int", format ; INT
, "Ptr", srcBitmap ; GpBitmap* in/out
, "Ptr", dstBitmap ; GpBitmap** in/out
, "Int") ; return: Status●GdipCloneBitmapArea(x, y, width, height, format, srcBitmap, dstBitmap) = DLL("gdiplus.dll", "int GdipCloneBitmapArea(float, float, float, float, int, void*, void*)")
# 呼び出し: GdipCloneBitmapArea(x, y, width, height, format, srcBitmap, dstBitmap)
# x : FLOAT -> "float"
# y : FLOAT -> "float"
# width : FLOAT -> "float"
# height : FLOAT -> "float"
# format : INT -> "int"
# srcBitmap : GpBitmap* in/out -> "void*"
# dstBitmap : GpBitmap** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。