Revision: 20082 http://sourceforge.net/p/jmol/code/20082 Author: hansonr Date: 2014-10-16 00:09:49 +0000 (Thu, 16 Oct 2014) Log Message: ----------- Jmol.___JmolVersion="14.3.8_2014.10.15b"
bug fix: GIFT (transparent-background GIF) Modified Paths: -------------- trunk/Jmol/src/javajs/img/GifEncoder.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/javajs/img/GifEncoder.java =================================================================== --- trunk/Jmol/src/javajs/img/GifEncoder.java 2014-10-15 12:38:09 UTC (rev 20081) +++ trunk/Jmol/src/javajs/img/GifEncoder.java 2014-10-16 00:09:49 UTC (rev 20082) @@ -338,23 +338,27 @@ int w4 = width * 4; int r1 = 25; int r2 = 2 * r1 + 1; + int ci = -1; for (int i = 0; i < height; ++i) { + boolean lastRow = (i == height - 1); for (int j = 0; j < width; ++j) { - for (int k = 0; k < 3; k++) { - int ci = 4 * (i * width + j) + k + 1; - int cc = sb[ci]; - int rc = Math.round((cc + r1) / r2) * r2; - int err = cc - rc; - sb[ci] = rc; - if (j + 1 < width) - sb[ci + 4] += (err * 7) >> 4; - if (i + 1 == height) - continue; - if (j > 0) - sb[ci + w4 - 4] += (err * 3) >> 4; - sb[ci + w4] += (err * 5) >> 4; - if (j + 1 < width) - sb[ci + w4 + 4] += (err * 1) >> 4; + if (sb[++ci] != transparentColor) { + boolean notLastCol = (j < width - 1); + for (int k = 0; k < 3; k++) { + int cc = sb[++ci]; + int rc = Math.round((cc + r1) / r2) * r2; + int err = cc - rc; + sb[ci] = rc; + if (notLastCol) + sb[ci + 4] += (err * 7) >> 4; + if (lastRow) + continue; + if (j > 0) + sb[ci + w4 - 4] += (err * 3) >> 4; + sb[ci + w4] += (err * 5) >> 4; + if (notLastCol) + sb[ci + w4 + 4] += (err * 1) >> 4; + } } } } @@ -368,7 +372,7 @@ return colorVector; } - static int[] toIntARGB(int[] imgData) { + int[] toIntARGB(int[] imgData) { /* * red=imgData.data[0]; * green=imgData.data[1]; @@ -378,12 +382,18 @@ int n = imgData.length / 4; int[] iData = new int[n]; for (int i = 0, j = 0; i < n;) { - iData[i++] = (imgData[j++] << 24) | (imgData[j++] << 16) | imgData[j++] << 8 | imgData[j++]; + int alpha = imgData[j++]; + if (alpha == 0xFE) { + iData[i++] = transparentColor; + j += 3; + continue; + } + iData[i++] = (alpha << 24) | (imgData[j++] << 16) | imgData[j++] << 8 | imgData[j++]; } return iData; } - static int[] toByteARGB(int[] argbs) { + int[] toByteARGB(int[] argbs) { /* * red=imgData.data[0]; * green=imgData.data[1]; @@ -393,10 +403,11 @@ int n = argbs.length * 4; int[] iData = new int[n]; for (int i = 0, j = 0; i < n; j++) { - iData[i++] = (argbs[j] >> 24) & 0xFF; - iData[i++] = (argbs[j] >> 16) & 0xFF; - iData[i++] = (argbs[j] >> 8) & 0xFF; - iData[i++] = argbs[j] & 0xFF; + int a = argbs[j]; + iData[i++] = (a == transparentColor ? 0xFE : (a >> 24) & 0xFF); + iData[i++] = (a >> 16) & 0xFF; + iData[i++] = (a >> 8) & 0xFF; + iData[i++] = a & 0xFF; } return iData; } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-10-15 12:38:09 UTC (rev 20081) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-10-16 00:09:49 UTC (rev 20082) @@ -15,8 +15,10 @@ TODO: design and implement sidechain mutation -- MUTATE command ? TODO: remove HTML5 dependency on synchronous file loading -Jmol.___JmolVersion="14.3.8_2014.10.15" +Jmol.___JmolVersion="14.3.8_2014.10.15b" +bug fix: GIFT (transparent-background GIF) + new feature: capture END -- closes capture without annoying popup message -- also for capture CANCEL and just CAPTURE 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