Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix bounding box for {draw,fill}Triangle().
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 4 Nov 2014 13:53:57 +0000 (14:53 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 4 Nov 2014 13:53:57 +0000 (14:53 +0100)
DrawingWindow.java
overview.html

index e7766d0..08f85e5 100644 (file)
@@ -7,6 +7,7 @@ import java.awt.Graphics2D;
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Polygon;
 import java.awt.Graphics;
 import java.awt.Point;
 import java.awt.Polygon;
+import java.awt.Rectangle;
 import java.awt.Toolkit;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
 import java.awt.Toolkit;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
@@ -34,7 +35,7 @@ import javax.swing.JPanel;
  * possible de fermer la fenêtre via le gestionnaire de fenêtres.
  *
  * @author Arnaud Giersch &lt;arnaud.giersch@univ-fcomte.fr&gt;
  * possible de fermer la fenêtre via le gestionnaire de fenêtres.
  *
  * @author Arnaud Giersch &lt;arnaud.giersch@univ-fcomte.fr&gt;
- * @version 20141021b
+ * @version 20141104
  */
 public class DrawingWindow {
 
  */
 public class DrawingWindow {
 
@@ -358,7 +359,9 @@ public class DrawingWindow {
         synchronized (image) {
             graphics.drawPolygon(poly);
         }
         synchronized (image) {
             graphics.drawPolygon(poly);
         }
-        panel.repaint(poly.getBounds());
+        Rectangle bounds = poly.getBounds();
+        bounds.setSize(bounds.width + 1, bounds.height + 1);
+        panel.repaint(bounds);
     }
 
     /**
     }
 
     /**
@@ -380,6 +383,8 @@ public class DrawingWindow {
             graphics.drawPolygon(poly);
             graphics.fillPolygon(poly);
         }
             graphics.drawPolygon(poly);
             graphics.fillPolygon(poly);
         }
+        Rectangle bounds = poly.getBounds();
+        bounds.setSize(bounds.width + 1, bounds.height + 1);
         panel.repaint(poly.getBounds());
     }
 
         panel.repaint(poly.getBounds());
     }
 
index c5058e8..26552c9 100644 (file)
@@ -39,6 +39,9 @@
     <h2>Modifications</h2>
 
     <p><pre>
     <h2>Modifications</h2>
 
     <p><pre>
+-- mar.  4 nov. 2014
+        * Correction de la boîte englobante pour {draw,fill}Triangle().
+
 -- mar. 21 oct. 2014
         * Les méthodes *sleep() sont `public'.
         * Vérification des coordonnées dans drawPoint().
 -- mar. 21 oct. 2014
         * Les méthodes *sleep() sont `public'.
         * Vérification des coordonnées dans drawPoint().