aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-common/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-24 14:20:54 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-10-24 14:20:54 +0200
commitd1a9624a16d8ba5e6ef393c4a984790e44797c59 (patch)
tree08c0a1313e7cf4cfb36e55b6ec8261be5f4d0b7e /pdf-as-common/src/main
parent394f409032f5af13a34faac251d9929ef64729d1 (diff)
downloadpdf-as-4-d1a9624a16d8ba5e6ef393c4a984790e44797c59.tar.gz
pdf-as-4-d1a9624a16d8ba5e6ef393c4a984790e44797c59.tar.bz2
pdf-as-4-d1a9624a16d8ba5e6ef393c4a984790e44797c59.zip
enable Alpha Channel images
Diffstat (limited to 'pdf-as-common/src/main')
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/ImageUtils.java17
1 files changed, 6 insertions, 11 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/ImageUtils.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/ImageUtils.java
index b426e1ce..dcf1f17b 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/ImageUtils.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/ImageUtils.java
@@ -23,9 +23,11 @@
******************************************************************************/
package at.gv.egiz.pdfas.common.utils;
+import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
+import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
@@ -51,15 +53,8 @@ public class ImageUtils {
.getLogger(ImageUtils.class);
public static BufferedImage removeAlphaChannel(BufferedImage src) {
- /*if (src.getColorModel().hasAlpha())
+ if (src.getColorModel().hasAlpha())
{
- // extract the alpha information
- // WritableRaster alphaRaster = src.
- //ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY),
- // false, false, Transparency.OPAQUE, DataBuffer.TYPE_BYTE);
- //alpha = new BufferedImage(cm, alphaRaster, false, null);
- // create a RGB image without alpha
-
BufferedImage image = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.setComposite(AlphaComposite.Src);
@@ -67,8 +62,8 @@ public class ImageUtils {
g.dispose();
return image;
}
- return src;*/
-
+ return src;
+ /*
BufferedImage rgbImage = new BufferedImage(src.getWidth(), src.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
for (int x = 0; x < src.getWidth(); ++x)
{
@@ -77,7 +72,7 @@ public class ImageUtils {
rgbImage.setRGB(x, y, src.getRGB(x, y) & 0xFFFFFF);
}
}
- return rgbImage;
+ return rgbImage;*/
}
public static BufferedImage convertRGBAToIndexed(BufferedImage src) {