FillArea() ; Useless function ?
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
FillArea() ; Useless function ?
FillArea() function is useless because it takes more than 20 millisecs when filling less than 1/5 of screen area, at least in my pc (Ati 9600) 
I don't know what you are trying to accomplish but if you use windows and want to create a custom filled shape, use paths. It's a lot faster.
If you wish you can use my lib ( http://www.geboortegrond.nl/pb/wb_Lib.zip ) but using api calls will also work fine.
If you wish you can use my lib ( http://www.geboortegrond.nl/pb/wb_Lib.zip ) but using api calls will also work fine.
Re: FillArea() ; Useless function ?
> FillArea() function is useless because it takes more than 20 millisecs when
> filling less than 1/5 of screen area, at least in my pc (Ati 9600)
Why don't you post some test code here so we can test it ourselves? Then
we can decide if it's really a bug, or, as you said, just your PC. Thanks!
> filling less than 1/5 of screen area, at least in my pc (Ati 9600)
Why don't you post some test code here so we can test it ourselves? Then
we can decide if it's really a bug, or, as you said, just your PC. Thanks!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Code: Select all
bitplanes.b=32:RX.w=1024:RY.w=768
If InitMouse()=0 Or InitSprite()=0 Or InitSprite3D()=0 Or InitKeyboard()=0
MessageRequester("Error","Can't access DirectX",0):End
EndIf
OpenScreen(RX.w,RY.w,bitplanes.b,"Masses")
Procedure Box1()
DrawingMode(4)
Box(111,111,333,333,$aaaaaa)
DrawingMode(0)
FillArea(222,222,$aaaaaa,$111111)
EndProcedure
Repeat
ExamineKeyboard():ExamineMouse()
StartDrawing(ScreenOutput())
Box1()
StopDrawing()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape)It's not a bug, but a notable deficiency.
Of course fill area is slow for filling a square, that's not what its for.
Fill area is for filling arbitary shapes, not regular ones. When you have an arbitary shape it is invaluable.
Try doing this rather sickening effect without it
A more practical example would be if you had irregular colors around the border of an image and you wanted to set it all to a sinlge transparantly masked color.
It isn't a good idea to use it in your main drawing loop. You'd probably want to set up any images in buffers first.
Fill area is for filling arbitary shapes, not regular ones. When you have an arbitary shape it is invaluable.
Try doing this rather sickening effect without it
Code: Select all
bitplanes.b=32:RX.w=1024:RY.w=768
If InitMouse()=0 Or InitSprite()=0 Or InitSprite3D()=0 Or InitKeyboard()=0
MessageRequester("Error","Can't access DirectX",0):End
EndIf
OpenScreen(RX.w,RY.w,bitplanes.b,"Masses")
Procedure Box1()
DrawingMode(4)
For i = 1 To 5
Circle(Random(300) + 100, Random(300) + 100, Random(100), $AAAAAA)
Next i
Box(111,111,333,333,$AAAAAA)
DrawingMode(0)
FillArea(120,120,$AAAAAA,$FFFFFF)
FillArea(120,300,$AAAAAA,$FF0000)
FillArea(300,120,$AAAAAA,$00FF00)
FillArea(222,222,$AAAAAA,$0000FF)
EndProcedure
Repeat
ExamineKeyboard():ExamineMouse()
StartDrawing(ScreenOutput())
Box1()
StopDrawing()
FlipBuffers()
ClearScreen(0,0,0)
Until KeyboardPushed(#PB_Key_Escape)
It isn't a good idea to use it in your main drawing loop. You'd probably want to set up any images in buffers first.
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Yes, regular shapes is a set of all arbitary shapes where a fast fill method exists. You can do it the slow way if you want, but its stupid.mathematically "regular shapes" are inside the joint of "arbitrary shapes"
What does suprise me is that there doesn't appear to be a method for filled circles.
Having to use FillArea for circles, that is wrong.
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
Fred wrote
Perhaps i should put it in General Discussion or so
Anyway the sec appointment came well
Simply, if it is too difficult to implement a fast funtion to fill a 2D area, I would eliminate this function from windows version too.
Or at least print a notice in the explanation of this function in PBhelp, saying that it is too slow for use in realtime rendering.
Besides, this funny function eats 100% CPU. Coz it can't eat more.
Sorry, i didn't put here because Linux question, but as i wrote below it is not a real bug, but a not useful function in many cases, a notable deficient function. It's impossible to work with it in real time graphics.I don't know why it's reported under bug reports..
Perhaps i should put it in General Discussion or so
Anyway the sec appointment came well
Simply, if it is too difficult to implement a fast funtion to fill a 2D area, I would eliminate this function from windows version too.
Or at least print a notice in the explanation of this function in PBhelp, saying that it is too slow for use in realtime rendering.
Besides, this funny function eats 100% CPU. Coz it can't eat more.



