DrawEllipseFill

Syntax

DrawEllipseFill(x.d, y.d, RadiusX.d, RadiusY.d, Brush)

Description

Draws a filled ellipse (or circle if radii are equal) centered at the specified coordinates using the provided brush.

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.

Brush
The handle of the brush (created with CreateBrushImg(), CreateBrushGradientLinear(), etc.) used to fill the ellipse.

Return Value

This command does not return a value. It returns internally if the Brush handle is invalid, or if RadiusX or RadiusY 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 appearance of the fill depends on the brush type (image, gradient) and its properties (position, scale, rotation, extend mode, opacity).

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

; Create a gradient brush for the stroke
Global GradientBrush = CreateBrushGradientLinear(0, 0, 150, 0, RGB(255, 0, 0), 1, RGB(0, 0, 255), 1) ; Red to Blue

Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
  
    DrawClear(RGB(255, 255, 255), 1) ; White background

    ; Set stroke to 8px wide
    DrawSetStroke(8)
    ; Draw an ellipse outline using the gradient brush
    DrawEllipseStrokeFill(150, 100, 100, 60, GradientBrush)

    ; Restore default stroke
    DrawSetStroke(1)

EndProcedure

MyWindow = CreateWindow(0, 0, 300, 200, "DrawEllipseStrokeFill Example")

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

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

FreeBrush(GradientBrush)
StopProGUI()

See Also

DrawEllipse, DrawEllipseStrokeFill, CreateBrushImg, CreateBrushGradientLinear, CreateBrushGradientRadial, BeginDraw, EndDraw

Supported OS

Windows, Linux