/[classpath]/classpath/gnu/java/awt/peer/qt/QtVolatileImage.java
ViewVC logotype

Diff of /classpath/gnu/java/awt/peer/qt/QtVolatileImage.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by gnu_andrew, Tue Aug 16 16:22:36 2005 UTC revision 1.1.2.2 by gnu_andrew, Sat Sep 10 15:31:38 2005 UTC
# Line 54  import java.awt.image.VolatileImage; Line 54  import java.awt.image.VolatileImage;
54  import java.io.File;  import java.io.File;
55  import java.io.IOException;  import java.io.IOException;
56  import java.util.Hashtable;  import java.util.Hashtable;
57    import java.util.WeakHashMap;
58  import java.util.Vector;  import java.util.Vector;
59    
60  /**  /**
# Line 99  public class QtVolatileImage extends Vol Line 100  public class QtVolatileImage extends Vol
100    private native void createImage();    private native void createImage();
101    
102    /**    /**
103       * HashMap of Graphics objects painting on this Image.
104       */
105      WeakHashMap painters;
106    
107      /**
108       * Flags if this image is to be destroyed.
109       */
110      boolean killFlag;
111    
112      /**
113     * Frees the above.     * Frees the above.
114     */     */
115    private native void freeImage();    private native void freeImage();
116    
117    /**    /**
118       * Blit a QImage
119       */
120      public native void blit(QtImage i);
121      public native void blit(QtImage i, int x, int y, int w, int h);
122    
123      /**
124     * Sets the image to scaled copy of src image. hints are rendering hints.     * Sets the image to scaled copy of src image. hints are rendering hints.
125     */     */
126    private native void createScaledImage(QtVolatileImage src, int hints);    private native void createScaledImage(QtVolatileImage src, int hints);
# Line 131  public class QtVolatileImage extends Vol Line 148  public class QtVolatileImage extends Vol
148    /**    /**
149     * Draws the image scaled flipped and optionally composited.     * Draws the image scaled flipped and optionally composited.
150     */     */
151    private native void drawPixelsScaledFlipped (QtGraphics gc,    native void drawPixelsScaledFlipped (QtGraphics gc,
152                                                 int bg_red, int bg_green,                                         int bg_red, int bg_green,
153                                                 int bg_blue,                                         int bg_blue,
154                                                 boolean flipX, boolean flipY,                                         boolean flipX, boolean flipY,
155                                                 int srcX, int srcY,                                         int srcX, int srcY,
156                                                 int srcWidth, int srcHeight,                                         int srcWidth, int srcHeight,
157                                                 int dstX, int dstY,                                         int dstX, int dstY,
158                                                 int dstWidth, int dstHeight,                                         int dstWidth, int dstHeight,
159                                                 boolean composite);                                         boolean composite);
160    
161    /**    /**
162     * Constructs an empty QtVolatileImage.     * Constructs an empty QtVolatileImage.
# Line 166  public class QtVolatileImage extends Vol Line 183  public class QtVolatileImage extends Vol
183      createScaledImage(src, hints);      createScaledImage(src, hints);
184    }    }
185    
186    
187      public void finalize()
188      {
189        dispose();
190      }
191    
192      public void dispose()
193      {
194        if( painters == null || painters.isEmpty() )
195          freeImage();
196        else
197          killFlag = true; // can't destroy image yet.
198        // Do so when all painters are gone.
199      }
200    
201    // java.awt.Image methods ////////////////////////////////////////////////    // java.awt.Image methods ////////////////////////////////////////////////
202    
203    public int getWidth (ImageObserver observer)    public int getWidth (ImageObserver observer)
# Line 193  public class QtVolatileImage extends Vol Line 225  public class QtVolatileImage extends Vol
225                                   0, width);                                   0, width);
226    }    }
227    
228      void putPainter(QtImageGraphics g)
229      {
230        if( painters == null )
231          painters = new WeakHashMap();
232        painters.put( g, "dummy" );
233      }
234    
235      void removePainter(QtImageGraphics g)
236      {
237        painters.remove( g );
238        if( killFlag && painters.isEmpty() )
239          freeImage();
240      }
241    
242    /**    /**
243     * Creates a Graphics context for this image.     * Creates a Graphics context for this image.
244     */     */
245    public Graphics getGraphics ()    public Graphics getGraphics ()
246    {    {
247      return new QtImageGraphics( this );      QtImageGraphics g = new QtImageGraphics( this );
248        putPainter( g );
249        return g;
250    }    }
251        
252    /**    /**
# Line 222  public class QtVolatileImage extends Vol Line 270  public class QtVolatileImage extends Vol
270      // FIXME ?      // FIXME ?
271    }    }
272    
   public void finalize()  
   {  
     freeImage();  
   }  
   
273    /**    /**
274     * Returns the image status, used by QtToolkit     * Returns the image status, used by QtToolkit
275     */     */
# Line 354  public class QtVolatileImage extends Vol Line 397  public class QtVolatileImage extends Vol
397    
398    public Graphics2D createGraphics()    public Graphics2D createGraphics()
399    {    {
400      return new QtImageGraphics(this);      QtImageGraphics g = new QtImageGraphics(this);
401        putPainter( g );
402        return g;
403    }    }
404    
405    public ImageCapabilities getCapabilities()    public ImageCapabilities getCapabilities()

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26