On 26-Jan-00 Christian Vandendorpe wrote:
> yes but for this you need to be able to look at the display and see if a
> pixel is on or not, right? I dont think there is any function in the Palm
> OS to see if a pixel is on. That's the problem.
You can draw to an offscreen window and then look at the memory. Or you can
write your own line drawing routines so that you'll know the coordinates
before they get drawn. I am sooo rusty at this, but the Bresenham method of
using long division with integers is great for scaling a set of arrays.. and
that's how most lines are drawn.
Let me look at a book real quick. Yuck bad examples in my books.
If I were to quickly draw a wedge shape I would probably try and maintain a
list of innermost X coords for each Y in the shape. If you were to code the
line routine yourself you could store the min X and max X for the two sides
of the wedge in a list that is Y entries long. Then you could simply run
through the Y list and draw a physical horizontal line between the min X and
max X. That gets you one solid piece of the wedge.
To get the arc portion of the wedge I would superimpose a min X and max X of
the arc shape into the Y list above before I physically draw it. For
example, I would start from the top of the Y list and know that the arc is
going to modify a portion of those entries for as tall as the arc.
The hard part is going all of this in the proper orientation. So I would
suggest to do it with a normalized arc in lets say the upper-right corner,
and then when I go to draw it I would translate the X & Y appropriate to
which quadrant it is supposed to go in.
Now that I read all of that I think it is too specific. Probably some other
ways to generically draw a filled concave polygon without needing to "draw"
portions of it beforehand. Like how about just pretending to draw and
instead storing the necessary coordinates in a list, and then using the above
technique or just counting odd & even to find the areas to draw solidly. For
totally concave shapes like a wedge you would only need an array of max 160
elements. For the rest of the circle you would need to have at a minimum of
four X's for each Y rather than two because there are places where it would
need two horizontal lines as you draw it raster by raster. Though you could
also "draw" both the wedge and the arc portion simultaneously and then use
odd & even to draw/fill it in.
/* Chris Faherty <[EMAIL PROTECTED]> */
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html