diff --git a/host/shiver/pom.xml b/host/shiver/pom.xml index 13a29c7..7dea0ea 100644 --- a/host/shiver/pom.xml +++ b/host/shiver/pom.xml @@ -20,10 +20,12 @@ UTF-8 UTF-8 0.9.2 + 3.2.1 - + + io.dropwizard dropwizard-core ${dropwizard.version} @@ -107,7 +109,12 @@ bootstrap 3.3.6 - + + + com.twelvemonkeys.common + common-image + ${twelve.version} + diff --git a/host/shiver/src/main/java/dk/osaa/psaw/job/DitherFloydSteinberg.java b/host/shiver/src/main/java/dk/osaa/psaw/job/DitherFloydSteinberg.java deleted file mode 100644 index f964dfa..0000000 --- a/host/shiver/src/main/java/dk/osaa/psaw/job/DitherFloydSteinberg.java +++ /dev/null @@ -1,94 +0,0 @@ -package dk.osaa.psaw.job; - -import java.awt.Color; -import java.awt.image.BufferedImage; - -public class DitherFloydSteinberg { - private static final C3[] palette = new C3[] { - new C3( 0, 0, 0), - new C3(255, 255, 255) - }; - - public static BufferedImage dither(BufferedImage img) { - - int w = img.getWidth(); - int h = img.getHeight(); - - C3[][] d = new C3[h][w]; - - for (int y = 0; y < h; y++) - for (int x = 0; x < w; x++) - d[y][x] = new C3(img.getRGB(x, y)); - - for (int y = 0; y < img.getHeight(); y++) { - for (int x = 0; x < img.getWidth(); x++) { - - C3 oldColor = d[y][x]; - C3 newColor = findClosestPaletteColor(oldColor, palette); - img.setRGB(x, y, newColor.toColor().getRGB()); - - C3 err = oldColor.sub(newColor); - - if (x+1 < w) d[y ][x+1] = d[y ][x+1].add(err.mul(7./16)); - if (x-1>=0 && y+1