[#1367] Raw edit conditional type fix.

This commit is contained in:
honfika@gmail.com
2017-04-01 08:15:35 +02:00
parent ceffd8bdb5
commit b7d1cfce81
6 changed files with 54 additions and 9 deletions

View File

@@ -46,6 +46,8 @@ import java.awt.geom.GeneralPath;
import java.awt.geom.NoninvertibleTransformException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
@@ -85,6 +87,8 @@ public class BitmapExporter extends ShapeExporterBase {
private Matrix strokeTransformation;
private static boolean linearGradientColorWarnignShown = false;
private class TransformedStroke implements Stroke {
/**
@@ -238,7 +242,17 @@ public class BitmapExporter extends ShapeExporterBase {
cm = MultipleGradientPaint.CycleMethod.REPEAT;
}
fillPaint = new LinearGradientPaint(POINT_NEG16384_0, POINT_16384_0, ratiosArr, colorsArr, cm, cstype, IDENTITY_TRANSFORM);
if (colorsArr.length >= 2) {
fillPaint = new LinearGradientPaint(POINT_NEG16384_0, POINT_16384_0, ratiosArr, colorsArr, cm, cstype, IDENTITY_TRANSFORM);
} else {
if (!linearGradientColorWarnignShown) {
Logger.getLogger(BitmapExporter.class.getName()).log(Level.WARNING, "Linear gradient fill should have at least 2 gradient records.");
linearGradientColorWarnignShown = true;
}
fillPaint = null;
}
fillTransform = matrix.toTransform();
}
break;

View File

@@ -53,6 +53,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
/**
* Represents Tag inside SWF file
@@ -61,6 +62,8 @@ import java.util.Set;
*/
public abstract class Tag implements NeedsCharacters, Exportable, Serializable {
private static final Logger logger = Logger.getLogger(Tag.class.getName());
/**
* Identifier of tag type
*/

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.types;
import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
import com.jpexs.decompiler.flash.tags.base.NeedsCharacters;
import com.jpexs.decompiler.flash.types.annotations.Conditional;
import com.jpexs.decompiler.flash.types.annotations.ConditionalType;
@@ -66,7 +67,8 @@ public class FILLSTYLE implements NeedsCharacters, Serializable {
@Internal
public boolean inShape3;
@ConditionalType(type = RGBA.class, tags = DefineShape3Tag.ID)
@Conditional(value = "fillStyleType", options = {SOLID})
@ConditionalType(type = RGBA.class, tags = {DefineShape3Tag.ID, DefineShape4Tag.ID})
public RGB color;
@Conditional(value = "fillStyleType", options = {LINEAR_GRADIENT, RADIAL_GRADIENT, FOCAL_RADIAL_GRADIENT})

View File

@@ -33,7 +33,7 @@ public class LINESTYLE implements NeedsCharacters, Serializable {
@SWFType(BasicType.UI16)
public int width;
@ConditionalType(tags = {DefineShape3Tag.ID, DefineShape4Tag.ID}, type = RGBA.class)
@ConditionalType(type = RGBA.class, tags = {DefineShape3Tag.ID, DefineShape4Tag.ID})
public RGB color;
@Override