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

GdipCreateSolidFill

関数
指定色の単色塗りつぶしブラシを作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCreateSolidFill(
    DWORD color,
    GpSolidFill** brush
);

パラメーター

名前方向
colorDWORDin
brushGpSolidFill**inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipCreateSolidFill = ctypes.windll.gdiplus.GdipCreateSolidFill
GdipCreateSolidFill.restype = ctypes.c_int
GdipCreateSolidFill.argtypes = [
    wintypes.DWORD,  # color : DWORD
    ctypes.c_void_p,  # brush : GpSolidFill** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCreateSolidFill = gdiplus.NewProc("GdipCreateSolidFill")
)

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