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.

AppGameKit Classic Chat / creating anti-aliased circle images

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 06:33 Edited at: 14th May 2013 06:33
On my PC, it takes about 500ms to create 100 images, or roughly 5ms per image. It would be 5 times faster if I didn't have to preset the memblock data to avoid strange artifacts.

Method is based on Xiaolin Wu's line algorithm. Press spacebar to randomly position and recolor the circles.







"You're all wrong. You're all idiots." ~Fluffy Rabbit

Attachments

Login to view attachments
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 14th May 2013 16:53 Edited at: 14th May 2013 16:56
Maybe you could re-draw the circle to clear it - like follow the same routine as drawing the circle, but clearing the memblock data rather than setting it. Just an idea, I guess it would depend on if the routine is faster at drawing a circle than at clearing the memblock first. If your saying it could be 5 times faster, well that says to me that it's worth a shot

I'd create the memblock and clear it out, then draw the circle, convert to image, then draw the circle again but with 0 values to clear it, then the next time the memblock is already cleared and waiting for the new circle.

If the circles are all different sizes, well I'd plan out and decide which key sizes to keep... like memblock 1 for diameters of 16 and below, memblock 2 for diameters of 32 and below, memblock 3 for 64 etc etc etc - so you have a bank of memblocks and you use the one that's big enough for the circle your drawing.

I got a fever, and the only prescription, is more memes.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th May 2013 17:08
That might work in certain situations, but this demo was just to show the function making different sizes. I'm not even sure for what someone would even need this function.

"You're all wrong. You're all idiots." ~Fluffy Rabbit
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th May 2013 17:53 Edited at: 14th May 2013 18:05
Cool demo!

EDIT: I just added a request to get some sort of options for setting large chunks in Memblocks.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
basjak
14
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 14th May 2013 23:44
yes it is high quality circular sprites. it took 428 ms on my computer.

you remind me when I used to use memory access heavily with drawing commands using DBpro

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th May 2013 00:52
Quote: "you remind me when I used to use memory access heavily with drawing commands using DBpro"


If you search the code snippets for 'drawing', you'll see a library I made, which is what this snippet is based on. They didn't draw directly to memblocks though, however, the iTunes clone I was making made heavy use of memblocks for creating the entire interface. But I have functions I could port over for drawing filled circles with linear and radial gradients as well.

Quote: "EDIT: I just added a request to get some sort of options for setting large chunks in Memblocks."

Cool, that would be useful when you're not planning to fill the entire block.

"You're all wrong. You're all idiots." ~Fluffy Rabbit

Login to post a reply

Server time is: 2024-05-06 23:49:33
Your offset time is: 2024-05-06 23:49:33