What does sun.awt.geom.Crossings do?

I've been away from Java for a few years, so forgive my rust. I have inherited some code targeting Java SE 1.5. When building under Java 1.7.0, there are some line warnings in the text:

Intersections is an internal native API and may be removed in a future release.

I would like to fix this assembly warning, perhaps replacing this code with my own. Examining the code, I see that the complete class in question is sun.awt.geom.Crossings

. Of course there is OpenJDK code , but I don't understand the general purpose of the class or its specific implementations. What's the purpose sun.awt.geom.Crossings

? Where can I find additional documentation?

+3


source to share


1 answer


With @ee. did not return to rewrite his or her comments as an answer, I will do it here. @ee. if you stop, I would be happy to tick your answer instead.

Check http://docstore.mik.ua/orelly/java/awt/ch02_01.htm#JAWT-CH-2-FIG-9 :



Filling polygons is a tricky topic. This is not as easy as filling rectangles or ovals, because the polygon cannot be closed and its edges can intersect. AWT uses an even rule to fill polygons. This algorithm works by counting the number of times each scan line crosses the edge of the polygon. If the total number of intersections to the left of the current point is odd, the point is colored. If it is even, the point is left alone.

You can see that the Crossings class is being used here; eg: Area.contains () to check for intersections of a rectangular area within an area. at http://kickjava.com/src/java/awt/geom/Area.java.htm . Since its application is mostly used inside other commonly used classes, you don't need to worry so much. But, if you use it directly, you may have a problem in the future!

+1


source







All Articles