ホーム › Graphics.GdiPlus › GdipCloneBitmapAreaI
GdipCloneBitmapAreaI
関数ビットマップの指定領域を整数座標で複製して作成する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipCloneBitmapAreaI(
INT x,
INT y,
INT width,
INT height,
INT format,
GpBitmap* srcBitmap,
GpBitmap** dstBitmap
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| x | INT | in | 切り出す領域の左上X座標(ピクセル単位の整数)。 |
| y | INT | in | 切り出す領域の左上Y座標(ピクセル単位の整数)。 |
| width | INT | in | 切り出す領域の幅(ピクセル単位の整数)。 |
| height | INT | in | 切り出す領域の高さ(ピクセル単位の整数)。 |
| format | INT | in | 複製先ビットマップのピクセル形式を表すPixelFormat値。 |
| srcBitmap | GpBitmap* | inout | 複製元のGpBitmapオブジェクトへのポインタ。 |
| dstBitmap | GpBitmap** | inout | 切り出されたGpBitmapを受け取る出力先ポインタのアドレス。 |
戻り値の型: 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 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipCloneBitmapAreaI "GdipCloneBitmapAreaI" int, int, int, int, int, sptr, sptr ; res = GdipCloneBitmapAreaI(x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap)) ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "sptr" ; dstBitmap : GpBitmap** in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; 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, intptr, intptr ; res = GdipCloneBitmapAreaI(x, y, width, height, format, varptr(srcBitmap), varptr(dstBitmap)) ; x : INT -> "int" ; y : INT -> "int" ; width : INT -> "int" ; height : INT -> "int" ; format : INT -> "int" ; srcBitmap : GpBitmap* in/out -> "intptr" ; dstBitmap : GpBitmap** in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // Statusfunction 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)。const std = @import("std");
extern "gdiplus" fn GdipCloneBitmapAreaI(
x: i32, // INT
y: i32, // INT
width: i32, // INT
height: i32, // INT
format: i32, // INT
srcBitmap: [*c]GpBitmap, // GpBitmap* in/out
dstBitmap: [*c][*c]GpBitmap // GpBitmap** in/out
) callconv(std.os.windows.WINAPI) i32;proc GdipCloneBitmapAreaI(
x: int32, # INT
y: int32, # INT
width: int32, # INT
height: int32, # INT
format: int32, # INT
srcBitmap: ptr GpBitmap, # GpBitmap* in/out
dstBitmap: ptr GpBitmap # GpBitmap** in/out
): int32 {.importc: "GdipCloneBitmapAreaI", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipCloneBitmapAreaI(
int x, // INT
int y, // INT
int width, // INT
int height, // INT
int format, // INT
GpBitmap* srcBitmap, // GpBitmap* in/out
GpBitmap** dstBitmap // GpBitmap** in/out
);ccall((:GdipCloneBitmapAreaI, "gdiplus.dll"), stdcall, Int32,
(Int32, Int32, Int32, Int32, Int32, Ptr{GpBitmap}, Ptr{GpBitmap}),
x, y, width, height, format, srcBitmap, dstBitmap)
# x : INT -> Int32
# y : INT -> Int32
# width : INT -> Int32
# height : INT -> Int32
# format : INT -> Int32
# srcBitmap : GpBitmap* in/out -> Ptr{GpBitmap}
# dstBitmap : GpBitmap** in/out -> Ptr{GpBitmap}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipCloneBitmapAreaI(
int32_t x,
int32_t y,
int32_t width,
int32_t height,
int32_t format,
void* srcBitmap,
void* dstBitmap);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
-- x : INT
-- y : INT
-- width : INT
-- height : INT
-- format : INT
-- srcBitmap : GpBitmap* in/out
-- dstBitmap : GpBitmap** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipCloneBitmapAreaI = lib.func('__stdcall', 'GdipCloneBitmapAreaI', 'int32_t', ['int32_t', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'void *', 'void *']);
// GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
// x : INT -> 'int32_t'
// y : INT -> 'int32_t'
// width : INT -> 'int32_t'
// height : INT -> 'int32_t'
// format : INT -> 'int32_t'
// srcBitmap : GpBitmap* in/out -> 'void *'
// dstBitmap : GpBitmap** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipCloneBitmapAreaI: { parameters: ["i32", "i32", "i32", "i32", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap)
// x : INT -> "i32"
// y : INT -> "i32"
// width : INT -> "i32"
// height : INT -> "i32"
// format : INT -> "i32"
// srcBitmap : GpBitmap* in/out -> "pointer"
// dstBitmap : GpBitmap** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipCloneBitmapAreaI(
int32_t x,
int32_t y,
int32_t width,
int32_t height,
int32_t format,
void* srcBitmap,
void* dstBitmap);
C, "gdiplus.dll");
// $ffi->GdipCloneBitmapAreaI(x, y, width, height, format, srcBitmap, dstBitmap);
// x : INT
// y : INT
// width : INT
// height : INT
// format : INT
// srcBitmap : GpBitmap* in/out
// dstBitmap : GpBitmap** in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Gdiplus extends StdCallLibrary {
Gdiplus INSTANCE = Native.load("gdiplus", Gdiplus.class);
int GdipCloneBitmapAreaI(
int x, // INT
int y, // INT
int width, // INT
int height, // INT
int format, // INT
Pointer srcBitmap, // GpBitmap* in/out
Pointer dstBitmap // GpBitmap** in/out
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipCloneBitmapAreaI = GdipCloneBitmapAreaI(
x : Int32, # INT
y : Int32, # INT
width : Int32, # INT
height : Int32, # INT
format : Int32, # INT
srcBitmap : GpBitmap*, # GpBitmap* in/out
dstBitmap : GpBitmap** # GpBitmap** in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipCloneBitmapAreaINative = Int32 Function(Int32, Int32, Int32, Int32, Int32, Pointer<Void>, Pointer<Void>);
typedef GdipCloneBitmapAreaIDart = int Function(int, int, int, int, int, Pointer<Void>, Pointer<Void>);
final GdipCloneBitmapAreaI = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipCloneBitmapAreaINative, GdipCloneBitmapAreaIDart>('GdipCloneBitmapAreaI');
// x : INT -> Int32
// y : INT -> Int32
// width : INT -> Int32
// height : INT -> Int32
// format : INT -> Int32
// srcBitmap : GpBitmap* in/out -> Pointer<Void>
// dstBitmap : GpBitmap** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
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';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipCloneBitmapAreaI"
c_GdipCloneBitmapAreaI :: Int32 -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr () -> Ptr () -> IO Int32
-- x : INT -> Int32
-- y : INT -> Int32
-- width : INT -> Int32
-- height : INT -> Int32
-- format : INT -> Int32
-- srcBitmap : GpBitmap* in/out -> Ptr ()
-- dstBitmap : GpBitmap** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipclonebitmapareai =
foreign "GdipCloneBitmapAreaI"
(int32_t @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* x : INT -> int32_t *)
(* y : INT -> int32_t *)
(* width : INT -> int32_t *)
(* height : INT -> int32_t *)
(* format : INT -> int32_t *)
(* srcBitmap : GpBitmap* in/out -> (ptr void) *)
(* dstBitmap : GpBitmap** in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipCloneBitmapAreaI" gdip-clone-bitmap-area-i :convention :stdcall) :int32
(x :int32) ; INT
(y :int32) ; INT
(width :int32) ; INT
(height :int32) ; INT
(format :int32) ; INT
(src-bitmap :pointer) ; GpBitmap* in/out
(dst-bitmap :pointer)) ; GpBitmap** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipCloneBitmapAreaI = Win32::API::More->new('gdiplus',
'int GdipCloneBitmapAreaI(int x, int y, int width, int height, int format, LPVOID srcBitmap, LPVOID dstBitmap)');
# my $ret = $GdipCloneBitmapAreaI->Call($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 -> LPVOID
# dstBitmap : GpBitmap** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
使用する型