You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2020/11/04 21:24:21 UTC

svn commit: r1883129 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java

Author: kiwiwings
Date: Wed Nov  4 21:24:21 2020
New Revision: 1883129

URL: http://svn.apache.org/viewvc?rev=1883129&view=rev
Log:
Jpeg can't be processed with alpha channel

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java?rev=1883129&r1=1883128&r2=1883129&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/util/BitmapFormat.java Wed Nov  4 21:24:21 2020
@@ -42,7 +42,17 @@ public class BitmapFormat implements Out
 
     @Override
     public Graphics2D addSlide(double width, double height) {
-        img = new BufferedImage((int)width, (int)height, BufferedImage.TYPE_INT_ARGB);
+        int type;
+        switch (format) {
+            case "png":
+            case "gif":
+                type = BufferedImage.TYPE_INT_ARGB;
+                break;
+            default:
+                type = BufferedImage.TYPE_INT_RGB;
+                break;
+        }
+        img = new BufferedImage((int)width, (int)height, type);
         graphics = img.createGraphics();
         graphics.setRenderingHint(Drawable.BUFFERED_IMAGE, new WeakReference<>(img));
         return graphics;



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org