ホーム › Graphics.GdiPlus › GdipGetPathGradientBlend
GdipGetPathGradientBlend
関数パスグラデーションのブレンド係数と位置を取得する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipGetPathGradientBlend(
GpPathGradient* brush,
FLOAT* blend,
FLOAT* positions,
INT count
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| brush | GpPathGradient* | inout | 対象のパスグラデーションブラシへのポインタ。 |
| blend | FLOAT* | inout | ブレンド係数(0.0〜1.0)を受け取るFLOAT配列。 |
| positions | FLOAT* | inout | 各係数に対応する位置(0.0〜1.0)を受け取るFLOAT配列。 |
| count | INT | in | blend配列とpositions配列の要素数。 |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipGetPathGradientBlend(
GpPathGradient* brush,
FLOAT* blend,
FLOAT* positions,
INT count
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipGetPathGradientBlend(
IntPtr brush, // GpPathGradient* in/out
ref float blend, // FLOAT* in/out
ref float positions, // FLOAT* in/out
int count // INT
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipGetPathGradientBlend(
brush As IntPtr, ' GpPathGradient* in/out
ByRef blend As Single, ' FLOAT* in/out
ByRef positions As Single, ' FLOAT* in/out
count As Integer ' INT
) As Integer
End Function' brush : GpPathGradient* in/out
' blend : FLOAT* in/out
' positions : FLOAT* in/out
' count : INT
Declare PtrSafe Function GdipGetPathGradientBlend 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
GdipGetPathGradientBlend = ctypes.windll.gdiplus.GdipGetPathGradientBlend
GdipGetPathGradientBlend.restype = ctypes.c_int
GdipGetPathGradientBlend.argtypes = [
ctypes.c_void_p, # brush : GpPathGradient* in/out
ctypes.POINTER(ctypes.c_float), # blend : FLOAT* 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')
GdipGetPathGradientBlend = Fiddle::Function.new(
lib['GdipGetPathGradientBlend'],
[
Fiddle::TYPE_VOIDP, # brush : GpPathGradient* in/out
Fiddle::TYPE_VOIDP, # blend : FLOAT* in/out
Fiddle::TYPE_VOIDP, # positions : FLOAT* in/out
Fiddle::TYPE_INT, # count : INT
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipGetPathGradientBlend(
brush: *mut GpPathGradient, // GpPathGradient* in/out
blend: *mut f32, // FLOAT* 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 GdipGetPathGradientBlend(IntPtr brush, ref float blend, ref float positions, int count);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipGetPathGradientBlend' -Namespace Win32 -PassThru
# $api::GdipGetPathGradientBlend(brush, blend, positions, count)#uselib "gdiplus.dll"
#func global GdipGetPathGradientBlend "GdipGetPathGradientBlend" sptr, sptr, sptr, sptr
; GdipGetPathGradientBlend varptr(brush), varptr(blend), varptr(positions), count ; 戻り値は stat
; brush : GpPathGradient* in/out -> "sptr"
; blend : FLOAT* in/out -> "sptr"
; positions : FLOAT* in/out -> "sptr"
; count : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipGetPathGradientBlend "GdipGetPathGradientBlend" var, var, var, int ; res = GdipGetPathGradientBlend(brush, blend, positions, count) ; brush : GpPathGradient* in/out -> "var" ; blend : FLOAT* in/out -> "var" ; positions : FLOAT* in/out -> "var" ; count : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipGetPathGradientBlend "GdipGetPathGradientBlend" sptr, sptr, sptr, int ; res = GdipGetPathGradientBlend(varptr(brush), varptr(blend), varptr(positions), count) ; brush : GpPathGradient* in/out -> "sptr" ; blend : FLOAT* in/out -> "sptr" ; positions : FLOAT* in/out -> "sptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipGetPathGradientBlend(GpPathGradient* brush, FLOAT* blend, FLOAT* positions, INT count) #uselib "gdiplus.dll" #cfunc global GdipGetPathGradientBlend "GdipGetPathGradientBlend" var, var, var, int ; res = GdipGetPathGradientBlend(brush, blend, positions, count) ; brush : GpPathGradient* in/out -> "var" ; blend : FLOAT* in/out -> "var" ; positions : FLOAT* in/out -> "var" ; count : INT -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipGetPathGradientBlend(GpPathGradient* brush, FLOAT* blend, FLOAT* positions, INT count) #uselib "gdiplus.dll" #cfunc global GdipGetPathGradientBlend "GdipGetPathGradientBlend" intptr, intptr, intptr, int ; res = GdipGetPathGradientBlend(varptr(brush), varptr(blend), varptr(positions), count) ; brush : GpPathGradient* in/out -> "intptr" ; blend : FLOAT* in/out -> "intptr" ; positions : FLOAT* in/out -> "intptr" ; count : INT -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipGetPathGradientBlend = gdiplus.NewProc("GdipGetPathGradientBlend")
)
// brush (GpPathGradient* in/out), blend (FLOAT* in/out), positions (FLOAT* in/out), count (INT)
r1, _, err := procGdipGetPathGradientBlend.Call(
uintptr(brush),
uintptr(blend),
uintptr(positions),
uintptr(count),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Statusfunction GdipGetPathGradientBlend(
brush: Pointer; // GpPathGradient* in/out
blend: Pointer; // FLOAT* in/out
positions: Pointer; // FLOAT* in/out
count: Integer // INT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipGetPathGradientBlend';result := DllCall("gdiplus\GdipGetPathGradientBlend"
, "Ptr", brush ; GpPathGradient* in/out
, "Ptr", blend ; FLOAT* in/out
, "Ptr", positions ; FLOAT* in/out
, "Int", count ; INT
, "Int") ; return: Status●GdipGetPathGradientBlend(brush, blend, positions, count) = DLL("gdiplus.dll", "int GdipGetPathGradientBlend(void*, void*, void*, int)")
# 呼び出し: GdipGetPathGradientBlend(brush, blend, positions, count)
# brush : GpPathGradient* in/out -> "void*"
# blend : FLOAT* in/out -> "void*"
# positions : FLOAT* in/out -> "void*"
# count : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdiplus" fn GdipGetPathGradientBlend(
brush: [*c]GpPathGradient, // GpPathGradient* in/out
blend: [*c]f32, // FLOAT* in/out
positions: [*c]f32, // FLOAT* in/out
count: i32 // INT
) callconv(std.os.windows.WINAPI) i32;proc GdipGetPathGradientBlend(
brush: ptr GpPathGradient, # GpPathGradient* in/out
blend: ptr float32, # FLOAT* in/out
positions: ptr float32, # FLOAT* in/out
count: int32 # INT
): int32 {.importc: "GdipGetPathGradientBlend", stdcall, dynlib: "gdiplus.dll".}pragma(lib, "gdiplus");
extern(Windows)
int GdipGetPathGradientBlend(
GpPathGradient* brush, // GpPathGradient* in/out
float* blend, // FLOAT* in/out
float* positions, // FLOAT* in/out
int count // INT
);ccall((:GdipGetPathGradientBlend, "gdiplus.dll"), stdcall, Int32,
(Ptr{GpPathGradient}, Ptr{Float32}, Ptr{Float32}, Int32),
brush, blend, positions, count)
# brush : GpPathGradient* in/out -> Ptr{GpPathGradient}
# blend : FLOAT* in/out -> Ptr{Float32}
# positions : FLOAT* in/out -> Ptr{Float32}
# count : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GdipGetPathGradientBlend(
void* brush,
float* blend,
float* positions,
int32_t count);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipGetPathGradientBlend(brush, blend, positions, count)
-- brush : GpPathGradient* in/out
-- blend : FLOAT* in/out
-- positions : FLOAT* in/out
-- count : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipGetPathGradientBlend = lib.func('__stdcall', 'GdipGetPathGradientBlend', 'int32_t', ['void *', 'float *', 'float *', 'int32_t']);
// GdipGetPathGradientBlend(brush, blend, positions, count)
// brush : GpPathGradient* in/out -> 'void *'
// blend : FLOAT* in/out -> 'float *'
// positions : FLOAT* in/out -> 'float *'
// count : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("gdiplus.dll", {
GdipGetPathGradientBlend: { parameters: ["pointer", "pointer", "pointer", "i32"], result: "i32" },
});
// lib.symbols.GdipGetPathGradientBlend(brush, blend, positions, count)
// brush : GpPathGradient* in/out -> "pointer"
// blend : FLOAT* in/out -> "pointer"
// positions : FLOAT* in/out -> "pointer"
// count : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GdipGetPathGradientBlend(
void* brush,
float* blend,
float* positions,
int32_t count);
C, "gdiplus.dll");
// $ffi->GdipGetPathGradientBlend(brush, blend, positions, count);
// brush : GpPathGradient* in/out
// blend : FLOAT* in/out
// positions : FLOAT* in/out
// 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 GdipGetPathGradientBlend(
Pointer brush, // GpPathGradient* in/out
FloatByReference blend, // FLOAT* in/out
FloatByReference positions, // FLOAT* in/out
int count // INT
);
}@[Link("gdiplus")]
lib Libgdiplus
fun GdipGetPathGradientBlend = GdipGetPathGradientBlend(
brush : GpPathGradient*, # GpPathGradient* in/out
blend : Float32*, # FLOAT* in/out
positions : Float32*, # FLOAT* in/out
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 GdipGetPathGradientBlendNative = Int32 Function(Pointer<Void>, Pointer<Float>, Pointer<Float>, Int32);
typedef GdipGetPathGradientBlendDart = int Function(Pointer<Void>, Pointer<Float>, Pointer<Float>, int);
final GdipGetPathGradientBlend = DynamicLibrary.open('gdiplus.dll')
.lookupFunction<GdipGetPathGradientBlendNative, GdipGetPathGradientBlendDart>('GdipGetPathGradientBlend');
// brush : GpPathGradient* in/out -> Pointer<Void>
// blend : FLOAT* in/out -> Pointer<Float>
// positions : FLOAT* in/out -> Pointer<Float>
// count : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GdipGetPathGradientBlend(
brush: Pointer; // GpPathGradient* in/out
blend: Pointer; // FLOAT* in/out
positions: Pointer; // FLOAT* in/out
count: Integer // INT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipGetPathGradientBlend';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GdipGetPathGradientBlend"
c_GdipGetPathGradientBlend :: Ptr () -> Ptr CFloat -> Ptr CFloat -> Int32 -> IO Int32
-- brush : GpPathGradient* in/out -> Ptr ()
-- blend : FLOAT* in/out -> Ptr CFloat
-- positions : FLOAT* in/out -> Ptr CFloat
-- count : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gdipgetpathgradientblend =
foreign "GdipGetPathGradientBlend"
((ptr void) @-> (ptr float) @-> (ptr float) @-> int32_t @-> returning int32_t)
(* brush : GpPathGradient* in/out -> (ptr void) *)
(* blend : FLOAT* in/out -> (ptr float) *)
(* positions : FLOAT* in/out -> (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 ("GdipGetPathGradientBlend" gdip-get-path-gradient-blend :convention :stdcall) :int32
(brush :pointer) ; GpPathGradient* in/out
(blend :pointer) ; FLOAT* in/out
(positions :pointer) ; FLOAT* in/out
(count :int32)) ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GdipGetPathGradientBlend = Win32::API::More->new('gdiplus',
'int GdipGetPathGradientBlend(LPVOID brush, LPVOID blend, LPVOID positions, int count)');
# my $ret = $GdipGetPathGradientBlend->Call($brush, $blend, $positions, $count);
# brush : GpPathGradient* in/out -> LPVOID
# blend : FLOAT* in/out -> LPVOID
# positions : FLOAT* in/out -> LPVOID
# count : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。