ImageVectorOutput() has no antialiasing – normal or bug?
Posted: Sun May 25, 2025 1:21 am
Hey everyone,
I've been working on a small UI helper and wanted to render a rounded box into a transparent image using the VectorDrawing library.
What I'm trying to do:
Generate a transparent image at runtime using ImageVectorOutput() that:
I created a small test/demo that draws three versions of the same shape stacked vertically:
I've attached a screenshot and the full example code so you can reproduce or test it yourself.
So my questions:

– Taz
I've been working on a small UI helper and wanted to render a rounded box into a transparent image using the VectorDrawing library.
What I'm trying to do:
Generate a transparent image at runtime using ImageVectorOutput() that:
- has real alpha (e.g. rounded corners)
- looks smooth, like what CanvasVectorOutput() produces with antialiasing
- With CanvasVectorOutput(), it looks great – antialiased and clean. But there's no alpha channel.
- With ImageVectorOutput(), I get transparency… but no antialiasing at all.
- Curved edges are jagged, even when using BeginVectorLayer() and proper RGBA fills.
I created a small test/demo that draws three versions of the same shape stacked vertically:
- – antialiased, but no alpha
Code: Select all
CanvasVectorOutput(#Canvas)
- – transparent, but aliased
Code: Select all
ImageVectorOutput(#Image)
- – aliased, with background
Code: Select all
ImageVectorOutput(#ImageWithBackground)
I've attached a screenshot and the full example code so you can reproduce or test it yourself.
So my questions:
- Is the missing antialiasing in ImageVectorOutput() expected?
- Is there any known workaround to get antialiased shapes with transparency?
- Or is this just a limitation of the current implementation?
- Could it even be considered a bug?

Code: Select all
EnableExplicit
Enumeration
#WIN
#TEXT_CANVAS
#CANVAS
#TEXT_IMAGE
#IMAGE
#TEXT_IMAGE_BG
#IMAGE_WIDTH_BACKGROUND
#IMG_VIEW
#IMG_VIEW_WITH_BG
EndEnumeration
Global width = 600, height = 495, shapeW = 500, shapeH = 100, labelHeight = 25
Procedure _DrawContent(outputW, outputH, fillBackground.b)
Protected x = (outputW - shapeW) / 2
Protected y = (outputH - shapeH) / 2
If fillBackground
VectorSourceColor(RGBA(255, 255, 255, 255))
AddPathBox(0, 0, outputW, outputH)
FillPath()
EndIf
VectorSourceColor(RGBA(173, 209, 243, 255))
MovePathCursor(x + 40, y + 100 - 1)
AddPathArc(x + shapeW, y , x + shapeW, y + shapeH, 40)
AddPathArc(x + shapeW, y + shapeH, x , y + shapeH, 40)
AddPathArc(x , y + shapeH, x , y , 40)
AddPathArc(x , y , x + 40 , y , 40)
ClosePath()
FillPath()
EndProcedure
; Draws onto Canvas or Image, optionally with background fill
Procedure DrawRoundedRect(mode.i, fillBackground = #False)
Protected h = (height - labelHeight * 3) / 3
Select mode
Case #CANVAS
If StartVectorDrawing(CanvasVectorOutput(#CANVAS))
_DrawContent(width, h, fillBackground)
StopVectorDrawing()
EndIf
Case #IMAGE
If CreateImage(#IMAGE, width, h, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#IMAGE))
_DrawContent(width, h, fillBackground)
StopVectorDrawing()
EndIf
EndIf
Case #IMAGE_WIDTH_BACKGROUND
If CreateImage(#IMAGE_WIDTH_BACKGROUND, width, h, 32, #PB_Image_Transparent)
If StartVectorDrawing(ImageVectorOutput(#IMAGE_WIDTH_BACKGROUND))
_DrawContent(width, h, fillBackground)
StopVectorDrawing()
EndIf
EndIf
EndSelect
EndProcedure
; Opens window with 3 stacked rendering comparisons
Procedure _Example()
Protected y, rowHeight = (height - labelHeight * 3) / 3
If OpenWindow(#WIN, 0, 0, width, height, "Rendering Comparison", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
TextGadget(#TEXT_CANVAS, 0, y, width, labelHeight, "CanvasVectorOutput(#CANVAS)", #PB_Text_Center)
y + labelHeight: CanvasGadget(#CANVAS, 0, y, width, rowHeight): y + rowHeight
TextGadget(#TEXT_IMAGE, 0, y, width, labelHeight, "ImageVectorOutput(#IMAGE) without background", #PB_Text_Center)
y + labelHeight: ImageGadget(#IMG_VIEW, 0, y, width, rowHeight, 0): y + rowHeight
TextGadget(#TEXT_IMAGE_BG, 0, y, width, labelHeight, "ImageVectorOutput(#IMAGE_WIDTH_BACKGROUND)", #PB_Text_Center)
y + labelHeight: ImageGadget(#IMG_VIEW_WITH_BG, 0, y, width, rowHeight, 0)
; Render content
DrawRoundedRect(#CANVAS)
DrawRoundedRect(#IMAGE)
DrawRoundedRect(#IMAGE_WIDTH_BACKGROUND, #True)
; Set image gadgets
SetGadgetState(#IMG_VIEW, ImageID(#IMAGE))
SetGadgetState(#IMG_VIEW_WITH_BG, ImageID(#IMAGE_WIDTH_BACKGROUND))
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow: Break
EndSelect
ForEver
EndIf
EndProcedure
_Example()