ホーム › Graphics.GdiPlus › GdipAddPathString
GdipAddPathString
関数GDI+のパスに文字列の輪郭を追加する(浮動小数点版)。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipAddPathString(
GpPath* path,
LPCWSTR string,
INT length,
const GpFontFamily* family,
INT style,
FLOAT emSize,
const RectF* layoutRect,
const GpStringFormat* format
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| path | GpPath* | inout | 文字列の輪郭を追加する対象のパスオブジェクトへのポインタ。 |
| string | LPCWSTR | in | パス化する文字列(Unicode)へのポインタ。 |
| length | INT | in | 文字列の文字数(INT)。-1でNULL終端まで使用する。 |
| family | GpFontFamily* | in | 使用するフォントファミリを表すGpFontFamilyへのポインタ。 |
| style | INT | in | フォントスタイル(INT)。FontStyle列挙のビット組合せを指定する。 |
| emSize | FLOAT | in | フォントのemサイズ(FLOAT)。 |
| layoutRect | RectF* | in | 文字列を配置する領域を表すRectFへのポインタ。 |
| format | GpStringFormat* | in | 文字列の書式を指定するGpStringFormatへのポインタ。NULL可。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipAddPathString(
GpPath* path,
LPCWSTR string,
INT length,
const GpFontFamily* family,
INT style,
FLOAT emSize,
const RectF* layoutRect,
const GpStringFormat* format
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipAddPathString(
IntPtr path, // GpPath* in/out
[MarshalAs(UnmanagedType.LPWStr)] string string, // LPCWSTR
int length, // INT
IntPtr family, // GpFontFamily*
int style, // INT
float emSize, // FLOAT
IntPtr layoutRect, // RectF*
IntPtr format // GpStringFormat*
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipAddPathString(
path As IntPtr, ' GpPath* in/out
<MarshalAs(UnmanagedType.LPWStr)> [string] As String, ' LPCWSTR
length As Integer, ' INT
family As IntPtr, ' GpFontFamily*
style As Integer, ' INT
emSize As Single, ' FLOAT
layoutRect As IntPtr, ' RectF*
format As IntPtr ' GpStringFormat*
) As Integer
End Function' path : GpPath* in/out
' string : LPCWSTR
' length : INT
' family : GpFontFamily*
' style : INT
' emSize : FLOAT
' layoutRect : RectF*
' format : GpStringFormat*
Declare PtrSafe Function GdipAddPathString Lib "gdiplus" ( _
ByVal path As LongPtr, _
ByVal string As LongPtr, _
ByVal length As Long, _
ByVal family As LongPtr, _
ByVal style As Long, _
ByVal emSize As Single, _
ByVal layoutRect As LongPtr, _
ByVal format As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipAddPathString = ctypes.windll.gdiplus.GdipAddPathString
GdipAddPathString.restype = ctypes.c_int
GdipAddPathString.argtypes = [
ctypes.c_void_p, # path : GpPath* in/out
wintypes.LPCWSTR, # string : LPCWSTR
ctypes.c_int, # length : INT
ctypes.c_void_p, # family : GpFontFamily*
ctypes.c_int, # style : INT
ctypes.c_float, # emSize : FLOAT
ctypes.c_void_p, # layoutRect : RectF*
ctypes.c_void_p, # format : GpStringFormat*
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipAddPathString = Fiddle::Function.new(
lib['GdipAddPathString'],
[
Fiddle::TYPE_VOIDP, # path : GpPath* in/out
Fiddle::TYPE_VOIDP, # string : LPCWSTR
Fiddle::TYPE_INT, # length : INT
Fiddle::TYPE_VOIDP, # family : GpFontFamily*
Fiddle::TYPE_INT, # style : INT
Fiddle::TYPE_FLOAT, # emSize : FLOAT
Fiddle::TYPE_VOIDP, # layoutRect : RectF*
Fiddle::TYPE_VOIDP, # format : GpStringFormat*
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipAddPathString(
path: *mut GpPath, // GpPath* in/out
string: *const u16, // LPCWSTR
length: i32, // INT
family: *const GpFontFamily, // GpFontFamily*
style: i32, // INT
emSize: f32, // FLOAT
layoutRect: *const RectF, // RectF*
format: *const GpStringFormat // GpStringFormat*
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipAddPathString(IntPtr path, [MarshalAs(UnmanagedType.LPWStr)] string string, int length, IntPtr family, int style, float emSize, IntPtr layoutRect, IntPtr format);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipAddPathString' -Namespace Win32 -PassThru
# $api::GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format)#uselib "gdiplus.dll"
#func global GdipAddPathString "GdipAddPathString" sptr, sptr, sptr, sptr, sptr, float, sptr, sptr
; GdipAddPathString varptr(path), string, length, varptr(family), style, emSize, varptr(layoutRect), varptr(format) ; 戻り値は stat
; path : GpPath* in/out -> "sptr"
; string : LPCWSTR -> "sptr"
; length : INT -> "sptr"
; family : GpFontFamily* -> "sptr"
; style : INT -> "sptr"
; emSize : FLOAT -> "float"
; layoutRect : RectF* -> "sptr"
; format : GpStringFormat* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipAddPathString "GdipAddPathString" var, wstr, int, var, int, float, var, var ; res = GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format) ; path : GpPath* in/out -> "var" ; string : LPCWSTR -> "wstr" ; length : INT -> "int" ; family : GpFontFamily* -> "var" ; style : INT -> "int" ; emSize : FLOAT -> "float" ; layoutRect : RectF* -> "var" ; format : GpStringFormat* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipAddPathString "GdipAddPathString" sptr, wstr, int, sptr, int, float, sptr, sptr ; res = GdipAddPathString(varptr(path), string, length, varptr(family), style, emSize, varptr(layoutRect), varptr(format)) ; path : GpPath* in/out -> "sptr" ; string : LPCWSTR -> "wstr" ; length : INT -> "int" ; family : GpFontFamily* -> "sptr" ; style : INT -> "int" ; emSize : FLOAT -> "float" ; layoutRect : RectF* -> "sptr" ; format : GpStringFormat* -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipAddPathString(GpPath* path, LPCWSTR string, INT length, GpFontFamily* family, INT style, FLOAT emSize, RectF* layoutRect, GpStringFormat* format) #uselib "gdiplus.dll" #cfunc global GdipAddPathString "GdipAddPathString" var, wstr, int, var, int, float, var, var ; res = GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format) ; path : GpPath* in/out -> "var" ; string : LPCWSTR -> "wstr" ; length : INT -> "int" ; family : GpFontFamily* -> "var" ; style : INT -> "int" ; emSize : FLOAT -> "float" ; layoutRect : RectF* -> "var" ; format : GpStringFormat* -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipAddPathString(GpPath* path, LPCWSTR string, INT length, GpFontFamily* family, INT style, FLOAT emSize, RectF* layoutRect, GpStringFormat* format) #uselib "gdiplus.dll" #cfunc global GdipAddPathString "GdipAddPathString" intptr, wstr, int, intptr, int, float, intptr, intptr ; res = GdipAddPathString(varptr(path), string, length, varptr(family), style, emSize, varptr(layoutRect), varptr(format)) ; path : GpPath* in/out -> "intptr" ; string : LPCWSTR -> "wstr" ; length : INT -> "int" ; family : GpFontFamily* -> "intptr" ; style : INT -> "int" ; emSize : FLOAT -> "float" ; layoutRect : RectF* -> "intptr" ; format : GpStringFormat* -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipAddPathString = gdiplus.NewProc("GdipAddPathString")
)
// path (GpPath* in/out), string (LPCWSTR), length (INT), family (GpFontFamily*), style (INT), emSize (FLOAT), layoutRect (RectF*), format (GpStringFormat*)
r1, _, err := procGdipAddPathString.Call(
uintptr(path),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(string))),
uintptr(length),
uintptr(family),
uintptr(style),
uintptr(math.Float32bits(emSize)),
uintptr(layoutRect),
uintptr(format),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function GdipAddPathString(
path: Pointer; // GpPath* in/out
string: PWideChar; // LPCWSTR
length: Integer; // INT
family: Pointer; // GpFontFamily*
style: Integer; // INT
emSize: Single; // FLOAT
layoutRect: Pointer; // RectF*
format: Pointer // GpStringFormat*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipAddPathString';result := DllCall("gdiplus\GdipAddPathString"
, "Ptr", path ; GpPath* in/out
, "WStr", string ; LPCWSTR
, "Int", length ; INT
, "Ptr", family ; GpFontFamily*
, "Int", style ; INT
, "Float", emSize ; FLOAT
, "Ptr", layoutRect ; RectF*
, "Ptr", format ; GpStringFormat*
, "Int") ; return: Status●GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format) = DLL("gdiplus.dll", "int GdipAddPathString(void*, char*, int, void*, int, float, void*, void*)")
# 呼び出し: GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format)
# path : GpPath* in/out -> "void*"
# string : LPCWSTR -> "char*"
# length : INT -> "int"
# family : GpFontFamily* -> "void*"
# style : INT -> "int"
# emSize : FLOAT -> "float"
# layoutRect : RectF* -> "void*"
# format : GpStringFormat* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipAddPathString(
path: [*c]GpPath, // GpPath* in/out
string: [*c]const u16, // LPCWSTR
length: i32, // INT
family: [*c]GpFontFamily, // GpFontFamily*
style: i32, // INT
emSize: f32, // FLOAT
layoutRect: [*c]RectF, // RectF*
format: [*c]GpStringFormat // GpStringFormat*
) callconv(std.os.windows.WINAPI) i32;proc GdipAddPathString(
path: ptr GpPath, # GpPath* in/out
string: WideCString, # LPCWSTR
length: int32, # INT
family: ptr GpFontFamily, # GpFontFamily*
style: int32, # INT
emSize: float32, # FLOAT
layoutRect: ptr RectF, # RectF*
format: ptr GpStringFormat # GpStringFormat*
): int32 {.importc: "GdipAddPathString", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipAddPathString(
GpPath* path, // GpPath* in/out
const(wchar)* string, // LPCWSTR
int length, // INT
GpFontFamily* family, // GpFontFamily*
int style, // INT
float emSize, // FLOAT
RectF* layoutRect, // RectF*
GpStringFormat* format // GpStringFormat*
);ccall((:GdipAddPathString, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpPath}, Cwstring, Int32, Ptr{GpFontFamily}, Int32, Float32, Ptr{RectF}, Ptr{GpStringFormat}),
path, string, length, family, style, emSize, layoutRect, format)
# path : GpPath* in/out -> Ptr{GpPath}
# string : LPCWSTR -> Cwstring
# length : INT -> Int32
# family : GpFontFamily* -> Ptr{GpFontFamily}
# style : INT -> Int32
# emSize : FLOAT -> Float32
# layoutRect : RectF* -> Ptr{RectF}
# format : GpStringFormat* -> Ptr{GpStringFormat}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipAddPathString(
void* path,
const uint16_t* string,
int32_t length,
void* family,
int32_t style,
float emSize,
void* layoutRect,
void* format);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format)
-- path : GpPath* in/out
-- string : LPCWSTR
-- length : INT
-- family : GpFontFamily*
-- style : INT
-- emSize : FLOAT
-- layoutRect : RectF*
-- format : GpStringFormat*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipAddPathString = lib.func('__stdcall', 'GdipAddPathString', 'int32_t', ['void *', 'str16', 'int32_t', 'void *', 'int32_t', 'float', 'void *', 'void *']);
// GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format)
// path : GpPath* in/out -> 'void *'
// string : LPCWSTR -> 'str16'
// length : INT -> 'int32_t'
// family : GpFontFamily* -> 'void *'
// style : INT -> 'int32_t'
// emSize : FLOAT -> 'float'
// layoutRect : RectF* -> 'void *'
// format : GpStringFormat* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipAddPathString: { parameters: ["pointer", "buffer", "i32", "pointer", "i32", "f32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format)
// path : GpPath* in/out -> "pointer"
// string : LPCWSTR -> "buffer"
// length : INT -> "i32"
// family : GpFontFamily* -> "pointer"
// style : INT -> "i32"
// emSize : FLOAT -> "f32"
// layoutRect : RectF* -> "pointer"
// format : GpStringFormat* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipAddPathString(
void* path,
const uint16_t* string,
int32_t length,
void* family,
int32_t style,
float emSize,
void* layoutRect,
void* format);
C, "gdiplus.dll");
// $ffi->GdipAddPathString(path, string, length, family, style, emSize, layoutRect, format);
// path : GpPath* in/out
// string : LPCWSTR
// length : INT
// family : GpFontFamily*
// style : INT
// emSize : FLOAT
// layoutRect : RectF*
// format : GpStringFormat*
// 構造体/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 GdipAddPathString(
Pointer path, // GpPath* in/out
WString string, // LPCWSTR
int length, // INT
Pointer family, // GpFontFamily*
int style, // INT
float emSize, // FLOAT
Pointer layoutRect, // RectF*
Pointer format // GpStringFormat*
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipAddPathString = GdipAddPathString(
path : GpPath*, # GpPath* in/out
string : UInt16*, # LPCWSTR
length : Int32, # INT
family : GpFontFamily*, # GpFontFamily*
style : Int32, # INT
emSize : Float32, # FLOAT
layoutRect : RectF*, # RectF*
format : GpStringFormat* # GpStringFormat*
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipAddPathStringNative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Int32, Pointer<Void>, Int32, Float, Pointer<Void>, Pointer<Void>);
typedef GdipAddPathStringDart = int Function(Pointer<Void>, Pointer<Utf16>, int, Pointer<Void>, int, double, Pointer<Void>, Pointer<Void>);
final GdipAddPathString = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipAddPathStringNative, GdipAddPathStringDart>('GdipAddPathString');
// path : GpPath* in/out -> Pointer<Void>
// string : LPCWSTR -> Pointer<Utf16>
// length : INT -> Int32
// family : GpFontFamily* -> Pointer<Void>
// style : INT -> Int32
// emSize : FLOAT -> Float
// layoutRect : RectF* -> Pointer<Void>
// format : GpStringFormat* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipAddPathString(
path: Pointer; // GpPath* in/out
string: PWideChar; // LPCWSTR
length: Integer; // INT
family: Pointer; // GpFontFamily*
style: Integer; // INT
emSize: Single; // FLOAT
layoutRect: Pointer; // RectF*
format: Pointer // GpStringFormat*
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipAddPathString';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipAddPathString"
c_GdipAddPathString :: Ptr () -> CWString -> Int32 -> Ptr () -> Int32 -> CFloat -> Ptr () -> Ptr () -> IO Int32
-- path : GpPath* in/out -> Ptr ()
-- string : LPCWSTR -> CWString
-- length : INT -> Int32
-- family : GpFontFamily* -> Ptr ()
-- style : INT -> Int32
-- emSize : FLOAT -> CFloat
-- layoutRect : RectF* -> Ptr ()
-- format : GpStringFormat* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipaddpathstring =
foreign "GdipAddPathString"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> (ptr void) @-> int32_t @-> float @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* path : GpPath* in/out -> (ptr void) *)
(* string : LPCWSTR -> (ptr uint16_t) *)
(* length : INT -> int32_t *)
(* family : GpFontFamily* -> (ptr void) *)
(* style : INT -> int32_t *)
(* emSize : FLOAT -> float *)
(* layoutRect : RectF* -> (ptr void) *)
(* format : GpStringFormat* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipAddPathString" gdip-add-path-string :convention :stdcall) :int32
(path :pointer) ; GpPath* in/out
(string (:string :encoding :utf-16le)) ; LPCWSTR
(length :int32) ; INT
(family :pointer) ; GpFontFamily*
(style :int32) ; INT
(em-size :float) ; FLOAT
(layout-rect :pointer) ; RectF*
(format :pointer)) ; GpStringFormat*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipAddPathString = Win32::API::More->new('gdiplus',
'int GdipAddPathString(LPVOID path, LPCWSTR string, int length, LPVOID family, int style, float emSize, LPVOID layoutRect, LPVOID format)');
# my $ret = $GdipAddPathString->Call($path, $string, $length, $family, $style, $emSize, $layoutRect, $format);
# path : GpPath* in/out -> LPVOID
# string : LPCWSTR -> LPCWSTR
# length : INT -> int
# family : GpFontFamily* -> LPVOID
# style : INT -> int
# emSize : FLOAT -> float
# layoutRect : RectF* -> LPVOID
# format : GpStringFormat* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。