[stegosuite] 01/02: Imported Upstream version 0.7.3
Tobias Ilte
menosmalo-guest at moszumanska.debian.org
Sun Jun 12 12:12:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
menosmalo-guest pushed a commit to branch master
in repository stegosuite.
commit e2075952a324e85b48aec536030b22e65e9a857d
Author: Tobias Ilte <tobias at stegosuite.org>
Date: Sun Jun 12 14:11:36 2016 +0200
Imported Upstream version 0.7.3
---
.gitignore | 19 +++
CHANGELOG | 4 +
pom.xml | 2 +-
src/deb/data/stegosuite.desktop | 6 +-
.../image/util/ImageSwtAwtConverter.java | 169 ++++++---------------
5 files changed, 77 insertions(+), 123 deletions(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..defa0c2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+/bin/
+/target/
+.settings/
+.classpath
+.project
+.project.swp
+.pmd
+
+## Exclude latex auxiliary files
+*.aux
+*.toc
+*.out
+*.log
+*.lof
+*.ind
+*.ilg
+*.idx
+*.fls
+*.synctex.gz
diff --git a/CHANGELOG b/CHANGELOG
index fd38bc9..01fbd3f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+0.7.3
+ - updated .desktop file
+ - internal changes
+
0.7.2
- disabled cli
- more information in pom.xml
diff --git a/pom.xml b/pom.xml
index c5b879e..4fe3037 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.stegosuite</groupId>
<artifactId>stegosuite</artifactId>
- <version>0.7.2</version>
+ <version>0.7.3</version>
<name>stegosuite</name>
<description>A free steganography tool to hide information in image files.</description>
<url>https://dev.stegosuite.org/stegosuite/stegosuite</url>
diff --git a/src/deb/data/stegosuite.desktop b/src/deb/data/stegosuite.desktop
index d3124d9..92cfc26 100644
--- a/src/deb/data/stegosuite.desktop
+++ b/src/deb/data/stegosuite.desktop
@@ -1,10 +1,10 @@
[Desktop Entry]
Name=Stegosuite
-Categories=Graphics;
+Categories=Graphics;2DGraphics;RasterGraphics;
Comment=A steganography tool
Exec=stegosuite %u
Icon=/usr/share/stegosuite/icons/stegosuite.png
MimeType=image/gif;image/bmp;image/jpeg;
+Keywords=steganography;embed;extract;image;hide;stego;
Terminal=false
-Type=Application
-
+Type=Application
\ No newline at end of file
diff --git a/src/main/java/org/stegosuite/image/util/ImageSwtAwtConverter.java b/src/main/java/org/stegosuite/image/util/ImageSwtAwtConverter.java
index 3a093fd..132628e 100644
--- a/src/main/java/org/stegosuite/image/util/ImageSwtAwtConverter.java
+++ b/src/main/java/org/stegosuite/image/util/ImageSwtAwtConverter.java
@@ -1,87 +1,22 @@
package org.stegosuite.image.util;
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;
+import java.util.stream.IntStream;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
import org.eclipse.swt.graphics.RGB;
-/*******************************************************************************
- * Copyright (c) 2000, 2004 IBM Corporation and others. All rights reserved. This program and the
- * accompanying materials are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Additional source: http://stackoverflow.com/a/27652052
- */
public class ImageSwtAwtConverter {
/** Private constructor to hide the implicit public one */
private ImageSwtAwtConverter() {}
/**
- * Convert a given SWT's {@link ImageData} into AWT's {@link BufferedImage}
- *
- * @param imageData the {@link ImageData} to be converted
- *
- * @return the associated {@link BufferedImage}
- */
- public static BufferedImage convertToAWT(ImageData imageData) {
- ColorModel colorModel = null;
- PaletteData palette = imageData.palette;
- if (palette.isDirect) {
- BufferedImage bufferedImage = new BufferedImage(imageData.width, imageData.height,
- BufferedImage.TYPE_INT_ARGB);
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- int pixel = imageData.getPixel(x, y);
- RGB rgb = palette.getRGB(pixel);
- bufferedImage.setRGB(x, y,
- imageData.getAlpha(x, y) << 24 | rgb.red << 16 | rgb.green << 8 | rgb.blue);
- }
- }
- return bufferedImage;
- } else {
- RGB[] rgbs = palette.getRGBs();
- byte[] red = new byte[rgbs.length];
- byte[] green = new byte[rgbs.length];
- byte[] blue = new byte[rgbs.length];
- for (int i = 0; i < rgbs.length; i++) {
- RGB rgb = rgbs[i];
- red[i] = (byte) rgb.red;
- green[i] = (byte) rgb.green;
- blue[i] = (byte) rgb.blue;
- }
- if (imageData.transparentPixel != -1) {
- colorModel = new IndexColorModel(imageData.depth, rgbs.length, red, green, blue,
- imageData.transparentPixel);
- } else {
- colorModel = new IndexColorModel(imageData.depth, rgbs.length, red, green, blue);
- }
- BufferedImage bufferedImage = new BufferedImage(colorModel,
- colorModel.createCompatibleWritableRaster(imageData.width, imageData.height), false, null);
- WritableRaster raster = bufferedImage.getRaster();
- int[] pixelArray = new int[1];
- for (int y = 0; y < imageData.height; y++) {
- for (int x = 0; x < imageData.width; x++) {
- int pixel = imageData.getPixel(x, y);
- pixelArray[0] = pixel;
- raster.setPixel(x, y, pixelArray);
- }
- }
- return bufferedImage;
- }
- }
-
- /**
* Convert a given AWT's {@link BufferedImage} into SWT's {@link ImageData}
*
* @param bufferedImage the {@link BufferedImage} to be converted
@@ -92,67 +27,63 @@ public class ImageSwtAwtConverter {
int w = bufferedImage.getWidth();
int h = bufferedImage.getHeight();
if (bufferedImage.getColorModel() instanceof DirectColorModel) {
- DirectColorModel colorModel = (DirectColorModel) bufferedImage.getColorModel();
- PaletteData palette = new PaletteData(colorModel.getRedMask(), colorModel.getGreenMask(),
- colorModel.getBlueMask());
- ImageData data = new ImageData(w, h, colorModel.getPixelSize(), palette);
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- int rgb = bufferedImage.getRGB(x, y);
- int pixel = palette.getPixel(new RGB((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF));
- data.setPixel(x, y, pixel);
- if (colorModel.hasAlpha()) {
- data.setAlpha(x, y, (rgb >> 24) & 0xFF);
- }
+ DirectColorModel cm = (DirectColorModel) bufferedImage.getColorModel();
+ PaletteData paletteData = new PaletteData(cm.getRedMask(), cm.getGreenMask(), cm.getBlueMask());
+ ImageData imageData = new ImageData(w, h, cm.getPixelSize(), paletteData);
+
+ WritableRaster raster = bufferedImage.getRaster();
+ int[] pixelArray = new int[bufferedImage.getColorModel().getComponentSize().length];
+
+ IntStream.range(0, h).forEach(y -> IntStream.range(0, w).forEach(x -> {
+ raster.getPixel(x, y, pixelArray);
+ int pixel = paletteData.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2]));
+ imageData.setPixel(x, y, pixel);
+ if (cm.hasAlpha()) {
+ imageData.setAlpha(x, y, pixelArray[3]);
}
- }
- return data;
+ }));
+
+ return imageData;
} else if (bufferedImage.getColorModel() instanceof IndexColorModel) {
- IndexColorModel colorModel = (IndexColorModel) bufferedImage.getColorModel();
- int size = colorModel.getMapSize();
- byte[] reds = new byte[size];
- byte[] greens = new byte[size];
- byte[] blues = new byte[size];
- colorModel.getReds(reds);
- colorModel.getGreens(greens);
- colorModel.getBlues(blues);
- RGB[] rgbs = new RGB[size];
- for (int i = 0; i < rgbs.length; i++) {
- rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF);
- }
- PaletteData palette = new PaletteData(rgbs);
- ImageData data = new ImageData(w, h, colorModel.getPixelSize(), palette);
- data.transparentPixel = colorModel.getTransparentPixel();
+ IndexColorModel cm = (IndexColorModel) bufferedImage.getColorModel();
+ int arrayLength = cm.getMapSize();
+ byte[] reds = new byte[arrayLength];
+ byte[] greens = new byte[arrayLength];
+ byte[] blues = new byte[arrayLength];
+ cm.getReds(reds);
+ cm.getGreens(greens);
+ cm.getBlues(blues);
+ RGB[] rgbs = new RGB[arrayLength];
+ IntStream.range(0, rgbs.length)
+ .forEach(i -> rgbs[i] = new RGB(reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF));
+ PaletteData paletteData = new PaletteData(rgbs);
+ ImageData imageData = new ImageData(w, h, cm.getPixelSize(), paletteData);
+ imageData.transparentPixel = cm.getTransparentPixel();
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[1];
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- raster.getPixel(x, y, pixelArray);
- data.setPixel(x, y, pixelArray[0]);
- }
- }
- return data;
+
+ IntStream.range(0, h).forEach(y -> IntStream.range(0, w).forEach(x -> {
+ raster.getPixel(x, y, pixelArray);
+ imageData.setPixel(x, y, pixelArray[0]);
+ }));
+
+ return imageData;
} 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(w, h, colorModel.getPixelSize(), palette);
- // This is valid because we are using a 3-byte Data model with no fixed transparent
- // pixel color
- data.transparentPixel = -1;
+ ComponentColorModel cm = (ComponentColorModel) bufferedImage.getColorModel();
+ PaletteData paletteData = new PaletteData(0x0000FF, 0x00FF00, 0xFF0000);
+ ImageData imageData = new ImageData(w, h, cm.getPixelSize(), paletteData);
WritableRaster raster = bufferedImage.getRaster();
int[] pixelArray = new int[bufferedImage.getColorModel().getComponentSize().length];
- for (int y = 0; y < h; y++) {
- for (int x = 0; x < w; x++) {
- raster.getPixel(x, y, pixelArray);
- int pixel = palette.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2]));
- data.setPixel(x, y, pixel);
- if (colorModel.hasAlpha()) {
- data.setAlpha(x, y, pixelArray[3]);
- }
+
+ IntStream.range(0, h).forEach(y -> IntStream.range(0, w).forEach(x -> {
+ raster.getPixel(x, y, pixelArray);
+ int pixel = paletteData.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2]));
+ imageData.setPixel(x, y, pixel);
+ if (cm.hasAlpha()) {
+ imageData.setAlpha(x, y, pixelArray[3]);
}
- }
- return data;
+ }));
+ return imageData;
}
return null;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/stegosuite.git
More information about the pkg-java-commits
mailing list