aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-05-14 05:17:10 +0200
committerMattias Andrée <maandree@operamail.com>2013-05-14 05:17:10 +0200
commit1ea6279f72e2ce57bd422abd913a16e738d1e381 (patch)
tree36e216fa89c273f05719eeb026fbf44ef9764cf8
parentm (diff)
downloadsplashtool-1ea6279f72e2ce57bd422abd913a16e738d1e381.tar.gz
splashtool-1ea6279f72e2ce57bd422abd913a16e738d1e381.tar.bz2
splashtool-1ea6279f72e2ce57bd422abd913a16e738d1e381.tar.xz
m + I think this is how images are interpolated on widescreens, at the very least, it is more close1368501465
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile2
-rw-r--r--src/Assemble.java22
2 files changed, 19 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index c5020b3..80d0a9b 100644
--- a/Makefile
+++ b/Makefile
@@ -34,7 +34,7 @@ install: bin/Assemble.class splashtool.info.gz
install -m755 src/parse.py "$(DESTDIR)$(PREFIX)$(LIBEXEC)"/parse.py
install -m755 src/trim.py "$(DESTDIR)$(PREFIX)$(LIBEXEC)"/trim.py
install -m755 src/splashtool "$(DESTDIR)$(PREFIX)$(LIBEXEC)"/splashtool
- ln -s "$(PREFIX)$(LIBEXEC)"/splashtool "$(DESTDIR)$(PREFIX)$(BIN)"/splashtool
+ ln -sf "$(PREFIX)$(LIBEXEC)"/splashtool "$(DESTDIR)$(PREFIX)$(BIN)"/splashtool
install -m644 COPYING LICENSE '$(DESTDIR)$(LICENSES)/$(PKGNAME)'
install -m644 splashtool.info.gz "$(DESTDIR)$(PREFIX)$(DATA)/info/$(PKGNAME).info.gz"
diff --git a/src/Assemble.java b/src/Assemble.java
index 6a9a592..b5dfe3c 100644
--- a/src/Assemble.java
+++ b/src/Assemble.java
@@ -148,10 +148,24 @@ public class Assemble
private static BufferedImage widescreen(BufferedImage img)
{
BufferedImage rc = new BufferedImage(480 * 16 / 9, 480, BufferedImage.TYPE_INT_ARGB);
- Graphics2D g = rc.createGraphics();
- g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
- g.drawImage(img, 0, 0, 480 * 16 / 9, 480, 0, 0, 640, 480, null);
- g.dispose();
+ for (int y = 0; y < 480; y++)
+ for (int x = 0, e = 0; x < 640; x++)
+ {
+ rc.setRGB(x + e, y, img.getRGB(x, y));
+ if (x % 3 == 2)
+ if (x == 639)
+ rc.setRGB(x + ++e, y, img.getRGB(x, y));
+ else
+ {
+ int argb1 = img.getRGB(x, y);
+ int argb2 = img.getRGB(x + 1, y);
+ int a = (argb1 >>> 24) + (argb2 >>> 24);
+ int r = ((argb1 >> 16) & 255) + ((argb2 >> 16) & 255);
+ int g = ((argb1 >> 8) & 255) + ((argb2 >> 8) & 255);
+ int b = (argb1 & 255) + (argb2 & 255);
+ rc.setRGB(x + ++e, y, ((a >> 1) << 24) | ((r >> 1) << 16) | ((g >> 1) << 8) | (b >> 1));
+ }
+ }
return rc;
}