summaryrefslogtreecommitdiff
path: root/pdf-over-commons/src/main/java/at/asit
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-12 14:16:28 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-12 14:16:28 +0200
commit54103661e771be012eb0f872827ec37158286f69 (patch)
treebd7212f2e455eab2cfa2596d10e8c43c52b020a9 /pdf-over-commons/src/main/java/at/asit
parentd15cdc1eeef684fdcc7dfbe8cc82397c96b1cf19 (diff)
downloadpdf-over-54103661e771be012eb0f872827ec37158286f69.tar.gz
pdf-over-54103661e771be012eb0f872827ec37158286f69.tar.bz2
pdf-over-54103661e771be012eb0f872827ec37158286f69.zip
debugDisplayImage for ImageData
Diffstat (limited to 'pdf-over-commons/src/main/java/at/asit')
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
index f26a1547..f68f73ec 100644
--- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
+++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
@@ -15,7 +15,6 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
@@ -175,28 +174,32 @@ public final class ImageUtil {
return image;
}
- public static org.eclipse.swt.graphics.Image debugDisplayImage(org.eclipse.swt.graphics.Image image) {
+ public static org.eclipse.swt.graphics.ImageData debugDisplayImage(org.eclipse.swt.graphics.ImageData image) {
Display display = Display.getDefault();
Shell shell = new Shell(display, SWT.CLOSE);
shell.setLayout(new FormLayout());
- Rectangle imgBounds = image.getBounds();
Label imgLabel = new Label(shell, SWT.NATIVE);
FormData imgFD = new FormData();
imgFD.left = new FormAttachment(0);
imgFD.top = new FormAttachment(0);
- imgFD.width = imgBounds.width;
- imgFD.height = imgBounds.height;
+ imgFD.width = image.width;
+ imgFD.height = image.height;
imgLabel.setLayoutData(imgFD);
- imgLabel.setImage(image);
+ imgLabel.setImage(new org.eclipse.swt.graphics.Image(display, image));
- shell.setSize(imgBounds.width + 20, imgBounds.height + 60);
+ shell.setSize(image.width + 20, image.height + 60);
shell.open();
shell.forceActive();
return image;
}
+ public static org.eclipse.swt.graphics.Image debugDisplayImage(org.eclipse.swt.graphics.Image image) {
+ debugDisplayImage(image.getImageData());
+ return image;
+ }
+
/**
* Convert AWT Image to SWT Image
*