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

GdipSetLineBlend

関数
線形グラデーションのブレンド係数と位置を設定する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipSetLineBlend(
    GpLineGradient* brush,
    const FLOAT* blend,
    const FLOAT* positions,
    INT count
);

パラメーター

名前方向
brushGpLineGradient*inout
blendFLOAT*in
positionsFLOAT*in
countINTin

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipSetLineBlend(
    GpLineGradient* brush,
    const FLOAT* blend,
    const FLOAT* positions,
    INT count
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipSetLineBlend(
    IntPtr brush,   // GpLineGradient* in/out
    ref float blend,   // FLOAT*
    ref float positions,   // FLOAT*
    int count   // INT
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipSetLineBlend(
    brush As IntPtr,   ' GpLineGradient* in/out
    ByRef blend As Single,   ' FLOAT*
    ByRef positions As Single,   ' FLOAT*
    count As Integer   ' INT
) As Integer
End Function
' brush : GpLineGradient* in/out
' blend : FLOAT*
' positions : FLOAT*
' count : INT
Declare PtrSafe Function GdipSetLineBlend Lib "gdiplus" ( _
    ByVal brush As LongPtr, _
    ByRef blend As Single, _
    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

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

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipSetLineBlend = gdiplus.NewProc("GdipSetLineBlend")
)

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