DrawEllipse

Syntax

DrawEllipse(x.d, y.d, RadiusX.d, RadiusY.d, Color.l, Opacity.f=1)

Description

Draws a solid-filled ellipse (or circle if radii are equal) centered at the specified coordinates with the given radii, color, and opacity.

Parameters

x.d
The horizontal coordinate of the ellipse's center in device-independent pixels (DIPs).

y.d
The vertical coordinate of the ellipse's center in DIPs.

RadiusX.d
The horizontal radius of the ellipse in DIPs.

RadiusY.d
The vertical radius of the ellipse in DIPs.

Color.l
The fill color of the ellipse in RGB format (e.g., using RGB(r, g, b)).

Opacity.f (optional)
The opacity of the ellipse, ranging from 0.0 (fully transparent) to 1.0 (fully opaque). Default is 1.0.

Return Value

This command does not return a value. It returns internally if RadiusX, RadiusY, or Opacity are zero or less.

Remarks

The coordinates and radii are specified in DIPs but are converted internally to physical pixels based on the current output's DPI before drawing. The function uses an internal solid color brush for efficiency.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)

    DrawClear(RGB(255, 255, 255), 1) ; White background

    ; Draw a solid red circle
    DrawEllipse(70, 70, 50, 50, RGB(255, 0, 0))

    ; Draw a semi-transparent blue ellipse overlapping the circle
    DrawEllipse(150, 90, 70, 40, RGB(0, 0, 255), 0.6)

EndProcedure

MyWindow = CreateWindow(0, 0, 250, 200, "DrawEllipse Example")

If MyWindow
  AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
  WindowShow(MyWindow, #True, #PG_Window_ScreenCentered)

  Repeat
    Event = WaitWindowEvent()
  Until Event = #PB_Event_CloseWindow
EndIf

StopProGUI()

See Also

DrawEllipseFill, DrawEllipseStroke, DrawBox, BeginDraw, EndDraw, RGB()

Supported OS

Windows, Linux