summaryrefslogtreecommitdiff
path: root/trunk/pdf-over-gui/src
diff options
context:
space:
mode:
authortkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:36:35 +0000
committertkellner <tkellner@3a0b52a2-8410-0410-bc02-ff6273a87459>2012-10-31 16:36:35 +0000
commit74af39df685584f6e9d298648f5e52e51cc99e31 (patch)
treeb06111fa3d564aaccd574ae2b30d8753e92f30c6 /trunk/pdf-over-gui/src
parent6e3760b19b64b9e00a641a5c6b32d369a895a23b (diff)
downloadpdf-over-74af39df685584f6e9d298648f5e52e51cc99e31.tar.gz
pdf-over-74af39df685584f6e9d298648f5e52e51cc99e31.tar.bz2
pdf-over-74af39df685584f6e9d298648f5e52e51cc99e31.zip
+ implemented fallback for placeholder creation
git-svn-id: https://svn.iaik.tugraz.at/svn/egiz/prj/current/12PDF-OVER-4.0@12694 3a0b52a2-8410-0410-bc02-ff6273a87459
Diffstat (limited to 'trunk/pdf-over-gui/src')
-rw-r--r--trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java23
-rw-r--r--trunk/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/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java
index 28fb55a6..83beceff 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/ImageConverter.java
+++ b/trunk/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/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
index 260f49d6..34430abb 100644
--- a/trunk/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
+++ b/trunk/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();
}