And in answer to your second question, here's something I wrote that will draw a smoothed ellipse. It will however, also anti-alias whatever is in the background square where it draws. But it should be fine to use on plain backgrounds, and maybe elsewhere too, you'd have to try it.
Code: Select all
Procedure SmoothEllipse(ImNum,x,y,width,height,colour)
tempimg=CreateImage(#PB_any,width*4,height*4)
tempimg2=GrabImage(ImNum,#PB_Any,x,y,width,height)
UseImage(tempimg2)
ResizeImage(tempimg2,ImageWidth()*4,ImageHeight()*4)
UseImage(tempimg)
StartDrawing(ImageOutput())
DrawingMode(4)
UseImage(tempimg2)
DrawImage(ImageID(),0,0)
Ellipse(width*2,height*2,width*2,height*2,colour)
Ellipse(width*2,height*2,width*2-1,height*2-1,colour)
Ellipse(width*2,height*2,width*2-2,height*2-2,colour)
Ellipse(width*2,height*2,width*2-3,height*2-3,colour)
Ellipse(width*2,height*2,width*2-4,height*2-4,colour)
Ellipse(width*2,height*2,width*2-5,height*2-5,colour)
StopDrawing()
ResizeImage(tempimg,width,height)
UseImage(ImNum)
StartDrawing(ImageOutput())
UseImage(tempimg)
DrawImage(ImageID(),x,y)
StopDrawing()
FreeImage(tempimg)
FreeImage(tempimg2)
EndProcedure
OpenWindow(0,0,0,400,400,#PB_Window_SystemMenu | #PB_Window_ScreenCentered,"test")
UseJPEGImageDecoder()
CreateImage(1,400,400)
StartDrawing(ImageOutput())
DrawingMode(0)
Box(0,0,400,400,$0000FF)
DrawingMode(4)
For temp=0 To 400 Step 20
Line(0,temp,temp,-temp,$FF0000)
Line(temp,400,400-temp,temp-400)
Line(temp,0,400-temp,400-temp)
Line(0,temp,400-temp,400-temp)
Next
Ellipse(280,280,100,100,$00FF00)
StopDrawing()
SmoothEllipse(1,84,87,200,200,$00FF00)
CreateGadgetList(WindowID())
ImageGadget(0,0,0,400,400,UseImage(1))
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
Its making use of the fact that resizing in PB will anti-alias automatically. The example lets you compare it to a normally drawn ellipse, and I think it is an improvement.