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

GdipGetPathWorldBounds

関数
変換とペンを考慮したGDI+パスの外接矩形を取得する(浮動小数点版)。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetPathWorldBounds(
    GpPath* path,
    RectF* bounds,
    const Matrix* matrix,
    const GpPen* pen
);

パラメーター

名前方向説明
pathGpPath*inout境界矩形を取得する対象のパスオブジェクトへのポインタ。
boundsRectF*inout算出された境界矩形を受け取るRectFへのポインタ。
matrixMatrix*in境界算出前に適用する変換行列へのポインタ。NULL可。
penGpPen*in輪郭の太さを考慮させるGpPenへのポインタ。NULLで線幅を無視する。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetPathWorldBounds(
    GpPath* path,
    RectF* bounds,
    const Matrix* matrix,
    const GpPen* pen
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetPathWorldBounds(
    IntPtr path,   // GpPath* in/out
    IntPtr bounds,   // RectF* in/out
    ref IntPtr matrix,   // Matrix*
    IntPtr pen   // GpPen*
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetPathWorldBounds(
    path As IntPtr,   ' GpPath* in/out
    bounds As IntPtr,   ' RectF* in/out
    ByRef matrix As IntPtr,   ' Matrix*
    pen As IntPtr   ' GpPen*
) As Integer
End Function
' path : GpPath* in/out
' bounds : RectF* in/out
' matrix : Matrix*
' pen : GpPen*
Declare PtrSafe Function GdipGetPathWorldBounds 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

GdipGetPathWorldBounds = ctypes.windll.gdiplus.GdipGetPathWorldBounds
GdipGetPathWorldBounds.restype = ctypes.c_int
GdipGetPathWorldBounds.argtypes = [
    ctypes.c_void_p,  # path : GpPath* in/out
    ctypes.c_void_p,  # bounds : RectF* in/out
    ctypes.c_void_p,  # matrix : Matrix*
    ctypes.c_void_p,  # pen : GpPen*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipGetPathWorldBounds = Fiddle::Function.new(
  lib['GdipGetPathWorldBounds'],
  [
    Fiddle::TYPE_VOIDP,  # path : GpPath* in/out
    Fiddle::TYPE_VOIDP,  # bounds : RectF* in/out
    Fiddle::TYPE_VOIDP,  # matrix : Matrix*
    Fiddle::TYPE_VOIDP,  # pen : GpPen*
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipGetPathWorldBounds(
        path: *mut GpPath,  // GpPath* in/out
        bounds: *mut RectF,  // RectF* 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 GdipGetPathWorldBounds(IntPtr path, IntPtr bounds, ref IntPtr matrix, IntPtr pen);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetPathWorldBounds' -Namespace Win32 -PassThru
# $api::GdipGetPathWorldBounds(path, bounds, matrix, pen)
#uselib "gdiplus.dll"
#func global GdipGetPathWorldBounds "GdipGetPathWorldBounds" sptr, sptr, sptr, sptr
; GdipGetPathWorldBounds varptr(path), varptr(bounds), varptr(matrix), varptr(pen)   ; 戻り値は stat
; path : GpPath* in/out -> "sptr"
; bounds : RectF* in/out -> "sptr"
; matrix : Matrix* -> "sptr"
; pen : GpPen* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipGetPathWorldBounds "GdipGetPathWorldBounds" var, var, var, var
; res = GdipGetPathWorldBounds(path, bounds, matrix, pen)
; path : GpPath* in/out -> "var"
; bounds : RectF* in/out -> "var"
; matrix : Matrix* -> "var"
; pen : GpPen* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipGetPathWorldBounds(GpPath* path, RectF* bounds, Matrix* matrix, GpPen* pen)
#uselib "gdiplus.dll"
#cfunc global GdipGetPathWorldBounds "GdipGetPathWorldBounds" var, var, var, var
; res = GdipGetPathWorldBounds(path, bounds, matrix, pen)
; path : GpPath* in/out -> "var"
; bounds : RectF* in/out -> "var"
; matrix : Matrix* -> "var"
; pen : GpPen* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetPathWorldBounds = gdiplus.NewProc("GdipGetPathWorldBounds")
)

// path (GpPath* in/out), bounds (RectF* in/out), matrix (Matrix*), pen (GpPen*)
r1, _, err := procGdipGetPathWorldBounds.Call(
	uintptr(path),
	uintptr(bounds),
	uintptr(matrix),
	uintptr(pen),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetPathWorldBounds(
  path: Pointer;   // GpPath* in/out
  bounds: Pointer;   // RectF* in/out
  matrix: Pointer;   // Matrix*
  pen: Pointer   // GpPen*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetPathWorldBounds';
result := DllCall("gdiplus\GdipGetPathWorldBounds"
    , "Ptr", path   ; GpPath* in/out
    , "Ptr", bounds   ; RectF* in/out
    , "Ptr", matrix   ; Matrix*
    , "Ptr", pen   ; GpPen*
    , "Int")   ; return: Status
●GdipGetPathWorldBounds(path, bounds, matrix, pen) = DLL("gdiplus.dll", "int GdipGetPathWorldBounds(void*, void*, void*, void*)")
# 呼び出し: GdipGetPathWorldBounds(path, bounds, matrix, pen)
# path : GpPath* in/out -> "void*"
# bounds : RectF* 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 GdipGetPathWorldBounds(
    path: [*c]GpPath, // GpPath* in/out
    bounds: [*c]RectF, // RectF* in/out
    matrix: [*c]isize, // Matrix*
    pen: [*c]GpPen // GpPen*
) callconv(std.os.windows.WINAPI) i32;
proc GdipGetPathWorldBounds(
    path: ptr GpPath,  # GpPath* in/out
    bounds: ptr RectF,  # RectF* in/out
    matrix: ptr int,  # Matrix*
    pen: ptr GpPen  # GpPen*
): int32 {.importc: "GdipGetPathWorldBounds", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipGetPathWorldBounds(
    GpPath* path,   // GpPath* in/out
    RectF* bounds,   // RectF* in/out
    ptrdiff_t* matrix,   // Matrix*
    GpPen* pen   // GpPen*
);
ccall((:GdipGetPathWorldBounds, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpPath}, Ptr{RectF}, Ptr{Int}, Ptr{GpPen}),
      path, bounds, matrix, pen)
# path : GpPath* in/out -> Ptr{GpPath}
# bounds : RectF* in/out -> Ptr{RectF}
# matrix : Matrix* -> Ptr{Int}
# pen : GpPen* -> Ptr{GpPen}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipGetPathWorldBounds(
    void* path,
    void* bounds,
    intptr_t* matrix,
    void* pen);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipGetPathWorldBounds(path, bounds, matrix, pen)
-- path : GpPath* in/out
-- bounds : RectF* in/out
-- matrix : Matrix*
-- pen : GpPen*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipGetPathWorldBounds = lib.func('__stdcall', 'GdipGetPathWorldBounds', 'int32_t', ['void *', 'void *', 'intptr_t *', 'void *']);
// GdipGetPathWorldBounds(path, bounds, matrix, pen)
// path : GpPath* in/out -> 'void *'
// bounds : RectF* in/out -> 'void *'
// matrix : Matrix* -> 'intptr_t *'
// pen : GpPen* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipGetPathWorldBounds: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipGetPathWorldBounds(path, bounds, matrix, pen)
// path : GpPath* in/out -> "pointer"
// bounds : RectF* in/out -> "pointer"
// matrix : Matrix* -> "pointer"
// pen : GpPen* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipGetPathWorldBounds(
    void* path,
    void* bounds,
    intptr_t* matrix,
    void* pen);
C, "gdiplus.dll");
// $ffi->GdipGetPathWorldBounds(path, bounds, matrix, pen);
// path : GpPath* in/out
// bounds : RectF* 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 GdipGetPathWorldBounds(
        Pointer path,   // GpPath* in/out
        Pointer bounds,   // RectF* in/out
        LongByReference matrix,   // Matrix*
        Pointer pen   // GpPen*
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipGetPathWorldBounds = GdipGetPathWorldBounds(
    path : GpPath*,   # GpPath* in/out
    bounds : RectF*,   # RectF* 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 GdipGetPathWorldBoundsNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<Void>);
typedef GdipGetPathWorldBoundsDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Pointer<Void>);
final GdipGetPathWorldBounds = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipGetPathWorldBoundsNative, GdipGetPathWorldBoundsDart>('GdipGetPathWorldBounds');
// path : GpPath* in/out -> Pointer<Void>
// bounds : RectF* in/out -> Pointer<Void>
// matrix : Matrix* -> Pointer<IntPtr>
// pen : GpPen* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipGetPathWorldBounds(
  path: Pointer;   // GpPath* in/out
  bounds: Pointer;   // RectF* in/out
  matrix: Pointer;   // Matrix*
  pen: Pointer   // GpPen*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetPathWorldBounds';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipGetPathWorldBounds"
  c_GdipGetPathWorldBounds :: Ptr () -> Ptr () -> Ptr CIntPtr -> Ptr () -> IO Int32
-- path : GpPath* in/out -> Ptr ()
-- bounds : RectF* in/out -> Ptr ()
-- matrix : Matrix* -> Ptr CIntPtr
-- pen : GpPen* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipgetpathworldbounds =
  foreign "GdipGetPathWorldBounds"
    ((ptr void) @-> (ptr void) @-> (ptr intptr_t) @-> (ptr void) @-> returning int32_t)
(* path : GpPath* in/out -> (ptr void) *)
(* bounds : RectF* 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 ("GdipGetPathWorldBounds" gdip-get-path-world-bounds :convention :stdcall) :int32
  (path :pointer)   ; GpPath* in/out
  (bounds :pointer)   ; RectF* in/out
  (matrix :pointer)   ; Matrix*
  (pen :pointer))   ; GpPen*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipGetPathWorldBounds = Win32::API::More->new('gdiplus',
    'int GdipGetPathWorldBounds(LPVOID path, LPVOID bounds, LPVOID matrix, LPVOID pen)');
# my $ret = $GdipGetPathWorldBounds->Call($path, $bounds, $matrix, $pen);
# path : GpPath* in/out -> LPVOID
# bounds : RectF* in/out -> LPVOID
# matrix : Matrix* -> LPVOID
# pen : GpPen* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型