ホーム › Graphics.GdiPlus › GdipSetLineBlend
GdipSetLineBlend
関数線形グラデーションのブレンド係数と位置を設定する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipSetLineBlend(
GpLineGradient* brush,
const FLOAT* blend,
const FLOAT* positions,
INT count
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| brush | GpLineGradient* | inout | 対象の線形グラデーションブラシへのポインタ。 |
| blend | FLOAT* | in | 各位置のブレンド係数を指定するFLOAT配列へのポインタ。 |
| positions | FLOAT* | in | 0〜1の相対位置を指定するFLOAT配列へのポインタ。両端0と1が必要。 |
| count | INT | in | 配列の要素数を指定する。 |
戻り値の型: 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 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipSetLineBlend "GdipSetLineBlend" sptr, sptr, sptr, int ; res = GdipSetLineBlend(varptr(brush), varptr(blend), varptr(positions), count) ; brush : GpLineGradient* in/out -> "sptr" ; blend : FLOAT* -> "sptr" ; positions : FLOAT* -> "sptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは 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 方式にも切替可。; Status GdipSetLineBlend(GpLineGradient* brush, FLOAT* blend, FLOAT* positions, INT count) #uselib "gdiplus.dll" #cfunc global GdipSetLineBlend "GdipSetLineBlend" intptr, intptr, intptr, int ; res = GdipSetLineBlend(varptr(brush), varptr(blend), varptr(positions), count) ; brush : GpLineGradient* in/out -> "intptr" ; blend : FLOAT* -> "intptr" ; positions : FLOAT* -> "intptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは 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 // Statusfunction 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)。const std = @import("std");
extern "gdiplus" fn GdipSetLineBlend(
brush: [*c]GpLineGradient, // GpLineGradient* in/out
blend: [*c]f32, // FLOAT*
positions: [*c]f32, // FLOAT*
count: i32 // INT
) callconv(std.os.windows.WINAPI) i32;proc GdipSetLineBlend(
brush: ptr GpLineGradient, # GpLineGradient* in/out
blend: ptr float32, # FLOAT*
positions: ptr float32, # FLOAT*
count: int32 # INT
): int32 {.importc: "GdipSetLineBlend", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipSetLineBlend(
GpLineGradient* brush, // GpLineGradient* in/out
float* blend, // FLOAT*
float* positions, // FLOAT*
int count // INT
);ccall((:GdipSetLineBlend, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpLineGradient}, Ptr{Float32}, Ptr{Float32}, Int32),
brush, blend, positions, count)
# brush : GpLineGradient* in/out -> Ptr{GpLineGradient}
# blend : FLOAT* -> Ptr{Float32}
# positions : FLOAT* -> Ptr{Float32}
# count : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipSetLineBlend(
void* brush,
float* blend,
float* positions,
int32_t count);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipSetLineBlend(brush, blend, positions, count)
-- brush : GpLineGradient* in/out
-- blend : FLOAT*
-- positions : FLOAT*
-- count : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipSetLineBlend = lib.func('__stdcall', 'GdipSetLineBlend', 'int32_t', ['void *', 'float *', 'float *', 'int32_t']);
// GdipSetLineBlend(brush, blend, positions, count)
// brush : GpLineGradient* in/out -> 'void *'
// blend : FLOAT* -> 'float *'
// positions : FLOAT* -> 'float *'
// count : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipSetLineBlend: { parameters: ["pointer", "pointer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.GdipSetLineBlend(brush, blend, positions, count)
// brush : GpLineGradient* in/out -> "pointer"
// blend : FLOAT* -> "pointer"
// positions : FLOAT* -> "pointer"
// count : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipSetLineBlend(
void* brush,
float* blend,
float* positions,
int32_t count);
C, "gdiplus.dll");
// $ffi->GdipSetLineBlend(brush, blend, positions, count);
// brush : GpLineGradient* in/out
// blend : FLOAT*
// positions : FLOAT*
// count : INT
// 構造体/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 GdipSetLineBlend(
Pointer brush, // GpLineGradient* in/out
FloatByReference blend, // FLOAT*
FloatByReference positions, // FLOAT*
int count // INT
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipSetLineBlend = GdipSetLineBlend(
brush : GpLineGradient*, # GpLineGradient* in/out
blend : Float32*, # FLOAT*
positions : Float32*, # FLOAT*
count : Int32 # INT
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GdipSetLineBlendNative = Int32 Function(Pointer<Void>, Pointer<Float>, Pointer<Float>, Int32);
typedef GdipSetLineBlendDart = int Function(Pointer<Void>, Pointer<Float>, Pointer<Float>, int);
final GdipSetLineBlend = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipSetLineBlendNative, GdipSetLineBlendDart>('GdipSetLineBlend');
// brush : GpLineGradient* in/out -> Pointer<Void>
// blend : FLOAT* -> Pointer<Float>
// positions : FLOAT* -> Pointer<Float>
// count : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipSetLineBlend(
brush: Pointer; // GpLineGradient* in/out
blend: Pointer; // FLOAT*
positions: Pointer; // FLOAT*
count: Integer // INT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipSetLineBlend';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipSetLineBlend"
c_GdipSetLineBlend :: Ptr () -> Ptr CFloat -> Ptr CFloat -> Int32 -> IO Int32
-- brush : GpLineGradient* in/out -> Ptr ()
-- blend : FLOAT* -> Ptr CFloat
-- positions : FLOAT* -> Ptr CFloat
-- count : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipsetlineblend =
foreign "GdipSetLineBlend"
((ptr void) @-> (ptr float) @-> (ptr float) @-> int32_t @-> returning int32_t)
(* brush : GpLineGradient* in/out -> (ptr void) *)
(* blend : FLOAT* -> (ptr float) *)
(* positions : FLOAT* -> (ptr float) *)
(* count : INT -> int32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)
(cffi:defcfun ("GdipSetLineBlend" gdip-set-line-blend :convention :stdcall) :int32
(brush :pointer) ; GpLineGradient* in/out
(blend :pointer) ; FLOAT*
(positions :pointer) ; FLOAT*
(count :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipSetLineBlend = Win32::API::More->new('gdiplus',
'int GdipSetLineBlend(LPVOID brush, LPVOID blend, LPVOID positions, int count)');
# my $ret = $GdipSetLineBlend->Call($brush, $blend, $positions, $count);
# brush : GpLineGradient* in/out -> LPVOID
# blend : FLOAT* -> LPVOID
# positions : FLOAT* -> LPVOID
# count : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。