Any easy way to fill certain (closed) area of HIRES screen?

The Oric video chip is not an easy beast to master, so any trick or method that allows to achieve nice visual results is welcome. Don't hesitate to comment (nicely) other people tricks and pictures :)
Brana
Flying Officer
Posts: 152
Joined: Fri Nov 30, 2007 8:30 pm
Contact:

Any easy way to fill certain (closed) area of HIRES screen?

Post by Brana » Sat Jul 06, 2013 3:21 am

Any easy way to fill certain (closed) area of the HIRES screen?



I'm wondering is there any simple (in BASIC?) solution, for this is the problem that's been bugging me for a couple of years now (!)

If I do something simple as drawing a circle, square, or an ellipse in HIRES in Oric Atmos, then sometimes I need to fill all (inside) pixels of that (closed) shape with INK color (just to be white), but I do not know any simple (and accurate) way to do that?

Is there any solution in Oric BASIC for this situation?

User avatar
Dbug
Site Admin
Posts: 2384
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Any easy way to fill certain (closed) area of HIRES scre

Post by Dbug » Sat Jul 06, 2013 7:53 am

Yes there is a way, I remember there was some Type In programs in some magazines with a BASIC implementation of that.
What you need to search for is 'floodfill'.

There are some examples with animations and pseudocode on wikipedia.:
http://en.wikipedia.org/wiki/Flood_fill

Know that there are many different methods to do it, but they basically are all recursive (so you may get an error with a Stack Overflow) or require arrays to store the non yet treated branches. Some are more efficient than others, and most can just be implemented with POINT(x,y) and CURSET(x,y,t).

In BASIC it may be quite slow, but I would try first the scanline method, it's probably the less memory/stack intensive.
Image

User avatar
peacer
Flight Lieutenant
Posts: 351
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: Any easy way to fill certain (closed) area of HIRES scre

Post by peacer » Sat Jul 06, 2013 10:59 am

In Peter's web site (TheSpider) he put his own painting program "spaint" . The program is written in %100 basic. The program is really helpful. It has many subroutines to draw circle, box, change attribute etc and shape filling routine. The filling code is really short, simple and fast.
4750 PRINTR$;"Fill Shape : Are you sure? (Y/N)"
4760 REPEAT:CK$=KEY$:UNTIL CK$="Y" OR CK$="N"
4770 IF CK$="N" THEN RETURN
4780 ' Fill shape
4790 FX=X:FY=Y
4800 IF POINT(X,Y)=0 THEN FP=0 ELSE FP=-1
4810 IF FP=0 THEN PRINT"Filling in foreground colour"
4820 IF FP=-1 THEN PRINT"Filling in background colour"
4830 REPEAT:PY=-1 ' move to top
4840 IF FY=LY THEN GOTO 4860
4850 IF POINT(FX,FY-1)=FP THEN FY=FY-1:PY=0
4860 UNTIL PY=-1
4870 CURSET FX,FY,2
4880 REPEAT:PY=-1 ' going down
4890 REPEAT:PX=-1 ' go left
4900 IF FX=LX THEN GOTO 4920
4910 IF POINT(FX-1,FY)=FP THEN CURSET FX-1,FY,2:FX=FX-1:PX=0
4920 UNTIL PX=-1
4930 FX=X
4940 REPEAT:PX=-1 ' go right
4950 IF FX=MX THEN GOTO 4970
4960 IF POINT(FX+1,FY)=FP THEN CURSET FX+1,FY,2:FX=FX+1:PX=0
4970 UNTIL PX=-1
4980 FX=X
4990 IF FY=MY THEN GOTO 5010
5000 IF POINT(FX,FY+1)=FP THEN CURSET FX,FY+1,2:FY=FY+1:PY=0
5010 UNTIL PY=-1
5020 RETURN
http://oricspider.home.insightbb.com/spiderbasic.html

User avatar
Symoon
Archivist
Posts: 1169
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Symoon » Sat Apr 08, 2017 4:37 am

Hi,
Peter's website seems down :( Anybody knows if it has moved to another place?
Thanks!

User avatar
coco.oric
Flight Lieutenant
Posts: 431
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by coco.oric » Thu Apr 13, 2017 7:07 pm

i'll look in my archives.
may be i've archived a copy
coco.oric as DidierV, CEO Member
Image Image

User avatar
Dbug
Site Admin
Posts: 2384
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Dbug » Thu Apr 13, 2017 7:40 pm

I poke Peter on Facebook :)
Have found my site code in HD storage. Shall need to work on it a bit, updating links etc, before I am able to share again.

User avatar
Symoon
Archivist
Posts: 1169
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Symoon » Fri Apr 14, 2017 5:25 am

