ホーム › Graphics.GdiPlus › GdipGetPathWorldBoundsI
GdipGetPathWorldBoundsI
関数変換とペンを考慮したGDI+パスの外接矩形を取得する(整数版)。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipGetPathWorldBoundsI(
GpPath* path,
Rect* bounds,
const Matrix* matrix,
const GpPen* pen
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| path | GpPath* | inout | 境界矩形を取得する対象のパスオブジェクトへのポインタ。 |
| bounds | Rect* | inout | 算出された整数座標の境界矩形を受け取るRectへのポインタ。 |
| matrix | Matrix* | in | 境界算出前に適用する変換行列へのポインタ。NULL可。 |
| pen | GpPen* | in | 輪郭の太さを考慮させるGpPenへのポインタ。NULLで線幅を無視する。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipGetPathWorldBoundsI(
GpPath* path,
Rect* bounds,
const Matrix* matrix,
const GpPen* pen
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetPathWorldBoundsI(
IntPtr path, // GpPath* in/out
IntPtr bounds, // Rect* in/out
ref IntPtr matrix, // Matrix*
IntPtr pen // GpPen*
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetPathWorldBoundsI(
path As IntPtr, ' GpPath* in/out
bounds As IntPtr, ' Rect* in/out
ByRef matrix As IntPtr, ' Matrix*
pen As IntPtr ' GpPen*
) As Integer
End Function' path : GpPath* in/out
' bounds : Rect* in/out
' matrix : Matrix*
' pen : GpPen*
Declare PtrSafe Function GdipGetPathWorldBoundsI Lib "gdiplus" ( _
ByVal path As LongPtr, _
ByVal bounds As LongPtr, _
ByRef matrix As LongPtr, _
ByVal pen As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipGetPathWorldBoundsI = ctypes.windll.gdiplus.GdipGetPathWorldBoundsI
GdipGetPathWorldBoundsI.restype = ctypes.c_int
GdipGetPathWorldBoundsI.argtypes = [
ctypes.c_void_p, # path : GpPath* in/out
ctypes.c_void_p, # bounds : Rect* in/out
ctypes.c_void_p, # matrix : Matrix*
ctypes.c_void_p, # pen : GpPen*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipGetPathWorldBoundsI = Fiddle::Function.new(
lib['GdipGetPathWorldBoundsI'],
[
Fiddle::TYPE_VOIDP, # path : GpPath* in/out
Fiddle::TYPE_VOIDP, # bounds : Rect* in/out
Fiddle::TYPE_VOIDP, # matrix : Matrix*
Fiddle::TYPE_VOIDP, # pen : GpPen*
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipGetPathWorldBoundsI(
path: *mut GpPath, // GpPath* in/out
bounds: *mut Rect, // Rect* in/out
matrix: *const isize, // Matrix*
pen: *const GpPen // GpPen*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipGetPathWorldBoundsI(IntPtr path, IntPtr bounds, ref IntPtr matrix, IntPtr pen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetPathWorldBoundsI' -Namespace Win32 -PassThru
# $api::GdipGetPathWorldBoundsI(path, bounds, matrix, pen)#uselib "gdiplus.dll"
#func global GdipGetPathWorldBoundsI "GdipGetPathWorldBoundsI" sptr, sptr, sptr, sptr
; GdipGetPathWorldBoundsI varptr(path), varptr(bounds), varptr(matrix), varptr(pen) ; 戻り値は stat
; path : GpPath* in/out -> "sptr"
; bounds : Rect* in/out -> "sptr"
; matrix : Matrix* -> "sptr"
; pen : GpPen* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipGetPathWorldBoundsI "GdipGetPathWorldBoundsI" var, var, var, var ; res = GdipGetPathWorldBoundsI(path, bounds, matrix, pen) ; path : GpPath* in/out -> "var" ; bounds : Rect* in/out -> "var" ; matrix : Matrix* -> "var" ; pen : GpPen* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipGetPathWorldBoundsI "GdipGetPathWorldBoundsI" sptr, sptr, sptr, sptr ; res = GdipGetPathWorldBoundsI(varptr(path), varptr(bounds), varptr(matrix), varptr(pen)) ; path : GpPath* in/out -> "sptr" ; bounds : Rect* in/out -> "sptr" ; matrix : Matrix* -> "sptr" ; pen : GpPen* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipGetPathWorldBoundsI(GpPath* path, Rect* bounds, Matrix* matrix, GpPen* pen) #uselib "gdiplus.dll" #cfunc global GdipGetPathWorldBoundsI "GdipGetPathWorldBoundsI" var, var, var, var ; res = GdipGetPathWorldBoundsI(path, bounds, matrix, pen) ; path : GpPath* in/out -> "var" ; bounds : Rect* in/out -> "var" ; matrix : Matrix* -> "var" ; pen : GpPen* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipGetPathWorldBoundsI(GpPath* path, Rect* bounds, Matrix* matrix, GpPen* pen) #uselib "gdiplus.dll" #cfunc global GdipGetPathWorldBoundsI "GdipGetPathWorldBoundsI" intptr, intptr, intptr, intptr ; res = GdipGetPathWorldBoundsI(varptr(path), varptr(bounds), varptr(matrix), varptr(pen)) ; path : GpPath* in/out -> "intptr" ; bounds : Rect* in/out -> "intptr" ; matrix : Matrix* -> "intptr" ; pen : GpPen* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipGetPathWorldBoundsI = gdiplus.NewProc("GdipGetPathWorldBoundsI")
)
// path (GpPath* in/out), bounds (Rect* in/out), matrix (Matrix*), pen (GpPen*)
r1, _, err := procGdipGetPathWorldBoundsI.Call(
uintptr(path),
uintptr(bounds),
uintptr(matrix),
uintptr(pen),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipGetPathWorldBoundsI(
path: Pointer; // GpPath* in/out
bounds: Pointer; // Rect* in/out
matrix: Pointer; // Matrix*
pen: Pointer // GpPen*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipGetPathWorldBoundsI';result := DllCall("gdiplus\GdipGetPathWorldBoundsI"
, "Ptr", path ; GpPath* in/out
, "Ptr", bounds ; Rect* in/out
, "Ptr", matrix ; Matrix*
, "Ptr", pen ; GpPen*
, "Int") ; return: Status●GdipGetPathWorldBoundsI(path, bounds, matrix, pen) = DLL("gdiplus.dll", "int GdipGetPathWorldBoundsI(void*, void*, void*, void*)")
# 呼び出し: GdipGetPathWorldBoundsI(path, bounds, matrix, pen)
# path : GpPath* in/out -> "void*"
# bounds : Rect* in/out -> "void*"
# matrix : Matrix* -> "void*"
# pen : GpPen* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipGetPathWorldBoundsI(
path: [*c]GpPath, // GpPath* in/out
bounds: [*c]Rect, // Rect* in/out
matrix: [*c]isize, // Matrix*
pen: [*c]GpPen // GpPen*
) callconv(std.os.windows.WINAPI) i32;proc GdipGetPathWorldBoundsI(
path: ptr GpPath, # GpPath* in/out
bounds: ptr Rect, # Rect* in/out
matrix: ptr int, # Matrix*
pen: ptr GpPen # GpPen*
): int32 {.importc: "GdipGetPathWorldBoundsI", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipGetPathWorldBoundsI(
GpPath* path, // GpPath* in/out
Rect* bounds, // Rect* in/out
ptrdiff_t* matrix, // Matrix*
GpPen* pen // GpPen*
);ccall((:GdipGetPathWorldBoundsI, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpPath}, Ptr{Rect}, Ptr{Int}, Ptr{GpPen}),
path, bounds, matrix, pen)
# path : GpPath* in/out -> Ptr{GpPath}
# bounds : Rect* in/out -> Ptr{Rect}
# matrix : Matrix* -> Ptr{Int}
# pen : GpPen* -> Ptr{GpPen}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipGetPathWorldBoundsI(
void* path,
void* bounds,
intptr_t* matrix,
void* pen);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipGetPathWorldBoundsI(path, bounds, matrix, pen)
-- path : GpPath* in/out
-- bounds : Rect* in/out
-- matrix : Matrix*
-- pen : GpPen*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipGetPathWorldBoundsI = lib.func('__stdcall', 'GdipGetPathWorldBoundsI', 'int32_t', ['void *', 'void *', 'intptr_t *', 'void *']);
// GdipGetPathWorldBoundsI(path, bounds, matrix, pen)
// path : GpPath* in/out -> 'void *'
// bounds : Rect* in/out -> 'void *'
// matrix : Matrix* -> 'intptr_t *'
// pen : GpPen* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipGetPathWorldBoundsI: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipGetPathWorldBoundsI(path, bounds, matrix, pen)
// path : GpPath* in/out -> "pointer"
// bounds : Rect* in/out -> "pointer"
// matrix : Matrix* -> "pointer"
// pen : GpPen* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipGetPathWorldBoundsI(
void* path,
void* bounds,
intptr_t* matrix,
void* pen);
C, "gdiplus.dll");
// $ffi->GdipGetPathWorldBoundsI(path, bounds, matrix, pen);
// path : GpPath* in/out
// bounds : Rect* in/out
// matrix : Matrix*
// pen : GpPen*
// 構造体/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 GdipGetPathWorldBoundsI(
Pointer path, // GpPath* in/out
Pointer bounds, // Rect* in/out
LongByReference matrix, // Matrix*
Pointer pen // GpPen*
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipGetPathWorldBoundsI = GdipGetPathWorldBoundsI(
path : GpPath*, # GpPath* in/out
bounds : Rect*, # Rect* in/out
matrix : LibC::SSizeT*, # Matrix*
pen : GpPen* # GpPen*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipGetPathWorldBoundsINative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<Void>);
typedef GdipGetPathWorldBoundsIDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<Void>);
final GdipGetPathWorldBoundsI = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipGetPathWorldBoundsINative, GdipGetPathWorldBoundsIDart>('GdipGetPathWorldBoundsI');
// path : GpPath* in/out -> Pointer<Void>
// bounds : Rect* in/out -> Pointer<Void>
// matrix : Matrix* -> Pointer<IntPtr>
// pen : GpPen* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipGetPathWorldBoundsI(
path: Pointer; // GpPath* in/out
bounds: Pointer; // Rect* in/out
matrix: Pointer; // Matrix*
pen: Pointer // GpPen*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipGetPathWorldBoundsI';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipGetPathWorldBoundsI"
c_GdipGetPathWorldBoundsI :: Ptr () -> Ptr () -> Ptr CIntPtr -> Ptr () -> IO Int32
-- path : GpPath* in/out -> Ptr ()
-- bounds : Rect* in/out -> Ptr ()
-- matrix : Matrix* -> Ptr CIntPtr
-- pen : GpPen* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipgetpathworldboundsi =
foreign "GdipGetPathWorldBoundsI"
((ptr void) @-> (ptr void) @-> (ptr intptr_t) @-> (ptr void) @-> returning int32_t)
(* path : GpPath* in/out -> (ptr void) *)
(* bounds : Rect* in/out -> (ptr void) *)
(* matrix : Matrix* -> (ptr intptr_t) *)
(* pen : GpPen* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipGetPathWorldBoundsI" gdip-get-path-world-bounds-i :convention :stdcall) :int32
(path :pointer) ; GpPath* in/out
(bounds :pointer) ; Rect* in/out
(matrix :pointer) ; Matrix*
(pen :pointer)) ; GpPen*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipGetPathWorldBoundsI = Win32::API::More->new('gdiplus',
'int GdipGetPathWorldBoundsI(LPVOID path, LPVOID bounds, LPVOID matrix, LPVOID pen)');
# my $ret = $GdipGetPathWorldBoundsI->Call($path, $bounds, $matrix, $pen);
# path : GpPath* in/out -> LPVOID
# bounds : Rect* in/out -> LPVOID
# matrix : Matrix* -> LPVOID
# pen : GpPen* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。