FLA export - is visible, matte color

This commit is contained in:
Jindra Petk
2013-05-16 22:15:10 +02:00
parent 898b581918
commit 4a45f54479
5 changed files with 64 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import com.jpexs.decompiler.flash.types.CLIPACTIONS;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.filters.FILTER;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -331,4 +332,14 @@ public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTa
public String getClassName() {
return null;
}
@Override
public boolean isVisible() {
return true;
}
@Override
public RGBA getBackgroundColor() {
return null;
}
}

View File

@@ -254,6 +254,8 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
}
if (placeFlagHasVisible) {
sos.writeUI8(visible);
}
if (placeFlagOpaqueBackground) {
sos.writeRGBA(backgroundColor);
}
if (placeFlagHasClipActions) {
@@ -329,10 +331,15 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
bitmapCache = 1;
}
}
if (placeFlagHasVisible) {
visible = sis.readUI8();
}
if (placeFlagOpaqueBackground) {
backgroundColor = sis.readRGBA();
}
System.out.println("" + sis.available());
if (placeFlagHasClipActions) {
clipActions = sis.readCLIPACTIONS();
}
@@ -436,4 +443,20 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
public boolean cacheAsBitmap() {
return placeFlagHasCacheAsBitmap;
}
@Override
public boolean isVisible() {
if (placeFlagHasVisible) {
return visible == 1;
}
return true;
}
@Override
public RGBA getBackgroundColor() {
if (placeFlagOpaqueBackground) {
return backgroundColor;
}
return null;
}
}

View File

@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.filters.FILTER;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
@@ -165,4 +166,14 @@ public class PlaceObjectTag extends Tag implements PlaceObjectTypeTag {
public String getClassName() {
return null;
}
@Override
public boolean isVisible() {
return true;
}
@Override
public RGBA getBackgroundColor() {
return null;
}
}

View File

@@ -3,6 +3,7 @@ package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.types.CXFORM;
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
import com.jpexs.decompiler.flash.types.MATRIX;
import com.jpexs.decompiler.flash.types.RGBA;
import com.jpexs.decompiler.flash.types.filters.FILTER;
import java.util.List;
@@ -33,4 +34,8 @@ public interface PlaceObjectTypeTag {
public String getClassName();
public boolean cacheAsBitmap();
public boolean isVisible();
public RGBA getBackgroundColor();
}

View File

@@ -757,7 +757,7 @@ public class XFLConverter {
return ret;
}
public static String convertSymbolInstance(String name, MATRIX matrix, CXFORM colorTransform, CXFORMWITHALPHA colorTransformAlpha, boolean cacheAsBitmap, int blendMode, List<FILTER> filters, CharacterTag tag, HashMap<Integer, CharacterTag> characters) {
public static String convertSymbolInstance(String name, MATRIX matrix, CXFORM colorTransform, CXFORMWITHALPHA colorTransformAlpha, boolean cacheAsBitmap, int blendMode, List<FILTER> filters, boolean isVisible, RGBA backgroundColor, CharacterTag tag, HashMap<Integer, CharacterTag> characters) {
String ret = "";
if (matrix == null) {
matrix = new MATRIX();
@@ -788,11 +788,22 @@ public class XFLConverter {
if (cacheAsBitmap) {
ret += " cacheAsBitmap=\"true\"";
}
if (!isVisible) {
ret += " isVisible=\"false\"";
}
ret += ">";
ret += "<matrix>";
ret += convertMatrix(matrix);
ret += "</matrix>";
ret += "<transformationPoint><Point/></transformationPoint>";
if (backgroundColor != null) {
ret += "<MatteColor color=\"" + backgroundColor.toHexRGB() + "\"";
if (backgroundColor.alpha != 255) {
ret += " alpha=\"" + doubleToString(backgroundColor.getAlphaFloat()) + "\"";
}
ret += "/>";
}
if (colorTransform != null) {
ret += "<color><Color";
if (colorTransform.hasMultTerms) {
@@ -885,7 +896,7 @@ public class XFLConverter {
filters = rec.filterList;
}
}
String recCharStr = convertSymbolInstance(null, null, null, colorTransformAlpha, false, blendMode, filters, characters.get(rec.characterId), characters);
String recCharStr = convertSymbolInstance(null, null, null, colorTransformAlpha, false, blendMode, filters, true, null, characters.get(rec.characterId), characters);
if (rec.buttonStateUp) {
frame = 1;
}
@@ -1042,7 +1053,7 @@ public class XFLConverter {
} else if (ch instanceof TextTag) {
elements += convertText(tags, (TextTag) ch, po.getMatrix(), po.getFilters());
} else {
elements += convertSymbolInstance(po.getName(), po.getMatrix(), po.getColorTransform(), po.getColorTransformWithAlpha(), po.cacheAsBitmap(), po.getBlendMode(), po.getFilters(), characters.get(characterId), characters);
elements += convertSymbolInstance(po.getName(), po.getMatrix(), po.getColorTransform(), po.getColorTransformWithAlpha(), po.cacheAsBitmap(), po.getBlendMode(), po.getFilters(), po.isVisible(), po.getBackgroundColor(), characters.get(characterId), characters);
}
}
}