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.

DarkBASIC Professional Discussion / Anti-aliased lines over background

Author
Message
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 13th Dec 2010 22:41 Edited at: 13th Dec 2010 23:54
I am trying to create nice smooth aliased lines for a graph function. The pic shows how it looks atm, and I'm aiming for something like the Google chart api produces.
http://code.google.com/apis/chart/

Mine:


The lines need to top the data of the graph and so straddle varying colours. Also, it's all drawn on a canvas gadget using BlueGUI so no fancy dbpro commands for alpha blending etc. Basically all I have is `dot` and `point` equivalents.

I have tried adapting the wuline algorithm code posted by Phaelax, but no luck. I also looked at some API commands (GDI+) but couldn't find anything useful. Any aliasing routines or snippets would be gratefully received!
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 14th Dec 2010 13:54
After looking at cloggy's d3dfunc version of the wu-line algorithm I think all I need do is convert the alpha pixel plotting to one without using alpha. So, if you want to plot a red pixel with 50% alpha the actual pixel plotted will be modified by the existing pixel colour currently at that position. So the crux of the problem is:

Plot a pixel over existing pixels with varying alpha values without using alpha.

Thanks.
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 14th Dec 2010 21:26 Edited at: 14th Dec 2010 21:29
Sussed it, code (uncommented yet!) & result below should anyone search in the future.




Login to post a reply

Server time is: 2026-07-21 07:03:40
Your offset time is: 2026-07-21 07:03:40