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

GdipAddPathStringI

関数
GDI+のパスに文字列の輪郭を追加する(整数版)。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipAddPathStringI(
    GpPath* path,
    LPCWSTR string,
    INT length,
    const GpFontFamily* family,
    INT style,
    FLOAT emSize,
    const Rect* layoutRect,
    const GpStringFormat* format
);

パラメーター

名前方向説明
pathGpPath*inout文字列の輪郭を追加する対象のパスオブジェクトへのポインタ。
stringLPCWSTRinパス化する文字列(Unicode)へのポインタ。
lengthINTin文字列の文字数(INT)。-1でNULL終端まで使用する。
familyGpFontFamily*in使用するフォントファミリを表すGpFontFamilyへのポインタ。
styleINTinフォントスタイル(INT)。FontStyle列挙のビット組合せを指定する。
emSizeFLOATinフォントのemサイズ(FLOAT)。
layoutRectRect*in文字列を配置する整数座標領域を表すRectへのポインタ。
formatGpStringFormat*in文字列の書式を指定するGpStringFormatへのポインタ。NULL可。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipAddPathStringI(
    GpPath* path,
    LPCWSTR string,
    INT length,
    const GpFontFamily* family,
    INT style,
    FLOAT emSize,
    const Rect* layoutRect,
    const GpStringFormat* format
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipAddPathStringI(
    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,   // Rect*
    IntPtr format   // GpStringFormat*
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipAddPathStringI(
    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,   ' Rect*
    format As IntPtr   ' GpStringFormat*
) As Integer
End Function
' path : GpPath* in/out
' string : LPCWSTR
' length : INT
' family : GpFontFamily*
' style : INT
' emSize : FLOAT
' layoutRect : Rect*
' format : GpStringFormat*
Declare PtrSafe Function GdipAddPathStringI 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

GdipAddPathStringI = ctypes.windll.gdiplus.GdipAddPathStringI
GdipAddPathStringI.restype = ctypes.c_int
GdipAddPathStringI.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 : Rect*
    ctypes.c_void_p,  # format : GpStringFormat*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipAddPathStringI = Fiddle::Function.new(
  lib['GdipAddPathStringI'],
  [
    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 : Rect*
    Fiddle::TYPE_VOIDP,  # format : GpStringFormat*
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipAddPathStringI(
        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 Rect,  // Rect*
        format: *const GpStringFormat  // GpStringFormat*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipAddPathStringI(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_GdipAddPathStringI' -Namespace Win32 -PassThru
# $api::GdipAddPathStringI(path, string, length, family, style, emSize, layoutRect, format)
#uselib "gdiplus.dll"
#func global GdipAddPathStringI "GdipAddPathStringI" sptr, sptr, sptr, sptr, sptr, float, sptr, sptr
; GdipAddPathStringI 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 : Rect* -> "sptr"
; format : GpStringFormat* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipAddPathStringI "GdipAddPathStringI" var, wstr, int, var, int, float, var, var
; res = GdipAddPathStringI(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 : Rect* -> "var"
; format : GpStringFormat* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipAddPathStringI(GpPath* path, LPCWSTR string, INT length, GpFontFamily* family, INT style, FLOAT emSize, Rect* layoutRect, GpStringFormat* format)
#uselib "gdiplus.dll"
#cfunc global GdipAddPathStringI "GdipAddPathStringI" var, wstr, int, var, int, float, var, var
; res = GdipAddPathStringI(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 : Rect* -> "var"
; format : GpStringFormat* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipAddPathStringI = gdiplus.NewProc("GdipAddPathStringI")
)

// path (GpPath* in/out), string (LPCWSTR), length (INT), family (GpFontFamily*), style (INT), emSize (FLOAT), layoutRect (Rect*), format (GpStringFormat*)
r1, _, err := procGdipAddPathStringI.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 GdipAddPathStringI(
  path: Pointer;   // GpPath* in/out
  string: PWideChar;   // LPCWSTR
  length: Integer;   // INT
  family: Pointer;   // GpFontFamily*
  style: Integer;   // INT
  emSize: Single;   // FLOAT
  layoutRect: Pointer;   // Rect*
  format: Pointer   // GpStringFormat*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipAddPathStringI';
result := DllCall("gdiplus\GdipAddPathStringI"
    , "Ptr", path   ; GpPath* in/out
    , "WStr", string   ; LPCWSTR
    , "Int", length   ; INT
    , "Ptr", family   ; GpFontFamily*
    , "Int", style   ; INT
    , "Float", emSize   ; FLOAT
    , "Ptr", layoutRect   ; Rect*
    , "Ptr", format   ; GpStringFormat*
    , "Int")   ; return: Status
●GdipAddPathStringI(path, string, length, family, style, emSize, layoutRect, format) = DLL("gdiplus.dll", "int GdipAddPathStringI(void*, char*, int, void*, int, float, void*, void*)")
# 呼び出し: GdipAddPathStringI(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 : Rect* -> "void*"
# format : GpStringFormat* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdiplus" fn GdipAddPathStringI(
    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]Rect, // Rect*
    format: [*c]GpStringFormat // GpStringFormat*
) callconv(std.os.windows.WINAPI) i32;
proc GdipAddPathStringI(
    path: ptr GpPath,  # GpPath* in/out
    string: WideCString,  # LPCWSTR
    length: int32,  # INT
    family: ptr GpFontFamily,  # GpFontFamily*
    style: int32,  # INT
    emSize: float32,  # FLOAT
    layoutRect: ptr Rect,  # Rect*
    format: ptr GpStringFormat  # GpStringFormat*
): int32 {.importc: "GdipAddPathStringI", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipAddPathStringI(
    GpPath* path,   // GpPath* in/out
    const(wchar)* string,   // LPCWSTR
    int length,   // INT
    GpFontFamily* family,   // GpFontFamily*
    int style,   // INT
    float emSize,   // FLOAT
    Rect* layoutRect,   // Rect*
    GpStringFormat* format   // GpStringFormat*
);
ccall((:GdipAddPathStringI, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpPath}, Cwstring, Int32, Ptr{GpFontFamily}, Int32, Float32, Ptr{Rect}, 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 : Rect* -> Ptr{Rect}
# format : GpStringFormat* -> Ptr{GpStringFormat}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipAddPathStringI(
    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.GdipAddPathStringI(path, string, length, family, style, emSize, layoutRect, format)
-- path : GpPath* in/out
-- string : LPCWSTR
-- length : INT
-- family : GpFontFamily*
-- style : INT
-- emSize : FLOAT
-- layoutRect : Rect*
-- format : GpStringFormat*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipAddPathStringI = lib.func('__stdcall', 'GdipAddPathStringI', 'int32_t', ['void *', 'str16', 'int32_t', 'void *', 'int32_t', 'float', 'void *', 'void *']);
// GdipAddPathStringI(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 : Rect* -> 'void *'
// format : GpStringFormat* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipAddPathStringI: { parameters: ["pointer", "buffer", "i32", "pointer", "i32", "f32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipAddPathStringI(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 : Rect* -> "pointer"
// format : GpStringFormat* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipAddPathStringI(
    void* path,
    const uint16_t* string,
    int32_t length,
    void* family,
    int32_t style,
    float emSize,
    void* layoutRect,
    void* format);
C, "gdiplus.dll");
// $ffi->GdipAddPathStringI(path, string, length, family, style, emSize, layoutRect, format);
// path : GpPath* in/out
// string : LPCWSTR
// length : INT
// family : GpFontFamily*
// style : INT
// emSize : FLOAT
// layoutRect : Rect*
// 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 GdipAddPathStringI(
        Pointer path,   // GpPath* in/out
        WString string,   // LPCWSTR
        int length,   // INT
        Pointer family,   // GpFontFamily*
        int style,   // INT
        float emSize,   // FLOAT
        Pointer layoutRect,   // Rect*
        Pointer format   // GpStringFormat*
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipAddPathStringI = GdipAddPathStringI(
    path : GpPath*,   # GpPath* in/out
    string : UInt16*,   # LPCWSTR
    length : Int32,   # INT
    family : GpFontFamily*,   # GpFontFamily*
    style : Int32,   # INT
    emSize : Float32,   # FLOAT
    layoutRect : Rect*,   # Rect*
    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 GdipAddPathStringINative = Int32 Function(Pointer<Void>, Pointer<Utf16>, Int32, Pointer<Void>, Int32, Float, Pointer<Void>, Pointer<Void>);
typedef GdipAddPathStringIDart = int Function(Pointer<Void>, Pointer<Utf16>, int, Pointer<Void>, int, double, Pointer<Void>, Pointer<Void>);
final GdipAddPathStringI = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipAddPathStringINative, GdipAddPathStringIDart>('GdipAddPathStringI');
// path : GpPath* in/out -> Pointer<Void>
// string : LPCWSTR -> Pointer<Utf16>
// length : INT -> Int32
// family : GpFontFamily* -> Pointer<Void>
// style : INT -> Int32
// emSize : FLOAT -> Float
// layoutRect : Rect* -> Pointer<Void>
// format : GpStringFormat* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipAddPathStringI(
  path: Pointer;   // GpPath* in/out
  string: PWideChar;   // LPCWSTR
  length: Integer;   // INT
  family: Pointer;   // GpFontFamily*
  style: Integer;   // INT
  emSize: Single;   // FLOAT
  layoutRect: Pointer;   // Rect*
  format: Pointer   // GpStringFormat*
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipAddPathStringI';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipAddPathStringI"
  c_GdipAddPathStringI :: 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 : Rect* -> Ptr ()
-- format : GpStringFormat* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipaddpathstringi =
  foreign "GdipAddPathStringI"
    ((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 : Rect* -> (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 ("GdipAddPathStringI" gdip-add-path-string-i :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)   ; Rect*
  (format :pointer))   ; GpStringFormat*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipAddPathStringI = Win32::API::More->new('gdiplus',
    'int GdipAddPathStringI(LPVOID path, LPCWSTR string, int length, LPVOID family, int style, float emSize, LPVOID layoutRect, LPVOID format)');
# my $ret = $GdipAddPathStringI->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 : Rect* -> LPVOID
# format : GpStringFormat* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型