DrawRoundBoxStrokeFill

Syntax

DrawRoundBoxStrokeFill(x.d, y.d, Width.d, Height.d, RadiusX.d, RadiusY.d, Brush, NoRadiusDPIScaling.b=#False)

Description

Draws the outline (stroke) of a rectangle with rounded corners at the specified position and size using the provided brush. The roundness is defined by horizontal (RadiusX) and vertical (RadiusY) radii. The appearance of the stroke (width, dash style, caps, joins) is determined by the current stroke settings defined by DrawSetStroke().

Parameters

x.d
The horizontal coordinate of the rectangle's top-left corner in device-independent pixels (DIPs).

y.d
The vertical coordinate of the rectangle's top-left corner in DIPs.

Width.d
The width of the rectangle in DIPs.

Height.d
The height of the rectangle in DIPs.

RadiusX.d
The horizontal radius for the corners in DIPs. This value is clamped internally so it cannot exceed half the rectangle's width.

RadiusY.d
The vertical radius for the corners in DIPs. This value is clamped internally so it cannot exceed half the rectangle's height.

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

NoRadiusDPIScaling.b (optional)
If set to #True, the RadiusX and RadiusY values are treated as physical pixels and are not scaled by the current DPI. Default is #False (radii are treated as DIPs and scaled).

Return Value

This command does not return a value. It returns internally if the Brush handle is invalid, or if Width or Height are zero or less.

Remarks

The coordinates, dimensions, and radii (unless NoRadiusDPIScaling is #True) are specified in DIPs but are converted internally to physical pixels based on the current output's DPI before drawing. Use DrawSetStroke() before calling this function to customize the line's appearance. The appearance of the stroke depends on the brush type (image, gradient) and its properties (position, scale, rotation, extend mode, opacity). If RadiusX or RadiusY are zero or negative, a standard rectangle outline (like DrawBoxStrokeFill()) might be drawn.

Example

IncludeFile "ProGUI_PB.pbi"

StartProGUI()

; Create a gradient brush
Global GradientBrush = CreateBrushGradientLinear(0, 0, 200, 0, RGB(0, 255, 255), 1, RGB(255, 0, 255), 1) ; Cyan to Magenta

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

    ; Set stroke to 12px wide
    DrawSetStroke(12)
    ; Draw a rounded box outline using the gradient brush
    DrawRoundBoxStrokeFill(20, 20, 200, 100, 40, 20, GradientBrush)

    ; Restore default stroke
    DrawSetStroke(1)

EndProcedure

MyWindow = CreateWindow(0, 0, 240, 140, "DrawRoundBoxStrokeFill 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

DrawSetStroke, DrawRoundBoxStroke, DrawRoundBoxFill, DrawBoxStrokeFill, CreateBrushImg, CreateBrushGradientLinear, BeginDraw, EndDraw

Supported OS

Windows, Linux