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

GdipCreateCustomLineCap

関数
塗り用と輪郭用のパスからカスタム端点キャップを作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCreateCustomLineCap(
    GpPath* fillPath,
    GpPath* strokePath,
    LineCap baseCap,
    FLOAT baseInset,
    GpCustomLineCap** customCap
);

パラメーター

名前方向
fillPathGpPath*inout
strokePathGpPath*inout
baseCapLineCapin
baseInsetFLOATin
customCapGpCustomLineCap**inout

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipCreateCustomLineCap(
    GpPath* fillPath,
    GpPath* strokePath,
    LineCap baseCap,
    FLOAT baseInset,
    GpCustomLineCap** customCap
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCreateCustomLineCap(
    IntPtr fillPath,   // GpPath* in/out
    IntPtr strokePath,   // GpPath* in/out
    int baseCap,   // LineCap
    float baseInset,   // FLOAT
    IntPtr customCap   // GpCustomLineCap** in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCreateCustomLineCap(
    fillPath As IntPtr,   ' GpPath* in/out
    strokePath As IntPtr,   ' GpPath* in/out
    baseCap As Integer,   ' LineCap
    baseInset As Single,   ' FLOAT
    customCap As IntPtr   ' GpCustomLineCap** in/out
) As Integer
End Function
' fillPath : GpPath* in/out
' strokePath : GpPath* in/out
' baseCap : LineCap
' baseInset : FLOAT
' customCap : GpCustomLineCap** in/out
Declare PtrSafe Function GdipCreateCustomLineCap Lib "gdiplus" ( _
    ByVal fillPath As LongPtr, _
    ByVal strokePath As LongPtr, _
    ByVal baseCap As Long, _
    ByVal baseInset As Single, _
    ByVal customCap As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipCreateCustomLineCap = ctypes.windll.gdiplus.GdipCreateCustomLineCap
GdipCreateCustomLineCap.restype = ctypes.c_int
GdipCreateCustomLineCap.argtypes = [
    ctypes.c_void_p,  # fillPath : GpPath* in/out
    ctypes.c_void_p,  # strokePath : GpPath* in/out
    ctypes.c_int,  # baseCap : LineCap
    ctypes.c_float,  # baseInset : FLOAT
    ctypes.c_void_p,  # customCap : GpCustomLineCap** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCreateCustomLineCap = gdiplus.NewProc("GdipCreateCustomLineCap")
)

// fillPath (GpPath* in/out), strokePath (GpPath* in/out), baseCap (LineCap), baseInset (FLOAT), customCap (GpCustomLineCap** in/out)
r1, _, err := procGdipCreateCustomLineCap.Call(
	uintptr(fillPath),
	uintptr(strokePath),
	uintptr(baseCap),
	uintptr(math.Float32bits(baseInset)),
	uintptr(customCap),
)
_ = 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 GdipCreateCustomLineCap(
  fillPath: Pointer;   // GpPath* in/out
  strokePath: Pointer;   // GpPath* in/out
  baseCap: Integer;   // LineCap
  baseInset: Single;   // FLOAT
  customCap: Pointer   // GpCustomLineCap** in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipCreateCustomLineCap';
result := DllCall("gdiplus\GdipCreateCustomLineCap"
    , "Ptr", fillPath   ; GpPath* in/out
    , "Ptr", strokePath   ; GpPath* in/out
    , "Int", baseCap   ; LineCap
    , "Float", baseInset   ; FLOAT
    , "Ptr", customCap   ; GpCustomLineCap** in/out
    , "Int")   ; return: Status
●GdipCreateCustomLineCap(fillPath, strokePath, baseCap, baseInset, customCap) = DLL("gdiplus.dll", "int GdipCreateCustomLineCap(void*, void*, int, float, void*)")
# 呼び出し: GdipCreateCustomLineCap(fillPath, strokePath, baseCap, baseInset, customCap)
# fillPath : GpPath* in/out -> "void*"
# strokePath : GpPath* in/out -> "void*"
# baseCap : LineCap -> "int"
# baseInset : FLOAT -> "float"
# customCap : GpCustomLineCap** in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。