summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:03:57 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 19:03:57 +0000
commit1b677f9837595d29a82c8be03ed4a4a1e3f6d482 (patch)
tree7c77eeb13a4d5390eae64aa2fb95ed3ecc11680b /pdf-over-gui/src/main/java/at/asit
parent7fb08fc5b27c7dacb5afe91eb8c1e7f6bf403b04 (diff)
downloadpdf-over-1b677f9837595d29a82c8be03ed4a4a1e3f6d482.tar.gz
pdf-over-1b677f9837595d29a82c8be03ed4a4a1e3f6d482.tar.bz2
pdf-over-1b677f9837595d29a82c8be03ed4a4a1e3f6d482.zip
+ implemented fallback for placeholder creation
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@108 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java23
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java1
2 files changed, 22 insertions, 2 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java
index 28fb55a6..83beceff 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java
@@ -18,6 +18,7 @@ package at.asit.pdfover.gui;
// Imports
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
import java.awt.image.DirectColorModel;
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
@@ -147,8 +148,28 @@ public class ImageConverter {
}
}
return data;
+ } else if (bufferedImage.getColorModel() instanceof ComponentColorModel) {
+ ComponentColorModel colorModel = (ComponentColorModel)bufferedImage.getColorModel();
+
+ //ASSUMES: 3 BYTE BGR IMAGE TYPE
+
+ PaletteData palette = new PaletteData(0x0000FF, 0x00FF00,0xFF0000);
+ ImageData data = new ImageData(bufferedImage.getWidth(), bufferedImage.getHeight(), colorModel.getPixelSize(), palette);
+
+ //This is valid because we are using a 3-byte Data model with no transparent pixels
+ data.transparentPixel = -1;
+
+ WritableRaster raster = bufferedImage.getRaster();
+ int[] pixelArray = new int[3];
+ for (int y = 0; y < data.height; y++) {
+ for (int x = 0; x < data.width; x++) {
+ raster.getPixel(x, y, pixelArray);
+ int pixel = palette.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2]));
+ data.setPixel(x, y, pixel);
+ }
+ }
+ return data;
}
return null;
}
-
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
index 260f49d6..34430abb 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
@@ -62,7 +62,6 @@ public class PostSLRequestThread implements Runnable {
@Override
public long getLength() {
- // TODO Auto-generated method stub
return this.source.getLength();
}