questionable patch: merge of a lot of stuff from the svg branch
[org.ibex.core.git] / src / org / ibex / plat / Java2.java
index 0fed4e9..92c9aa3 100644 (file)
@@ -90,6 +90,7 @@ public class Java2 extends AWT {
 
     public static class Java2Surface extends AWTSurface {
         public Java2Surface(Box root, boolean framed) { super(root, framed); }
+        public PixelBuffer getPixelBuffer() { return pb==null?(pb=new Java2PixelBuffer(this)):pb; }
         protected void _setMinimized(boolean b) {
             if (frame == null) Log.info(this, "JDK 1.2 can only minimize frames, not windows");
             else if (b) frame.setState(java.awt.Frame.ICONIFIED);
@@ -129,9 +130,9 @@ public class Java2 extends AWT {
             g.setComposite(AlphaComposite.SrcIn);
             g.setColor(new java.awt.Color((rgb & 0x00FF0000) >> 16, (rgb & 0x0000FF00) >> 8, (rgb & 0x000000FF)));
             g.fillRect(0, 0, i2.getWidth(null), i2.getHeight(null));
-            Graphics2D g2 = (Graphics2D)this.i.getGraphics().create();
-            g2.transform(new java.awt.geom.AffineTransform(a.a, a.b, a.c, a.d, a.e, a.f));
-            g2.drawImage(i2, 0, 0, null);
+            Graphics2D g2 = (Graphics2D)getGraphics();
+            if (a!=null) g2.drawImage(i2, new java.awt.geom.AffineTransform(a.a, a.b, a.c, a.d, a.e, a.f), null);
+            else         g2.drawImage(i2, 0, 0, null);
         }
 
         public void fill(Mesh p, org.ibex.graphics.Paint paint) { fillStroke(p, paint, true, false); }
@@ -153,6 +154,7 @@ public class Java2 extends AWT {
             if (stroke) ((Graphics2D)g).draw(gp);
                                                                                                      */}
 
+        public Java2PixelBuffer(Java2Surface s) { super(s); }
         public Java2PixelBuffer(int w, int h) {
             super(w,h);
             sm = cm.createCompatibleSampleModel(w, h);