Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Flood Filling Drawings

Author
Message
mikeMarek 597
15
Years of Service
User Offline
Joined: 12th Feb 2009
Location:
Posted: 19th May 2009 02:13
How can I flood fill a drawn object? I have this code:

I want to have a fill colour for the inside of the circle. Also, how can I change the line thickness for drawing?

Thanks in advance,
-Mike
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 20th May 2009 23:39
Draw progressively smaller circles??

Acually I tried that and it still leaves little specks of background color inside. This is actually something I dealt with when I designed my Image class which, unfortunately, I don't have access to my code. Not that that helps much.

What I did was check the Internet for algorithms to draw circles. The algorithm will generally give you two points with different x values but the same y value. Draw a straight line from one point to the next. Each cycle of the algorithm give you the next value of y without skipping any so as you draw longer and longer then shorter and shorter lines you have a fill.

Using a little ingenuity you could work top and bottom of the circle at the same time to save a bit of calculating time. The problem with using DGDK out of the box is that you'd have to call dbLine() which involves repeated function calls.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 21st May 2009 00:34
Someone had done this using boxes, though I can't find the code snippet to save my life. Same idea as lines, but more efficient because there are fewer DGDK calls.


My site, for various stuff that I make.
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 21st May 2009 00:54
Achhhh! I suppose you could do it with a narrow filled box and rotate it through 90 degrees. But that's still overwriting pixels you've already drawn. It could also leave some pretty rough edges.

I just dug up the source code I used. Bear in mind this is for my Image class and uses some functions that aren't explained here since I was actually working direction on the D3D copy of the image. But this should be illustrative of how do do the point and line routines.







Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-11-25 10:47:25
Your offset time is: 2024-11-25 10:47:25