external player (multiple) setbackgourd tag problem fixed

This commit is contained in:
honfika@gmail.com
2015-12-22 20:35:35 +01:00
parent 760b5605ed
commit 112800f7ee
4 changed files with 45 additions and 35 deletions

View File

@@ -91,6 +91,7 @@ import com.jpexs.decompiler.flash.tags.FileAttributesTag;
import com.jpexs.decompiler.flash.tags.JPEGTablesTag;
import com.jpexs.decompiler.flash.tags.MetadataTag;
import com.jpexs.decompiler.flash.tags.ProtectTag;
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.ShowFrameTag;
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
import com.jpexs.decompiler.flash.tags.Tag;
@@ -562,6 +563,16 @@ public final class SWF implements SWFContainerItem, Timelined {
return null;
}
public SetBackgroundColorTag getBackgroundColor() {
for (Tag t : tags) {
if (t instanceof SetBackgroundColorTag) {
return (SetBackgroundColorTag) t;
}
}
return null;
}
public EnableTelemetryTag getEnableTelemetry() {
for (Tag t : tags) {
if (t instanceof EnableTelemetryTag) {

View File

@@ -34,7 +34,6 @@ import com.jpexs.decompiler.flash.helpers.BMPFile;
import com.jpexs.decompiler.flash.helpers.ImageHelper;
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
import com.jpexs.decompiler.flash.tags.SetBackgroundColorTag;
import com.jpexs.decompiler.flash.tags.Tag;
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
import com.jpexs.decompiler.flash.tags.enums.ImageFormat;
import com.jpexs.decompiler.flash.timeline.DepthState;
@@ -173,13 +172,9 @@ public class FrameExporter {
final List<Integer> fframes = frames;
Color backgroundColor = null;
if (settings.mode == FrameExportMode.AVI) {
for (Tag t : swf.tags) {
if (t instanceof SetBackgroundColorTag) {
SetBackgroundColorTag sb = (SetBackgroundColorTag) t;
backgroundColor = sb.backgroundColor.toColor();
}
}
SetBackgroundColorTag setBgColorTag = swf.getBackgroundColor();
if (setBgColorTag != null) {
backgroundColor = setBgColorTag.backgroundColor.toColor();
}
if (settings.mode == FrameExportMode.SVG) {
@@ -189,7 +184,7 @@ public class FrameExporter {
}
final int fi = i;
final Color fbackgroundColor = backgroundColor;
final Color fbackgroundColor = null;
new RetryTask(() -> {
int frame = fframes.get(fi);
File f = new File(foutdir + File.separator + frame + ".svg");
@@ -223,7 +218,7 @@ public class FrameExporter {
}
final Timeline ftim = tim;
final Color fbackgroundColor = backgroundColor;
final Color fbackgroundColor = null;
final SWF fswf = swf;
new RetryTask(() -> {
File fcanvas = new File(foutdir + File.separator + "canvas.js");
@@ -259,11 +254,8 @@ public class FrameExporter {
}
sb.append("\r\n");
RGB backgroundColor1 = new RGB(255, 255, 255);
for (Tag t : fswf.tags) {
if (t instanceof SetBackgroundColorTag) {
SetBackgroundColorTag sbgct = (SetBackgroundColorTag) t;
backgroundColor1 = sbgct.backgroundColor;
}
if (setBgColorTag != null) {
backgroundColor1 = setBgColorTag.backgroundColor;
}
sb.append("var backgroundColor = \"").append(backgroundColor1.toHexRGB()).append("\";\r\n");

View File

@@ -103,7 +103,6 @@ import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
import com.jpexs.decompiler.flash.types.sound.MP3FRAME;
import com.jpexs.decompiler.flash.types.sound.MP3SOUNDDATA;
import com.jpexs.decompiler.flash.types.sound.SoundFormat;
import com.jpexs.helpers.Helper;
import com.jpexs.helpers.Path;
import com.jpexs.helpers.SerializableImage;
import com.jpexs.helpers.utf8.Utf8Helper;
@@ -2688,12 +2687,11 @@ public class XFLConverter {
Map<Integer, String> characterVariables = getCharacterVariables(swf.tags);
String backgroundColor = "#ffffff";
for (Tag t : swf.tags) {
if (t instanceof SetBackgroundColorTag) {
SetBackgroundColorTag sbc = (SetBackgroundColorTag) t;
backgroundColor = sbc.backgroundColor.toHexRGB();
}
SetBackgroundColorTag setBgColorTag = swf.getBackgroundColor();
if (setBgColorTag != null) {
backgroundColor = setBgColorTag.backgroundColor.toHexRGB();
}
domDocument.append("<DOMDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://ns.adobe.com/xfl/2008/\" currentTimeline=\"1\" xflVersion=\"").append(flaVersion.xflVersion()).append("\" creatorInfo=\"").append(generator).append("\" platform=\"Windows\" versionInfo=\"Saved by ").append(generatorVerName).append("\" majorVersion=\"").append(generatorVersion).append("\" buildNumber=\"\" nextSceneIdentifier=\"2\" playOptionsPlayLoop=\"false\" playOptionsPlayPages=\"false\" playOptionsPlayFrameActions=\"false\" autoSaveHasPrompted=\"true\"");
domDocument.append(" backgroundColor=\"").append(backgroundColor).append("\"");
domDocument.append(" frameRate=\"").append((int) swf.frameRate).append("\""); // todo: is the cast to int needed?