[TeamTalk 321]: [857] trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/ Imager.java: Fixed camera image repaint in PenDecoder.

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Mon Oct 22 21:11:26 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20071022/684e279f/attachment.html
-------------- next part --------------
Modified: trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java
===================================================================
--- trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java	2007-10-22 03:45:42 UTC (rev 856)
+++ trunk/TeamTalk/Agents/PenDecoder/src/edu/cmu/ravenclaw/pendecoder/Imager.java	2007-10-23 01:11:25 UTC (rev 857)
@@ -8,7 +8,6 @@
 package edu.cmu.ravenclaw.pendecoder;
 
 import java.awt.*;
-import java.awt.image.BufferedImage;
 
 /**
  * This class manages the display of the robot camera images.
@@ -21,7 +20,7 @@
     /**
      * The image to display.
      */
-    protected BufferedImage image;
+    protected Image image;
     
     /**
      * Creates a new instance of Imager
@@ -33,21 +32,22 @@
      * @param i The new image.
      * @return true if the image dimensions have changed.
      */
-    public boolean setImage(BufferedImage i) {
+    public boolean setImage(Image i) {
         //keep native aspect ratio with a height of 200 pixels
         final int fixedHeight = 200;
         Dimension newDimensions = 
-                new Dimension(i.getWidth()*fixedHeight/i.getHeight(), 
+                new Dimension(i.getWidth(this)*fixedHeight/i.getHeight(this), 
                 fixedHeight);
         image = i;
         if(newDimensions != getPreferredSize()) {
             setPreferredSize(newDimensions);
+            repaint();
             return true;
         }
         repaint();
         return false;
     }
-  
+      
     /**
      * Paint the image.
      */


More information about the TeamTalk-developers mailing list