Hi all.
I’ve made a small library of antialiased drawing primitives (DrawAALine,
DrawAAThickLine, DrawAACircle, DrawAAThickCircle). They look pretty good,
but the trouble is they are drawn laboriously with PgDrawIPixel, and
consequently are much slower than the eqivalent PgDraw functions.
My current approach is calculate, set alpha, draw pixel, set alpha, draw
second pixel, calculate, …
A few questions to help speed it up:
- Am I right in assuming that the time taken in the PgDrawIPixel function
is large compared to any calculations I might be doing (maths co-pro makes
even fp maths quick), even if I am using a PtOSContainer? I’m also assuming
the PgSetAlphaBlend function doesn’t have a high overhead in itself. - Is PgDrawPixelArray significantly faster than the equivalent number of
PgDrawPixel 's? Currently I’m drawing the pixels as I calculate them, but I
could put them into 256 arrays (one per alpha level) and use
PgDrawPixelArray when I’m done with the calculations. Trouble is it would
take up a heap of memory to hold all the pixel values, so I’d want it to
make a considerable difference. - Any other suggestions to help speed it up?
And to help with the interface to the functions:
3. Is there any way to retrieve the current drawing settings, such as
alpha-blend level, line thickness and fill color?
Thanks,
Stuart Harding
P.S. These circles and lines look pretty good. If anyone is interested in
using them, send me an email and I’ll either email it or post it on here
when the library’s done.