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

GdipWidenPath

関数
ペン幅を反映してGDI+のパスを縁取り形状に拡張する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipWidenPath(
    GpPath* nativePath,
    GpPen* pen,
    Matrix* matrix,
    FLOAT flatness
);

パラメーター

名前方向説明
nativePathGpPath*inoutペン幅で太らせる対象のパスオブジェクトへのポインタ。
penGpPen*inout太らせる幅や形状を決めるGpPenへのポインタ。
matrixMatrix*inout処理前に適用する変換行列へのポインタ。NULLで変換なし。
flatnessFLOATin曲線近似の許容誤差(FLOAT)。小さいほど近似精度が高くなる。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipWidenPath(
    GpPath* nativePath,
    GpPen* pen,
    Matrix* matrix,
    FLOAT flatness
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipWidenPath(
    IntPtr nativePath,   // GpPath* in/out
    IntPtr pen,   // GpPen* in/out
    ref IntPtr matrix,   // Matrix* in/out
    float flatness   // FLOAT
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipWidenPath(
    nativePath As IntPtr,   ' GpPath* in/out
    pen As IntPtr,   ' GpPen* in/out
    ByRef matrix As IntPtr,   ' Matrix* in/out
    flatness As Single   ' FLOAT
) As Integer
End Function
' nativePath : GpPath* in/out
' pen : GpPen* in/out
' matrix : Matrix* in/out
' flatness : FLOAT
Declare PtrSafe Function GdipWidenPath Lib "gdiplus" ( _
    ByVal nativePath As LongPtr, _
    ByVal pen As LongPtr, _
    ByRef matrix As LongPtr, _
    ByVal flatness As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipWidenPath = ctypes.windll.gdiplus.GdipWidenPath
GdipWidenPath.restype = ctypes.c_int
GdipWidenPath.argtypes = [
    ctypes.c_void_p,  # nativePath : GpPath* in/out
    ctypes.c_void_p,  # pen : GpPen* in/out
    ctypes.c_void_p,  # matrix : Matrix* in/out
    ctypes.c_float,  # flatness : FLOAT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('gdiplus.dll')
GdipWidenPath = Fiddle::Function.new(
  lib['GdipWidenPath'],
  [
    Fiddle::TYPE_VOIDP,  # nativePath : GpPath* in/out
    Fiddle::TYPE_VOIDP,  # pen : GpPen* in/out
    Fiddle::TYPE_VOIDP,  # matrix : Matrix* in/out
    Fiddle::TYPE_FLOAT,  # flatness : FLOAT
  ],
  Fiddle::TYPE_INT)
#[link(name = "gdiplus")]
extern "system" {
    fn GdipWidenPath(
        nativePath: *mut GpPath,  // GpPath* in/out
        pen: *mut GpPen,  // GpPen* in/out
        matrix: *mut isize,  // Matrix* in/out
        flatness: f32  // FLOAT
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipWidenPath(IntPtr nativePath, IntPtr pen, ref IntPtr matrix, float flatness);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipWidenPath' -Namespace Win32 -PassThru
# $api::GdipWidenPath(nativePath, pen, matrix, flatness)
#uselib "gdiplus.dll"
#func global GdipWidenPath "GdipWidenPath" sptr, sptr, sptr, float
; GdipWidenPath varptr(nativePath), varptr(pen), varptr(matrix), flatness   ; 戻り値は stat
; nativePath : GpPath* in/out -> "sptr"
; pen : GpPen* in/out -> "sptr"
; matrix : Matrix* in/out -> "sptr"
; flatness : FLOAT -> "float"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "gdiplus.dll"
#cfunc global GdipWidenPath "GdipWidenPath" var, var, var, float
; res = GdipWidenPath(nativePath, pen, matrix, flatness)
; nativePath : GpPath* in/out -> "var"
; pen : GpPen* in/out -> "var"
; matrix : Matrix* in/out -> "var"
; flatness : FLOAT -> "float"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; Status GdipWidenPath(GpPath* nativePath, GpPen* pen, Matrix* matrix, FLOAT flatness)
#uselib "gdiplus.dll"
#cfunc global GdipWidenPath "GdipWidenPath" var, var, var, float
; res = GdipWidenPath(nativePath, pen, matrix, flatness)
; nativePath : GpPath* in/out -> "var"
; pen : GpPen* in/out -> "var"
; matrix : Matrix* in/out -> "var"
; flatness : FLOAT -> "float"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"math"
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipWidenPath = gdiplus.NewProc("GdipWidenPath")
)

// nativePath (GpPath* in/out), pen (GpPen* in/out), matrix (Matrix* in/out), flatness (FLOAT)
r1, _, err := procGdipWidenPath.Call(
	uintptr(nativePath),
	uintptr(pen),
	uintptr(matrix),
	uintptr(math.Float32bits(flatness)),
)
_ = 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 GdipWidenPath(
  nativePath: Pointer;   // GpPath* in/out
  pen: Pointer;   // GpPen* in/out
  matrix: Pointer;   // Matrix* in/out
  flatness: Single   // FLOAT
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipWidenPath';
result := DllCall("gdiplus\GdipWidenPath"
    , "Ptr", nativePath   ; GpPath* in/out
    , "Ptr", pen   ; GpPen* in/out
    , "Ptr", matrix   ; Matrix* in/out
    , "Float", flatness   ; FLOAT
    , "Int")   ; return: Status
●GdipWidenPath(nativePath, pen, matrix, flatness) = DLL("gdiplus.dll", "int GdipWidenPath(void*, void*, void*, float)")
# 呼び出し: GdipWidenPath(nativePath, pen, matrix, flatness)
# nativePath : GpPath* in/out -> "void*"
# pen : GpPen* in/out -> "void*"
# matrix : Matrix* in/out -> "void*"
# flatness : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "gdiplus" fn GdipWidenPath(
    nativePath: [*c]GpPath, // GpPath* in/out
    pen: [*c]GpPen, // GpPen* in/out
    matrix: [*c]isize, // Matrix* in/out
    flatness: f32 // FLOAT
) callconv(std.os.windows.WINAPI) i32;
proc GdipWidenPath(
    nativePath: ptr GpPath,  # GpPath* in/out
    pen: ptr GpPen,  # GpPen* in/out
    matrix: ptr int,  # Matrix* in/out
    flatness: float32  # FLOAT
): int32 {.importc: "GdipWidenPath", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipWidenPath(
    GpPath* nativePath,   // GpPath* in/out
    GpPen* pen,   // GpPen* in/out
    ptrdiff_t* matrix,   // Matrix* in/out
    float flatness   // FLOAT
);
ccall((:GdipWidenPath, "gdiplus.dll"), stdcall, Int32,
      (Ptr{GpPath}, Ptr{GpPen}, Ptr{Int}, Float32),
      nativePath, pen, matrix, flatness)
# nativePath : GpPath* in/out -> Ptr{GpPath}
# pen : GpPen* in/out -> Ptr{GpPen}
# matrix : Matrix* in/out -> Ptr{Int}
# flatness : FLOAT -> Float32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipWidenPath(
    void* nativePath,
    void* pen,
    intptr_t* matrix,
    float flatness);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipWidenPath(nativePath, pen, matrix, flatness)
-- nativePath : GpPath* in/out
-- pen : GpPen* in/out
-- matrix : Matrix* in/out
-- flatness : FLOAT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipWidenPath = lib.func('__stdcall', 'GdipWidenPath', 'int32_t', ['void *', 'void *', 'intptr_t *', 'float']);
// GdipWidenPath(nativePath, pen, matrix, flatness)
// nativePath : GpPath* in/out -> 'void *'
// pen : GpPen* in/out -> 'void *'
// matrix : Matrix* in/out -> 'intptr_t *'
// flatness : FLOAT -> 'float'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipWidenPath: { parameters: ["pointer", "pointer", "pointer", "f32"], result: "i32" },
});
// lib.symbols.GdipWidenPath(nativePath, pen, matrix, flatness)
// nativePath : GpPath* in/out -> "pointer"
// pen : GpPen* in/out -> "pointer"
// matrix : Matrix* in/out -> "pointer"
// flatness : FLOAT -> "f32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipWidenPath(
    void* nativePath,
    void* pen,
    intptr_t* matrix,
    float flatness);
C, "gdiplus.dll");
// $ffi->GdipWidenPath(nativePath, pen, matrix, flatness);
// nativePath : GpPath* in/out
// pen : GpPen* in/out
// matrix : Matrix* in/out
// flatness : FLOAT
// 構造体/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 GdipWidenPath(
        Pointer nativePath,   // GpPath* in/out
        Pointer pen,   // GpPen* in/out
        LongByReference matrix,   // Matrix* in/out
        float flatness   // FLOAT
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipWidenPath = GdipWidenPath(
    nativePath : GpPath*,   # GpPath* in/out
    pen : GpPen*,   # GpPen* in/out
    matrix : LibC::SSizeT*,   # Matrix* in/out
    flatness : Float32   # FLOAT
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GdipWidenPathNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, Float);
typedef GdipWidenPathDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<IntPtr>, double);
final GdipWidenPath = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipWidenPathNative, GdipWidenPathDart>('GdipWidenPath');
// nativePath : GpPath* in/out -> Pointer<Void>
// pen : GpPen* in/out -> Pointer<Void>
// matrix : Matrix* in/out -> Pointer<IntPtr>
// flatness : FLOAT -> Float
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipWidenPath(
  nativePath: Pointer;   // GpPath* in/out
  pen: Pointer;   // GpPen* in/out
  matrix: Pointer;   // Matrix* in/out
  flatness: Single   // FLOAT
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipWidenPath';
import Foreign
import Foreign.C.Types
import Foreign.C.String

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

let gdipwidenpath =
  foreign "GdipWidenPath"
    ((ptr void) @-> (ptr void) @-> (ptr intptr_t) @-> float @-> returning int32_t)
(* nativePath : GpPath* in/out -> (ptr void) *)
(* pen : GpPen* in/out -> (ptr void) *)
(* matrix : Matrix* in/out -> (ptr intptr_t) *)
(* flatness : FLOAT -> float *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipWidenPath" gdip-widen-path :convention :stdcall) :int32
  (native-path :pointer)   ; GpPath* in/out
  (pen :pointer)   ; GpPen* in/out
  (matrix :pointer)   ; Matrix* in/out
  (flatness :float))   ; FLOAT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipWidenPath = Win32::API::More->new('gdiplus',
    'int GdipWidenPath(LPVOID nativePath, LPVOID pen, LPVOID matrix, float flatness)');
# my $ret = $GdipWidenPath->Call($nativePath, $pen, $matrix, $flatness);
# nativePath : GpPath* in/out -> LPVOID
# pen : GpPen* in/out -> LPVOID
# matrix : Matrix* in/out -> LPVOID
# flatness : FLOAT -> float
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型