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

GdipCreateRegionRectI

関数
整数座標の矩形からリージョンを作成する。
DLLgdiplus.dll呼出規約winapi

シグネチャ

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

Status GdipCreateRegionRectI(
    const Rect* rect,
    GpRegion** region
);

パラメーター

名前方向説明
rectRect*inリージョンの範囲となる矩形(整数)へのポインタ。
regionGpRegion**inout生成された矩形リージョンを受け取るポインタのアドレス。

戻り値の型: Status

各言語での呼び出し定義

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

Status GdipCreateRegionRectI(
    const Rect* rect,
    GpRegion** region
);
[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipCreateRegionRectI(
    IntPtr rect,   // Rect*
    IntPtr region   // GpRegion** in/out
);
<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipCreateRegionRectI(
    rect As IntPtr,   ' Rect*
    region As IntPtr   ' GpRegion** in/out
) As Integer
End Function
' rect : Rect*
' region : GpRegion** in/out
Declare PtrSafe Function GdipCreateRegionRectI Lib "gdiplus" ( _
    ByVal rect 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

GdipCreateRegionRectI = ctypes.windll.gdiplus.GdipCreateRegionRectI
GdipCreateRegionRectI.restype = ctypes.c_int
GdipCreateRegionRectI.argtypes = [
    ctypes.c_void_p,  # rect : Rect*
    ctypes.c_void_p,  # region : GpRegion** in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
	procGdipCreateRegionRectI = gdiplus.NewProc("GdipCreateRegionRectI")
)

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

extern "gdiplus" fn GdipCreateRegionRectI(
    rect: [*c]Rect, // Rect*
    region: [*c][*c]GpRegion // GpRegion** in/out
) callconv(std.os.windows.WINAPI) i32;
proc GdipCreateRegionRectI(
    rect: ptr Rect,  # Rect*
    region: ptr GpRegion  # GpRegion** in/out
): int32 {.importc: "GdipCreateRegionRectI", stdcall, dynlib: "gdiplus.dll".}
pragma(lib, "gdiplus");
extern(Windows)
int GdipCreateRegionRectI(
    Rect* rect,   // Rect*
    GpRegion** region   // GpRegion** in/out
);
ccall((:GdipCreateRegionRectI, "gdiplus.dll"), stdcall, Int32,
      (Ptr{Rect}, Ptr{GpRegion}),
      rect, region)
# rect : Rect* -> Ptr{Rect}
# region : GpRegion** in/out -> Ptr{GpRegion}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GdipCreateRegionRectI(
    void* rect,
    void* region);
]]
local gdiplus = ffi.load("gdiplus")
-- gdiplus.GdipCreateRegionRectI(rect, region)
-- rect : Rect*
-- region : GpRegion** in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('gdiplus.dll');
const GdipCreateRegionRectI = lib.func('__stdcall', 'GdipCreateRegionRectI', 'int32_t', ['void *', 'void *']);
// GdipCreateRegionRectI(rect, region)
// rect : Rect* -> 'void *'
// region : GpRegion** in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("gdiplus.dll", {
  GdipCreateRegionRectI: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.GdipCreateRegionRectI(rect, region)
// rect : Rect* -> "pointer"
// region : GpRegion** in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GdipCreateRegionRectI(
    void* rect,
    void* region);
C, "gdiplus.dll");
// $ffi->GdipCreateRegionRectI(rect, region);
// rect : Rect*
// region : GpRegion** in/out
// 構造体/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 GdipCreateRegionRectI(
        Pointer rect,   // Rect*
        Pointer region   // GpRegion** in/out
    );
}
@[Link("gdiplus")]
lib Libgdiplus
  fun GdipCreateRegionRectI = GdipCreateRegionRectI(
    rect : Rect*,   # Rect*
    region : GpRegion**   # GpRegion** in/out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GdipCreateRegionRectINative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef GdipCreateRegionRectIDart = int Function(Pointer<Void>, Pointer<Void>);
final GdipCreateRegionRectI = DynamicLibrary.open('gdiplus.dll')
    .lookupFunction<GdipCreateRegionRectINative, GdipCreateRegionRectIDart>('GdipCreateRegionRectI');
// rect : Rect* -> Pointer<Void>
// region : GpRegion** in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GdipCreateRegionRectI(
  rect: Pointer;   // Rect*
  region: Pointer   // GpRegion** in/out
): Integer; stdcall;
  external 'gdiplus.dll' name 'GdipCreateRegionRectI';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GdipCreateRegionRectI"
  c_GdipCreateRegionRectI :: Ptr () -> Ptr () -> IO Int32
-- rect : Rect* -> Ptr ()
-- region : GpRegion** in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let gdipcreateregionrecti =
  foreign "GdipCreateRegionRectI"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* rect : Rect* -> (ptr void) *)
(* region : GpRegion** in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library gdiplus (t "gdiplus.dll"))
(cffi:use-foreign-library gdiplus)

(cffi:defcfun ("GdipCreateRegionRectI" gdip-create-region-rect-i :convention :stdcall) :int32
  (rect :pointer)   ; Rect*
  (region :pointer))   ; GpRegion** in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GdipCreateRegionRectI = Win32::API::More->new('gdiplus',
    'int GdipCreateRegionRectI(LPVOID rect, LPVOID region)');
# my $ret = $GdipCreateRegionRectI->Call($rect, $region);
# rect : Rect* -> LPVOID
# region : GpRegion** in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型