DrawEllipseStroke

Syntax

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

Description

Draws the outline (stroke) of an ellipse (or circle if radii are equal) centered at the specified coordinates using the given color and opacity. The appearance of the stroke (width, dash style, caps) is determined by the current stroke settings defined by DrawSetStroke().

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 color of the stroke in RGB format (e.g., using RGB(r, g, b)).

Opacity.f (optional)
The opacity of the stroke, 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 stroke is drawn using an internal solid color brush. Use DrawSetStroke() before calling this function to customize the line's appearance (note: corner styles like Bevel or Round have no effect on ellipses).

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

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

    ; Draw a simple circle outline (default 1px stroke)
    DrawEllipseStroke(70, 70, 50, 50, RGB(255, 0, 0))

    ; Set stroke to 3px wide, dotted
    DrawSetStroke(3, #PG_Stroke_Dot)
    ; Draw a dotted ellipse outline with 70% opacity
    DrawEllipseStroke(180, 90, 70, 40, RGB(0, 0, 255), 0.7)

    ; Restore default stroke
    DrawSetStroke(1)

EndProcedure

MyWindow = CreateWindow(0, 0, 300, 200, "DrawEllipseStroke 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

DrawSetStroke, DrawEllipse, DrawEllipseStrokeFill, DrawBoxStroke, BeginDraw, EndDraw

Supported OS

Windows, Linux