Progress bar without pixel jumps
Posted: Sat Mar 28, 2026 5:57 pm
Some time ago, I learned that Hollywood’s graphics system can set the position and size of graphic objects only to integer pixel positions. Now I’ve noticed that the function for scaling vector brushes can handle floating-point numbers to achieve the anti-aliasing effect.
This makes it possible to display a progress bar that appears to grow continuously, without any tricks.
The top bar in the example has no anti-aliasing, while the bottom one does:
Ralf
This makes it possible to display a progress bar that appears to grow continuously, without any tricks.
The top bar in the example has no anti-aliasing, while the bottom one does:
Code: Select all
@DISPLAY {Width = 400, Height = 150, Layers=True}
SetFillStyle(#FILLCOLOR)
lineWidth=380
lineHeight=15
StartPath(1)
MoveTo(1, 0, 0)
AddBoxToPath(1, 0, 0, lineWidth, lineHeight)
ClosePath(1)
SetFormStyle(#ANTIALIAS)
StartPath(2)
MoveTo(2, 0, 0)
AddBoxToPath(2, 0, 0, lineWidth, lineHeight)
ClosePath(2)
Local id=PathToBrush(Nil, {{ID=1, Color=#WHITE}, {ID=2, Color=#WHITE, X=0, Y=50}})
FreePath(1)
FreePath(2)
xpos=10
ypos=40
TextOut(xpos, 10, "0%", {Name="%"})
DisplayBrush(id, xpos, ypos, {Name="A", Transparency=0})
FreeBrush(id)
For i=0.0001 To 1 Step 0.0003
BeginRefresh()
SetLayerStyle("%", {Text=FormatStr("%.2f%%", 100*i)})
SetLayerStyle("A", {ScaleX=i})
EndRefresh()
Sleep(40)
Next
Sleep(5000)