ホーム › Graphics.GdiPlus › GdipDrawEllipse
GdipDrawEllipse
関数指定ペンで楕円の枠線を描画する。
シグネチャ
// gdiplus.dll
#include <windows.h>
Status GdipDrawEllipse(
GpGraphics* graphics,
GpPen* pen,
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| graphics | GpGraphics* | inout |
| pen | GpPen* | inout |
| x | FLOAT | in |
| y | FLOAT | in |
| width | FLOAT | in |
| height | FLOAT | in |
戻り値の型: Status
各言語での呼び出し定義
// gdiplus.dll
#include <windows.h>
Status GdipDrawEllipse(
GpGraphics* graphics,
GpPen* pen,
FLOAT x,
FLOAT y,
FLOAT width,
FLOAT height
);[DllImport("gdiplus.dll", ExactSpelling = true)]
static extern int GdipDrawEllipse(
IntPtr graphics, // GpGraphics* in/out
IntPtr pen, // GpPen* in/out
float x, // FLOAT
float y, // FLOAT
float width, // FLOAT
float height // FLOAT
);<DllImport("gdiplus.dll", ExactSpelling:=True)>
Public Shared Function GdipDrawEllipse(
graphics As IntPtr, ' GpGraphics* in/out
pen As IntPtr, ' GpPen* in/out
x As Single, ' FLOAT
y As Single, ' FLOAT
width As Single, ' FLOAT
height As Single ' FLOAT
) As Integer
End Function' graphics : GpGraphics* in/out
' pen : GpPen* in/out
' x : FLOAT
' y : FLOAT
' width : FLOAT
' height : FLOAT
Declare PtrSafe Function GdipDrawEllipse Lib "gdiplus" ( _
ByVal graphics As LongPtr, _
ByVal pen As LongPtr, _
ByVal x As Single, _
ByVal y As Single, _
ByVal width As Single, _
ByVal height As Single) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GdipDrawEllipse = ctypes.windll.gdiplus.GdipDrawEllipse
GdipDrawEllipse.restype = ctypes.c_int
GdipDrawEllipse.argtypes = [
ctypes.c_void_p, # graphics : GpGraphics* in/out
ctypes.c_void_p, # pen : GpPen* in/out
ctypes.c_float, # x : FLOAT
ctypes.c_float, # y : FLOAT
ctypes.c_float, # width : FLOAT
ctypes.c_float, # height : FLOAT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('gdiplus.dll')
GdipDrawEllipse = Fiddle::Function.new(
lib['GdipDrawEllipse'],
[
Fiddle::TYPE_VOIDP, # graphics : GpGraphics* in/out
Fiddle::TYPE_VOIDP, # pen : GpPen* in/out
Fiddle::TYPE_FLOAT, # x : FLOAT
Fiddle::TYPE_FLOAT, # y : FLOAT
Fiddle::TYPE_FLOAT, # width : FLOAT
Fiddle::TYPE_FLOAT, # height : FLOAT
],
Fiddle::TYPE_INT)#[link(name = "gdiplus")]
extern "system" {
fn GdipDrawEllipse(
graphics: *mut GpGraphics, // GpGraphics* in/out
pen: *mut GpPen, // GpPen* in/out
x: f32, // FLOAT
y: f32, // FLOAT
width: f32, // FLOAT
height: f32 // FLOAT
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("gdiplus.dll")]
public static extern int GdipDrawEllipse(IntPtr graphics, IntPtr pen, float x, float y, float width, float height);
"@
$api = Add-Type -MemberDefinition $sig -Name 'gdiplus_GdipDrawEllipse' -Namespace Win32 -PassThru
# $api::GdipDrawEllipse(graphics, pen, x, y, width, height)#uselib "gdiplus.dll"
#func global GdipDrawEllipse "GdipDrawEllipse" sptr, sptr, float, float, float, float
; GdipDrawEllipse varptr(graphics), varptr(pen), x, y, width, height ; 戻り値は stat
; graphics : GpGraphics* in/out -> "sptr"
; pen : GpPen* in/out -> "sptr"
; x : FLOAT -> "float"
; y : FLOAT -> "float"
; width : FLOAT -> "float"
; height : FLOAT -> "float"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "gdiplus.dll" #cfunc global GdipDrawEllipse "GdipDrawEllipse" var, var, float, float, float, float ; res = GdipDrawEllipse(graphics, pen, x, y, width, height) ; graphics : GpGraphics* in/out -> "var" ; pen : GpPen* in/out -> "var" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "gdiplus.dll" #cfunc global GdipDrawEllipse "GdipDrawEllipse" sptr, sptr, float, float, float, float ; res = GdipDrawEllipse(varptr(graphics), varptr(pen), x, y, width, height) ; graphics : GpGraphics* in/out -> "sptr" ; pen : GpPen* in/out -> "sptr" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; Status GdipDrawEllipse(GpGraphics* graphics, GpPen* pen, FLOAT x, FLOAT y, FLOAT width, FLOAT height) #uselib "gdiplus.dll" #cfunc global GdipDrawEllipse "GdipDrawEllipse" var, var, float, float, float, float ; res = GdipDrawEllipse(graphics, pen, x, y, width, height) ; graphics : GpGraphics* in/out -> "var" ; pen : GpPen* in/out -> "var" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; Status GdipDrawEllipse(GpGraphics* graphics, GpPen* pen, FLOAT x, FLOAT y, FLOAT width, FLOAT height) #uselib "gdiplus.dll" #cfunc global GdipDrawEllipse "GdipDrawEllipse" intptr, intptr, float, float, float, float ; res = GdipDrawEllipse(varptr(graphics), varptr(pen), x, y, width, height) ; graphics : GpGraphics* in/out -> "intptr" ; pen : GpPen* in/out -> "intptr" ; x : FLOAT -> "float" ; y : FLOAT -> "float" ; width : FLOAT -> "float" ; height : FLOAT -> "float" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"math"
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdiplus = windows.NewLazySystemDLL("gdiplus.dll")
procGdipDrawEllipse = gdiplus.NewProc("GdipDrawEllipse")
)
// graphics (GpGraphics* in/out), pen (GpPen* in/out), x (FLOAT), y (FLOAT), width (FLOAT), height (FLOAT)
r1, _, err := procGdipDrawEllipse.Call(
uintptr(graphics),
uintptr(pen),
uintptr(math.Float32bits(x)),
uintptr(math.Float32bits(y)),
uintptr(math.Float32bits(width)),
uintptr(math.Float32bits(height)),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // Status
// 注意: float/double 引数は proc.Call では XMM レジスタに渡せません。
// windows.SyscallN(proc.Addr(), math.Float64bits(x), ...) もしくは cgo を使用してください。function GdipDrawEllipse(
graphics: Pointer; // GpGraphics* in/out
pen: Pointer; // GpPen* in/out
x: Single; // FLOAT
y: Single; // FLOAT
width: Single; // FLOAT
height: Single // FLOAT
): Integer; stdcall;
external 'gdiplus.dll' name 'GdipDrawEllipse';result := DllCall("gdiplus\GdipDrawEllipse"
, "Ptr", graphics ; GpGraphics* in/out
, "Ptr", pen ; GpPen* in/out
, "Float", x ; FLOAT
, "Float", y ; FLOAT
, "Float", width ; FLOAT
, "Float", height ; FLOAT
, "Int") ; return: Status●GdipDrawEllipse(graphics, pen, x, y, width, height) = DLL("gdiplus.dll", "int GdipDrawEllipse(void*, void*, float, float, float, float)")
# 呼び出し: GdipDrawEllipse(graphics, pen, x, y, width, height)
# graphics : GpGraphics* in/out -> "void*"
# pen : GpPen* in/out -> "void*"
# x : FLOAT -> "float"
# y : FLOAT -> "float"
# width : FLOAT -> "float"
# height : FLOAT -> "float"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。