Thanks!
Do you know of any particular reason why the site went offline?

User avatar
Dbug
Site Admin
Posts: 2384
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Dbug » Fri Apr 14, 2017 7:13 am

Thanks Mickael, I don't believe my site is hosted anywhere now. My cable company has been taken over twice since those days.

User avatar
Symoon
Archivist
Posts: 1169
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Symoon » Fri Apr 14, 2017 6:31 pm

Thanks! I see, same thing that happened with my little site when Geocities went down and I didn't have the nerve to set it up again - except my site didn't have any interesting information ;)

User avatar
TheSpider
Pilot Officer
Posts: 71
Joined: Sat Jan 07, 2006 8:17 am
Location: Lexington, Kentucky, USA (Ex-Elgin, Scotland)
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by TheSpider » Thu Apr 27, 2017 1:50 am

Dbug wrote:
Thu Apr 13, 2017 7:40 pm
I poke Peter on Facebook :)
Yes you did!!!
Sent you a link on FB message to my updated & zipped site on Dropbox.
Could oric.org assist in hosting these pages?
Peter (TheSpider) Paterson
A Scotsman in Kentucky
http://thespider.oric.org
http://mintspider.blogspot.com

User avatar
TheSpider
Pilot Officer
Posts: 71
Joined: Sat Jan 07, 2006 8:17 am
Location: Lexington, Kentucky, USA (Ex-Elgin, Scotland)
Contact:

Re: Any easy way to fill certain (closed) area of HIRES scre

Post by TheSpider » Thu Apr 27, 2017 1:54 am

peacer wrote:
Sat Jul 06, 2013 10:59 am
In Peter's web site (TheSpider) he put his own painting program "spaint" . The program is written in %100 basic. The program is really helpful. It has many subroutines to draw circle, box, change attribute etc and shape filling routine. The filling code is really short, simple and fast.


Greetings again peacer!!
I had to reset my password to get back into this forum, and received a message that my last login was in 2009.... oops!
Yeah, spaint was a labour of love for such a long time. I still run the program from time to time.
The filling routine is not the best, but did the job for what I needed. It missed areas, which you had to go to and start again there.
Hope you are doing well mate.
Peter (TheSpider) Paterson
A Scotsman in Kentucky
http://thespider.oric.org
http://mintspider.blogspot.com

User avatar
peacer
Flight Lieutenant
Posts: 351
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: Any easy way to fill certain (closed) area of HIRES scre

Post by peacer » Thu Apr 27, 2017 11:26 pm

TheSpider wrote:
Thu Apr 27, 2017 1:54 am
Greetings again peacer!!
I had to reset my password to get back into this forum, and received a message that my last login was in 2009.... oops!
Yeah, spaint was a labour of love for such a long time. I still run the program from time to time.
The filling routine is not the best, but did the job for what I needed. It missed areas, which you had to go to and start again there.
Hope you are doing well mate.
Hi peter :) Nice to hear from you too. I am trying to get by the life :)

I think your basic code is great. You are speaking modestly :)

Best wishes

User avatar
Dbug
Site Admin
Posts: 2384
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by Dbug » Fri Apr 28, 2017 12:06 pm


User avatar
TheSpider
Pilot Officer
Posts: 71
Joined: Sat Jan 07, 2006 8:17 am
Location: Lexington, Kentucky, USA (Ex-Elgin, Scotland)
Contact:

Re: Any easy way to fill certain (closed) area of HIRES screen?

Post by TheSpider » Fri Apr 28, 2017 12:22 pm

Thank you so much Dbug and Jede!!!!!
Peter (TheSpider) Paterson
A Scotsman in Kentucky
http://thespider.oric.org
http://mintspider.blogspot.com

User avatar
TheSpider
Pilot Officer
Posts: 71
Joined: Sat Jan 07, 2006 8:17 am
Location: Lexington, Kentucky, USA (Ex-Elgin, Scotland)
Contact:

Re: Any easy way to fill certain (closed) area of HIRES scre

Post by TheSpider » Fri Apr 28, 2017 12:26 pm

peacer wrote:
Thu Apr 27, 2017 11:26 pm
Hi peter :) Nice to hear from you too. I am trying to get by the life :)
I think your basic code is great. You are speaking modestly :)
Best wishes
Glad to hear you are doing good peacer.
Still working at a Food Bank, these days being the Food Procurement Coordinator and Report Writer.

Was chatting with my wife about all these artists that go back to their projects many years later.
That may be me with Spaint, as it truly still is a work in progress, and one I enjoy.
Peter (TheSpider) Paterson
A Scotsman in Kentucky
http://thespider.oric.org
http://mintspider.blogspot.com

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest