Revision: 20085 http://sourceforge.net/p/jmol/code/20085 Author: hansonr Date: 2014-10-16 11:42:16 +0000 (Thu, 16 Oct 2014) Log Message: ----------- GIFEncoder - no dithering of background
Modified Paths: -------------- trunk/Jmol/src/javajs/img/GifEncoder.java trunk/Jmol/src/org/jmol/scriptext/CmdExt.java Modified: trunk/Jmol/src/javajs/img/GifEncoder.java =================================================================== --- trunk/Jmol/src/javajs/img/GifEncoder.java 2014-10-16 00:12:29 UTC (rev 20084) +++ trunk/Jmol/src/javajs/img/GifEncoder.java 2014-10-16 11:42:16 UTC (rev 20085) @@ -168,6 +168,7 @@ private Map<String, Object> params; private int byteCount; int transparentColor; + private int backgroundColor; /** * we allow for animated GIF by being able to re-enter @@ -179,8 +180,13 @@ protected void setParams(Map<String, Object> params) { this.params = params; Integer ic = (Integer) params.get("transparentColor"); - if (ic != null) - transparentColor = ic.intValue(); + if (ic == null) { + ic = (Integer) params.get("backgroundColor"); + if (ic != null) + backgroundColor = ic.intValue(); + } else { + backgroundColor = transparentColor = ic.intValue(); + } interlaced = (Boolean.TRUE == params.get("interlaced")); if (interlaced || !params.containsKey("captureMode")) return; @@ -342,7 +348,7 @@ for (int i = 0; i < height; ++i) { boolean lastRow = (i == height - 1); for (int j = 0; j < width; ++j) { - if (sb[++ci] != transparentColor) { + if (sb[++ci] != backgroundColor) { boolean notLastCol = (j < width - 1); for (int k = 0; k < 3; k++) { int cc = sb[++ci]; @@ -384,7 +390,7 @@ for (int i = 0, j = 0; i < n;) { int alpha = imgData[j++]; if (alpha == 0xFE) { - iData[i++] = transparentColor; + iData[i++] = backgroundColor; j += 3; continue; } @@ -404,7 +410,7 @@ int[] iData = new int[n]; for (int i = 0, j = 0; i < n; j++) { int a = argbs[j]; - iData[i++] = (a == transparentColor ? 0xFE : (a >> 24) & 0xFF); + iData[i++] = (a == backgroundColor ? 0xFE : (a >> 24) & 0xFF); iData[i++] = (a >> 16) & 0xFF; iData[i++] = (a >> 8) & 0xFF; iData[i++] = a & 0xFF; Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2014-10-16 00:12:29 UTC (rev 20084) +++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java 2014-10-16 11:42:16 UTC (rev 20085) @@ -568,8 +568,10 @@ if (chk || params == null) return; params.put("type", "GIF"); + Integer c = Integer.valueOf(vwr.getBackgroundArgb()); + params.put("backgroundColor", c); if (isTransparent) - params.put("transparentColor", Integer.valueOf(vwr.getBackgroundArgb())); + params.put("transparentColor", c); params.put("fileName", fileName); params.put("quality", Integer.valueOf(-1)); params.put( @@ -6367,6 +6369,7 @@ Integer.valueOf(vwr.getBackgroundArgb())); type = "GIF"; } + params.put("backgroundColor", Integer.valueOf(vwr.getBackgroundArgb())); params.put("type", type); if (bytes instanceof String && quality == Integer.MIN_VALUE) params.put("text", bytes); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits