ホーム › Graphics.GdiPlus › GdipMeasureDriverString
GdipMeasureDriverString
関数ドライバー文字列の境界矩形を測定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipMeasureDriverString(
GpGraphics* graphics,
const WORD* text,
INT length,
const GpFont* font,
const PointF* positions,
INT flags,
const Matrix* matrix,
RectF* boundingBox
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| graphics | GpGraphics* | inout |
| text | WORD* | in |
| length | INT | in |
| font | GpFont* | in |
| positions | PointF* | in |
| flags | INT | in |
| matrix | Matrix* | in |
| boundingBox | RectF* | inout |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipMeasureDriverString(
GpGraphics* graphics,
const WORD* text,
INT length,
const GpFont* font,
const PointF* positions,
INT flags,
const Matrix* matrix,
RectF* boundingBox
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipMeasureDriverString(
IntPtr graphics, // GpGraphics* in/out
ref ushort text, // WORD*
int length, // INT
IntPtr font, // GpFont*
IntPtr positions, // PointF*
int flags, // INT
ref IntPtr matrix, // Matrix*
IntPtr boundingBox // RectF* in/out
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipMeasureDriverString(
graphics As IntPtr, ' GpGraphics* in/out
ByRef text As UShort, ' WORD*
length As Integer, ' INT
font As IntPtr, ' GpFont*
positions As IntPtr, ' PointF*
flags As Integer, ' INT
ByRef matrix As IntPtr, ' Matrix*
boundingBox As IntPtr ' RectF* in/out
) As Integer
End Function' graphics : GpGraphics* in/out
' text : WORD*
' length : INT
' font : GpFont*
' positions : PointF*
' flags : INT
' matrix : Matrix*
' boundingBox : RectF* in/out
Declare PtrSafe Function GdipMeasureDriverString Lib "gdiplus" ( _
ByVal graphics As LongPtr, _
ByRef text As Integer, _
ByVal length As Long, _
ByVal font As LongPtr, _
ByVal positions As LongPtr, _
ByVal flags As Long, _
ByRef matrix As LongPtr, _
ByVal boundingBox As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipMeasureDriverString = ctypes.windll.gdiplus.GdipMeasureDriverString
GdipMeasureDriverString.restype = ctypes.c_int
GdipMeasureDriverString.argtypes = [
ctypes.c_void_p, # graphics : GpGraphics* in/out
ctypes.POINTER(ctypes.c_ushort), # text : WORD*
ctypes.c_int, # length : INT
ctypes.c_void_p, # font : GpFont*
ctypes.c_void_p, # positions : PointF*
ctypes.c_int, # flags : INT
ctypes.c_void_p, # matrix : Matrix*
ctypes.c_void_p, # boundingBox : RectF* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipMeasureDriverString = Fiddle::Function.new(
lib['GdipMeasureDriverString'],
[
Fiddle::TYPE_VOIDP, # graphics : GpGraphics* in/out
Fiddle::TYPE_VOIDP, # text : WORD*
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_VOIDP, # font : GpFont*
Fiddle::TYPE_VOIDP, # positions : PointF*
Fiddle::TYPE_INT, # flags : INT
Fiddle::TYPE_VOIDP, # matrix : Matrix*
Fiddle::TYPE_VOIDP, # boundingBox : RectF* in/out
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipMeasureDriverString(
graphics: *mut GpGraphics, // GpGraphics* in/out
text: *const u16, // WORD*
length: i32, // INT
font: *const GpFont, // GpFont*
positions: *const PointF, // PointF*
flags: i32, // INT
matrix: *const isize, // Matrix*
boundingBox: *mut RectF // RectF* in/out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipMeasureDriverString(IntPtr graphics, ref ushort text, int length, IntPtr font, IntPtr positions, int flags, ref IntPtr matrix, IntPtr boundingBox);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipMeasureDriverString' -Namespace Win32 -PassThru
# $api::GdipMeasureDriverString(graphics, text, length, font, positions, flags, matrix, boundingBox)#uselib "gdiplus.dll"
#func global GdipMeasureDriverString "GdipMeasureDriverString" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipMeasureDriverString varptr(graphics), varptr(text), length, varptr(font), varptr(positions), flags, matrix, varptr(boundingBox) ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; text : WORD* -> "sptr"
; length : INT -> "sptr"
; font : GpFont* -> "sptr"
; positions : PointF* -> "sptr"
; flags : INT -> "sptr"
; matrix : Matrix* -> "sptr"
; boundingBox : RectF* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipMeasureDriverString "GdipMeasureDriverString" var, var, int, var, var, int, int, var ; res = GdipMeasureDriverString(graphics, text, length, font, positions, flags, matrix, boundingBox) ; graphics : GpGraphics* in/out -> "var" ; text : WORD* -> "var" ; length : INT -> "int" ; font : GpFont* -> "var" ; positions : PointF* -> "var" ; flags : INT -> "int" ; matrix : Matrix* -> "int" ; boundingBox : RectF* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipMeasureDriverString "GdipMeasureDriverString" sptr, sptr, int, sptr, sptr, int, int, sptr ; res = GdipMeasureDriverString(varptr(graphics), varptr(text), length, varptr(font), varptr(positions), flags, matrix, varptr(boundingBox)) ; graphics : GpGraphics* in/out -> "sptr" ; text : WORD* -> "sptr" ; length : INT -> "int" ; font : GpFont* -> "sptr" ; positions : PointF* -> "sptr" ; flags : INT -> "int" ; matrix : Matrix* -> "int" ; boundingBox : RectF* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipMeasureDriverString(GpGraphics* graphics, WORD* text, INT length, GpFont* font, PointF* positions, INT flags, Matrix* matrix, RectF* boundingBox) #uselib "gdiplus.dll" #cfunc global GdipMeasureDriverString "GdipMeasureDriverString" var, var, int, var, var, int, int, var ; res = GdipMeasureDriverString(graphics, text, length, font, positions, flags, matrix, boundingBox) ; graphics : GpGraphics* in/out -> "var" ; text : WORD* -> "var" ; length : INT -> "int" ; font : GpFont* -> "var" ; positions : PointF* -> "var" ; flags : INT -> "int" ; matrix : Matrix* -> "int" ; boundingBox : RectF* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipMeasureDriverString(GpGraphics* graphics, WORD* text, INT length, GpFont* font, PointF* positions, INT flags, Matrix* matrix, RectF* boundingBox) #uselib "gdiplus.dll" #cfunc global GdipMeasureDriverString "GdipMeasureDriverString" intptr, intptr, int, intptr, intptr, int, int, intptr ; res = GdipMeasureDriverString(varptr(graphics), varptr(text), length, varptr(font), varptr(positions), flags, matrix, varptr(boundingBox)) ; graphics : GpGraphics* in/out -> "intptr" ; text : WORD* -> "intptr" ; length : INT -> "int" ; font : GpFont* -> "intptr" ; positions : PointF* -> "intptr" ; flags : INT -> "int" ; matrix : Matrix* -> "int" ; boundingBox : RectF* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipMeasureDriverString = gdiplus.NewProc("GdipMeasureDriverString")
)
// graphics (GpGraphics* in/out), text (WORD*), length (INT), font (GpFont*), positions (PointF*), flags (INT), matrix (Matrix*), boundingBox (RectF* in/out)
r1, _, err := procGdipMeasureDriverString.Call(
uintptr(graphics),
uintptr(text),
uintptr(length),
uintptr(font),
uintptr(positions),
uintptr(flags),
uintptr(matrix),
uintptr(boundingBox),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipMeasureDriverString(
graphics: Pointer; // GpGraphics* in/out
text: Pointer; // WORD*
length: Integer; // INT
font: Pointer; // GpFont*
positions: Pointer; // PointF*
flags: Integer; // INT
matrix: Pointer; // Matrix*
boundingBox: Pointer // RectF* in/out
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipMeasureDriverString';result := DllCall("gdiplus\GdipMeasureDriverString"
, "Ptr", graphics ; GpGraphics* in/out
, "Ptr", text ; WORD*
, "Int", length ; INT
, "Ptr", font ; GpFont*
, "Ptr", positions ; PointF*
, "Int", flags ; INT
, "Ptr", matrix ; Matrix*
, "Ptr", boundingBox ; RectF* in/out
, "Int") ; return: Status●GdipMeasureDriverString(graphics, text, length, font, positions, flags, matrix, boundingBox) = DLL("gdiplus.dll", "int GdipMeasureDriverString(void*, void*, int, void*, void*, int, void*, void*)")
# 呼び出し: GdipMeasureDriverString(graphics, text, length, font, positions, flags, matrix, boundingBox)
# graphics : GpGraphics* in/out -> "void*"
# text : WORD* -> "void*"
# length : INT -> "int"
# font : GpFont* -> "void*"
# positions : PointF* -> "void*"
# flags : INT -> "int"
# matrix : Matrix* -> "void*"
# boundingBox : RectF* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。