We don't provide such a facility in the J2SE APIs, but I would think that someone would have created an area calculation module somewhere.
One problem is that you have to be careful how you state the question because the answer depends on whether you are looking for:
- The discrete number of pixels which match a particular "enclosure" criterion, such as: - All of pixel is inside the path - Center of pixel is inside the path - Some of pixel is inside the path - The pixel would have been chosen to be "filled" by some particular rasterization algorithm. (Such an algorithm would always return an integer answer)
- The integrated area within the GeneralPath, expressed in unit measurements define by "pixels". This answer would more likely be expressed in fractional (or floatin point) form. It might also require specifying an AffineTransform that represents the mapping between the path geometry and the "pixel" or "measurement unit" grid.
I'm pretty sure someone might have written the latter type of algorithm as there was a discussion on here a few years ago about how to do this and whether or not the J2SE should provide such an API...
...jim
--On Wednesday, November 12, 2003 08:52:20 -0600 Ted Hill <[EMAIL PROTECTED]> wrote:
Is there anyway to get the area (number of pixels) enclosed by a closed non-self-intersecting GeneralPath?
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".