Revert "Force image to be a RGB image (there is no writer to convert ARGB type to... 68/16168/3
Vincent COUVERT [Wed, 18 Mar 2015 08:19:43 +0000 (09:19 +0100)]
This reverts commit 814e090c1e336aae6a540ec6030c991af0c7b4d6.

Change-Id: I650aa93d0219cf55e968f108a8390a83d5572d65

scilab/modules/graphic_export/src/java/org/scilab/modules/graphic_export/Export.java
scilab/modules/scirenderer/src/org/scilab/forge/scirenderer/implementation/jogl/JoGLCanvas.java

index 138dfed..bf38ca1 100644 (file)
@@ -364,8 +364,9 @@ public class Export {
             }
 
             if (joglCanvas != null) {
+                BufferedImage image = joglCanvas.getImage();
+                //joglCanvas.destroy();
                 PNGExporter exporter = (PNGExporter) getExporter(type);
-                BufferedImage image = joglCanvas.getImage(exporter.isAlphaChannelSupported());
                 exporter.setImage(file, image, params);
                 exporter.write();
                 exporter.dispose();
@@ -540,11 +541,6 @@ public class Export {
                 g2d.dispose();
             }
         }
-
-        public boolean isAlphaChannelSupported() {
-            return true;
-        }
-
     }
 
     /**
@@ -558,11 +554,6 @@ public class Export {
         public void write() throws IOException {
             ExportBitmap.writeFile(image, "gif", file);
         }
-
-        public boolean isAlphaChannelSupported() {
-            return false;
-        }
-
     }
 
     /**
@@ -586,11 +577,6 @@ public class Export {
         public void write() throws IOException {
             ExportBitmap.writeFile(image, "bmp", file);
         }
-
-        public boolean isAlphaChannelSupported() {
-            return false;
-        }
-
     }
 
     /**
@@ -608,11 +594,6 @@ public class Export {
                 ExportBitmap.writeJPEG(image, params.compressionQuality, file);
             }
         }
-
-        public boolean isAlphaChannelSupported() {
-            return false;
-        }
-
     }
 
     /**
index 538d476..169067f 100644 (file)
@@ -233,14 +233,6 @@ public final class JoGLCanvas implements Canvas, GLEventListener {
      * @return an image
      */
     public BufferedImage getImage() {
-        return getImage(true);
-    }
-
-    /**
-     * Get an image from the autoDrawable
-     * @return an image
-     */
-    public BufferedImage getImage(final boolean alpha) {
         while (!canvasAnimator.isDrawFinished() || !displayFinished) {
             try {
                 Thread.sleep(10);
@@ -254,7 +246,7 @@ public final class JoGLCanvas implements Canvas, GLEventListener {
 
         if (SwingUtilities.isEventDispatchThread()) {
             context.makeCurrent();
-            AWTGLReadBufferUtil buffer = new AWTGLReadBufferUtil(GLProfile.getDefault(), alpha);
+            AWTGLReadBufferUtil buffer = new AWTGLReadBufferUtil(GLProfile.getDefault(), true);
             image[0] = buffer.readPixelsToBufferedImage(getGl(), 0, 0, autoDrawable.getSurfaceWidth(), autoDrawable.getSurfaceHeight(), true);
             context.release();
         } else {
@@ -262,7 +254,7 @@ public final class JoGLCanvas implements Canvas, GLEventListener {
                 SwingUtilities.invokeAndWait(new Runnable() {
                     public void run() {
                         context.makeCurrent();
-                        AWTGLReadBufferUtil buffer = new AWTGLReadBufferUtil(GLProfile.getDefault(), alpha);
+                        AWTGLReadBufferUtil buffer = new AWTGLReadBufferUtil(GLProfile.getDefault(), true);
                         image[0] = buffer.readPixelsToBufferedImage(getGl(), 0, 0, autoDrawable.getSurfaceWidth(), autoDrawable.getSurfaceHeight(), true);
                         context.release();
                     }