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

GdipGetLinePresetBlend

関数
線形グラデーションのプリセット配色と位置を取得する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipGetLinePresetBlend(
    GpLineGradient* brush,
    DWORD* blend,
    FLOAT* positions,
    INT count
);

パラメーター

名前方向
brushGpLineGradient*inout
blendDWORD*inout
positionsFLOAT*inout
countINTin

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipGetLinePresetBlend(
    GpLineGradient* brush,
    DWORD* blend,
    FLOAT* positions,
    INT count
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetLinePresetBlend(
    IntPtr brush,   // GpLineGradient* in/out
    ref uint blend,   // DWORD* in/out
    ref float positions,   // FLOAT* in/out
    int count   // INT
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetLinePresetBlend(
    brush As IntPtr,   ' GpLineGradient* in/out
    ByRef blend As UInteger,   ' DWORD* in/out
    ByRef positions As Single,   ' FLOAT* in/out
    count As Integer   ' INT
) As Integer
End Function
' brush : GpLineGradient* in/out
' blend : DWORD* in/out
' positions : FLOAT* in/out
' count : INT
Declare PtrSafe Function GdipGetLinePresetBlend Lib "gdiplus" ( _
    ByVal brush As LongPtr, _
    ByRef blend As Long, _
    ByRef positions As Single, _
    ByVal count As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GdipGetLinePresetBlend = ctypes.windll.gdiplus.GdipGetLinePresetBlend
GdipGetLinePresetBlend.restype = ctypes.c_int
GdipGetLinePresetBlend.argtypes = [
    ctypes.c_void_p,  # brush : GpLineGradient* in/out
    ctypes.POINTER(wintypes.DWORD),  # blend : DWORD* in/out
    ctypes.POINTER(ctypes.c_float),  # positions : FLOAT* in/out
    ctypes.c_int,  # count : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipGetLinePresetBlend = gdiplus.NewProc("GdipGetLinePresetBlend")
)

// brush (GpLineGradient* in/out), blend (DWORD* in/out), positions (FLOAT* in/out), count (INT)
r1, _, err := procGdipGetLinePresetBlend.Call(
	uintptr(brush),
	uintptr(blend),
	uintptr(positions),
	uintptr(count),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // Status
function GdipGetLinePresetBlend(
  brush: Pointer;   // GpLineGradient* in/out
  blend: Pointer;   // DWORD* in/out
  positions: Pointer;   // FLOAT* in/out
  count: Integer   // INT
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipGetLinePresetBlend';
result := DllCall("gdiplus\GdipGetLinePresetBlend"
    , "Ptr", brush   ; GpLineGradient* in/out
    , "Ptr", blend   ; DWORD* in/out
    , "Ptr", positions   ; FLOAT* in/out
    , "Int", count   ; INT
    , "Int")   ; return: Status
●GdipGetLinePresetBlend(brush, blend, positions, count) = DLL("gdiplus.dll", "int GdipGetLinePresetBlend(void*, void*, void*, int)")
# 呼び出し: GdipGetLinePresetBlend(brush, blend, positions, count)
# brush : GpLineGradient* in/out -> "void*"
# blend : DWORD* in/out -> "void*"
# positions : FLOAT* in/out -> "void*"
# count : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。