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 / My fix for dbCircle(..) not working

Author
Message
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 9th Jan 2012 20:21
I had a problem with dbCircle(..) not working when I went through the latest update so I made a work-around. This procedure will take an image as an input and draw a circle in it. It can fill and blend the alpha:

I hope this helps those with the same problem. I have seen a few posts on the subject, but this is what I came up with.

The fastest code is the code never written.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 9th Jan 2012 20:47
http://gamebub.com/cpp_algorithms.php Not the page I was looking for but the algorithms are basically the same. Handy if you're directly accessing the image data itself.

I've got some code floating around somewhere that also draws lines, circles, etc to a GDK Image via DX directly if you're interested. Cuts out the memblock usage anyhow...

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 9th Jan 2012 21:42
I think the memblock method is just as fast.... I think?

The fastest code is the code never written.
WLGfx
17
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 10th Jan 2012 00:03 Edited at: 10th Jan 2012 00:04


These I found some time ago and used recently. The bresenham circle algorithm is probably the fastest there is.

EDIT: One day I'll get round to optimising these functions with asm instead of c.

Mental arithmetic? Me? (That's for computers) I can't subtract a fart from a plate of beans!
Warning! May contain Nuts!
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 10th Jan 2012 03:41
That's a good little bit to have. Thanks for posting.

The fastest code is the code never written.

Login to post a reply

Server time is: 2024-11-19 04:28:56
Your offset time is: 2024-11-19 04:28:56