Syntax
Success = DrawSetAntialias(Mode.i)
Description
Sets the anti-aliasing mode for subsequent drawing operations within the current drawing context. Anti-aliasing smooths the edges of shapes and lines.
Parameters
Mode.i
The desired anti-aliasing mode. Must be one of:
#PG_Antialias_PerPrimitive : (Default) Anti-aliasing is determined based on the primitive being drawn. Text is always anti-aliased (unless disabled in font options). Primitives like lines and curves are anti-aliased, while axis-aligned rectangles are typically not.
#PG_Antialias_Aliased : All rendering is forced to be aliased (no anti-aliasing).
Return Value
Returns #True if the mode was successfully set, or #False if the mode value
was invalid or if called outside a BeginDraw() / EndDraw() block.
Remarks
The setting persists until changed again or until the drawing state is restored via DrawRestore(). The default mode #PG_Antialias_PerPrimitive
generally provides the best balance between quality and performance.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1)
; Draw with default anti-aliasing
DrawEllipse(50, 50, 40, 40, RGB(255, 0, 0))
DrawTxt(CreateText("Anti-Aliased", "Arial", 12), 10, 100, 0)
; Change to aliased mode
DrawSetAntialias(#PG_Antialias_Aliased)
; Draw aliased
DrawEllipse(150, 50, 40, 40, RGB(0, 0, 255))
DrawTxt(CreateText("Aliased", "Arial", 12), 130, 100, 0)
; Restore default for good practice (though EndDraw would reset it)
DrawSetAntialias(#PG_Antialias_PerPrimitive)
EndProcedure
MyWindow = CreateWindow(0, 0, 250, 150, "Set Antialias 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
DrawGetAntialias, BeginDraw, EndDraw, DrawSave, DrawRestore
Supported OS
Windows, Linux