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

GdipDrawDriverString

関数
グリフ位置を指定してドライバー文字列を描画する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipDrawDriverString(
    GpGraphics* graphics,
    const WORD* text,
    INT length,
    const GpFont* font,
    const GpBrush* brush,
    const PointF* positions,
    INT flags,
    const Matrix* matrix
);

パラメーター

名前方向
graphicsGpGraphics*inout
textWORD*in
lengthINTin
fontGpFont*in
brushGpBrush*in
positionsPointF*in
flagsINTin
matrixMatrix*in

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipDrawDriverString(
    GpGraphics* graphics,
    const WORD* text,
    INT length,
    const GpFont* font,
    const GpBrush* brush,
    const PointF* positions,
    INT flags,
    const Matrix* matrix
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipDrawDriverString(
    IntPtr graphics,   // GpGraphics* in/out
    ref ushort text,   // WORD*
    int length,   // INT
    IntPtr font,   // GpFont*
    IntPtr brush,   // GpBrush*
    IntPtr positions,   // PointF*
    int flags,   // INT
    ref IntPtr matrix   // Matrix*
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipDrawDriverString(
    graphics As IntPtr,   ' GpGraphics* in/out
    ByRef text As UShort,   ' WORD*
    length As Integer,   ' INT
    font As IntPtr,   ' GpFont*
    brush As IntPtr,   ' GpBrush*
    positions As IntPtr,   ' PointF*
    flags As Integer,   ' INT
    ByRef matrix As IntPtr   ' Matrix*
) As Integer
End Function
' graphics : GpGraphics* in/out
' text : WORD*
' length : INT
' font : GpFont*
' brush : GpBrush*
' positions : PointF*
' flags : INT
' matrix : Matrix*
Declare PtrSafe Function GdipDrawDriverString Lib "gdiplus" ( _
    ByVal graphics As LongPtr, _
    ByRef text As Integer, _
    ByVal length As Long, _
    ByVal font As LongPtr, _
    ByVal brush As LongPtr, _
    ByVal positions As LongPtr, _
    ByVal flags As Long, _
    ByRef matrix As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipDrawDriverString = ctypes.windll.gdiplus.GdipDrawDriverString
GdipDrawDriverString.restype = ctypes.c_int
GdipDrawDriverString.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,  # brush : GpBrush*
    ctypes.c_void_p,  # positions : PointF*
    ctypes.c_int,  # flags : INT
    ctypes.c_void_p,  # matrix : Matrix*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipDrawDriverString = Fiddle::Function.new(
  lib['GdipDrawDriverString'],
  [
    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,  # brush : GpBrush*
    Fiddle::TYPE_VOIDP,  # positions : PointF*
    Fiddle::TYPE_INT,  # flags : INT
    Fiddle::TYPE_VOIDP,  # matrix : Matrix*
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipDrawDriverString(
        graphics: *mut GpGraphics,  // GpGraphics* in/out
        text: *const u16,  // WORD*
        length: i32,  // INT
        font: *const GpFont,  // GpFont*
        brush: *const GpBrush,  // GpBrush*
        positions: *const PointF,  // PointF*
        flags: i32,  // INT
        matrix: *const isize  // Matrix*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipDrawDriverString(IntPtr graphics, ref ushort text, int length, IntPtr font, IntPtr brush, IntPtr positions, int flags, ref IntPtr matrix);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipDrawDriverString' -Namespace Win32 -PassThru
# $api::GdipDrawDriverString(graphics, text, length, font, brush, positions, flags, matrix)
#uselib "gdiplus.dll"
#func global GdipDrawDriverString "GdipDrawDriverString" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GdipDrawDriverString varptr(graphics), varptr(text), length, varptr(font), varptr(brush), varptr(positions), flags, matrix   ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; text : WORD* -> "sptr"
; length : INT -> "sptr"
; font : GpFont* -> "sptr"
; brush : GpBrush* -> "sptr"
; positions : PointF* -> "sptr"
; flags : INT -> "sptr"
; matrix : Matrix* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipDrawDriverString "GdipDrawDriverString" var, var, int, var, var, var, int, int
; res = GdipDrawDriverString(graphics, text, length, font, brush, positions, flags, matrix)
; graphics : GpGraphics* in/out -> "var"
; text : WORD* -> "var"
; length : INT -> "int"
; font : GpFont* -> "var"
; brush : GpBrush* -> "var"
; positions : PointF* -> "var"
; flags : INT -> "int"
; matrix : Matrix* -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipDrawDriverString(GpGraphics* graphics, WORD* text, INT length, GpFont* font, GpBrush* brush, PointF* positions, INT flags, Matrix* matrix)
#uselib "gdiplus.dll"
#cfunc global GdipDrawDriverString "GdipDrawDriverString" var, var, int, var, var, var, int, int
; res = GdipDrawDriverString(graphics, text, length, font, brush, positions, flags, matrix)
; graphics : GpGraphics* in/out -> "var"
; text : WORD* -> "var"
; length : INT -> "int"
; font : GpFont* -> "var"
; brush : GpBrush* -> "var"
; positions : PointF* -> "var"
; flags : INT -> "int"
; matrix : Matrix* -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipDrawDriverString = gdiplus.NewProc("GdipDrawDriverString")
)

// graphics (GpGraphics* in/out), text (WORD*), length (INT), font (GpFont*), brush (GpBrush*), positions (PointF*), flags (INT), matrix (Matrix*)
r1, _, err := procGdipDrawDriverString.Call(
	uintptr(graphics),
	uintptr(text),
	uintptr(length),
	uintptr(font),
	uintptr(brush),
	uintptr(positions),
	uintptr(flags),
	uintptr(matrix),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipDrawDriverString(
  graphics: Pointer;   // GpGraphics* in/out
  text: Pointer;   // WORD*
  length: Integer;   // INT
  font: Pointer;   // GpFont*
  brush: Pointer;   // GpBrush*
  positions: Pointer;   // PointF*
  flags: Integer;   // INT
  matrix: Pointer   // Matrix*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipDrawDriverString';
result := DllCall("gdiplus\GdipDrawDriverString"
    , "Ptr", graphics   ; GpGraphics* in/out
    , "Ptr", text   ; WORD*
    , "Int", length   ; INT
    , "Ptr", font   ; GpFont*
    , "Ptr", brush   ; GpBrush*
    , "Ptr", positions   ; PointF*
    , "Int", flags   ; INT
    , "Ptr", matrix   ; Matrix*
    , "Int")   ; return: Status
●GdipDrawDriverString(graphics, text, length, font, brush, positions, flags, matrix) = DLL("gdiplus.dll", "int GdipDrawDriverString(void*, void*, int, void*, void*, void*, int, void*)")
# 呼び出し: GdipDrawDriverString(graphics, text, length, font, brush, positions, flags, matrix)
# graphics : GpGraphics* in/out -> "void*"
# text : WORD* -> "void*"
# length : INT -> "int"
# font : GpFont* -> "void*"
# brush : GpBrush* -> "void*"
# positions : PointF* -> "void*"
# flags : INT -> "int"
# matrix : Matrix* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。