You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Nellya Udovichenko (JIRA)" <ji...@apache.org> on 2007/08/17 15:40:30 UTC
[jira] Closed: (HARMONY-4410) [classlib][awt] The method
java.awt.geom.Area.subtract() returns no correct result when the first
figure lies inside the second one
[ https://issues.apache.org/jira/browse/HARMONY-4410?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Nellya Udovichenko closed HARMONY-4410.
---------------------------------------
Verified. Thank you, Alexey!
> [classlib][awt] The method java.awt.geom.Area.subtract() returns no correct result when the first figure lies inside the second one
> -----------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-4410
> URL: https://issues.apache.org/jira/browse/HARMONY-4410
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Nellya Udovichenko
> Assignee: Alexey Petrenko
> Attachments: H-4410-test.patch, H-4410.patch
>
>
> There are two polygonal figures: Figure 1 and Figure 2. Figure 2 lies inside Figure 1 and intersects with Figure 1 in two boundary points. At subtraction of Figure 2 from Figure 1 we get no correct result - Figure 1.
> Test:
> import java.awt.*;
> import java.awt.geom.Rectangle2D;
> import java.awt.geom.Area;
> import javax.swing.JFrame;
> import javax.swing.JPanel;
> public class PolygonTest extends JPanel {
> protected void paintComponent(Graphics g) {
> Graphics2D g2 = (Graphics2D) g;
>
> Rectangle2D rect1 = new Rectangle2D.Double(300, 300, 200, 150);
> Rectangle2D rect2 = new Rectangle2D.Double(350, 200, 300, 150);
> Area area1 = new Area(rect1);
> g2.setColor(Color.green);
> g2.draw(area1);
>
> Area area2 = new Area(rect2);
> g2.setColor(Color.red);
> g2.draw(area2);
> Area a = (Area) area1.clone();
> a.intersect(area2);
> area1.add(area2);
> area1.subtract(a);
> g2.setColor(Color.cyan);
> g2.draw(area1);
> }
> public static void main(String[] args) {
> JFrame frame = new JFrame();
> frame.getContentPane().setLayout(new BorderLayout());
> frame.getContentPane().add(new PolygonTest());
> frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> frame.setSize(800, 600);
> frame.setVisible(true);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.