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

GdipFillRegion

関数
指定ブラシでリージョンの内部を塗りつぶす。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipFillRegion(
    GpGraphics* graphics,
    GpBrush* brush,
    GpRegion* region
);

パラメーター

名前方向
graphicsGpGraphics*inout
brushGpBrush*inout
regionGpRegion*inout

戻り値の型: Status

各言語での呼び出し定義

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

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

GdipFillRegion = ctypes.windll.gdiplus.GdipFillRegion
GdipFillRegion.restype = ctypes.c_int
GdipFillRegion.argtypes = [
    ctypes.c_void_p,  # graphics : GpGraphics* in/out
    ctypes.c_void_p,  # brush : GpBrush* in/out
    ctypes.c_void_p,  # region : GpRegion* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipFillRegion = gdiplus.NewProc("GdipFillRegion")
)

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