[Patchanim-commit] SF.net SVN: patchanim: [131] trunk/patchanim/src/com/mebigfatguy
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-02-10 05:29:47
|
Revision: 131
http://patchanim.svn.sourceforge.net/patchanim/?rev=131&view=rev
Author: dbrosius
Date: 2008-02-09 21:29:53 -0800 (Sat, 09 Feb 2008)
Log Message:
-----------
fix image counts, and make sure IEND gets written for APNGS
Modified Paths:
--------------
trunk/patchanim/src/com/mebigfatguy/apng/APngEncoder.java
trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
Modified: trunk/patchanim/src/com/mebigfatguy/apng/APngEncoder.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/apng/APngEncoder.java 2008-02-10 04:33:41 UTC (rev 130)
+++ trunk/patchanim/src/com/mebigfatguy/apng/APngEncoder.java 2008-02-10 05:29:53 UTC (rev 131)
@@ -158,7 +158,7 @@
break;
case IEND:
- if (seqNum >= frameCount)
+ if (seqNum >= (frameCount - 1))
chunk.write(out);
break;
}
Modified: trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java
===================================================================
--- trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-10 04:33:41 UTC (rev 130)
+++ trunk/patchanim/src/com/mebigfatguy/patchanim/io/PatchExporter.java 2008-02-10 05:29:53 UTC (rev 131)
@@ -102,22 +102,27 @@
for(int p = 0; p < lastPatch; p++) {
CombinedPatch startPatch = patches.get(p);
CombinedPatch endPatch = patches.get(p+1);
- for (int t = 0; t < tweenCount; t++) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount);
+ for (int t = 0; t < tweenCount + 1; t++) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
writeSingleFile(image, imageIndex++, loc, baseName, type);
}
}
- if (atype == AnimationType.None)
- return;
+ if ((atype == AnimationType.None) || (atype == AnimationType.Cycle)) {
+ CombinedPatch patch = patches.get(lastPatch);
+ PatchGenerator.recalcCombinedImage(patch, image, oob);
+ writeSingleFile(image, imageIndex++, loc, baseName, type);
+ if (atype == AnimationType.None)
+ return;
+ }
if (atype == AnimationType.Wave) {
for (int p = lastPatch; p > 0; p--) {
CombinedPatch startPatch = patches.get(p-1);
CombinedPatch endPatch = patches.get(p);
- for (int t = tweenCount - 1; t >= 0; t--) {
- CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)tweenCount);
+ for (int t = tweenCount + 1; t > 0; t--) {
+ CombinedPatch tweenPatch = CombinedPatch.tween(startPatch, endPatch, (double)t / (double)(tweenCount + 1));
PatchGenerator.recalcCombinedImage(tweenPatch, image, oob);
writeSingleFile(image, imageIndex++, loc, baseName, type);
}
@@ -166,10 +171,13 @@
}
private int calcImageCount(PatchAnimDocument document) {
- int total = (document.getPatches().size() - 1) * document.getTweenCount() + 1;
+ int numPatches = document.getPatches().size();
+ int total = (numPatches - 1) * document.getTweenCount() + (numPatches - 1);
if (document.getAnimationType() == AnimationType.Wave)
- total *= 2;
+ total = total * 2;
+ else
+ total++;
return total;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|