diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java index 3dcd75ed9..c13d9a7d5 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/commonshape/SVGExporter.java @@ -167,7 +167,7 @@ public class SVGExporter { return true; } - + public final Element createClipPath(Matrix transform, String id) { Element group = createSubGroup(id, "clipPath"); if (transform != null) { @@ -426,10 +426,6 @@ public class SVGExporter { _svgGs.peek().appendChild(image); } - public Element addUse(Matrix transform, RECT boundRect, String href, String instanceName, RECT scalingRect) { - return addUse(transform, boundRect, href, instanceName, scalingRect, null, null, BlendMode.NORMAL, new ArrayList<>()); - } - private void handleFilters(Element image, List filters) { if (filters == null) { return; @@ -438,22 +434,26 @@ public class SVGExporter { String filterId = getUniqueId("filter"); String in = "SourceGraphic"; boolean empty = true; - for (FILTER filter: filters) { - String result = filter.toSvg(_svg, filtersElement, this, in); - if (result != null) { - empty = false; - in = result; - } + for (FILTER filter : filters) { + String result = filter.toSvg(_svg, filtersElement, this, in); + if (result != null) { + empty = false; + in = result; + } } if (empty) { return; } - - filtersElement.setAttribute("id", filterId); + + filtersElement.setAttribute("id", filterId); image.setAttribute("filter", "url(#" + filterId + ")"); _svgGs.peek().appendChild(filtersElement); } + public Element addUse(Matrix transform, RECT boundRect, String href, String instanceName, RECT scalingRect) { + return addUse(transform, boundRect, href, instanceName, scalingRect, null, null, BlendMode.NORMAL, new ArrayList<>()); + } + public Element addUse(Matrix transform, RECT boundRect, String href, String instanceName, RECT scalingRect, String characterId, String characterName, int blendMode, List filters) { if (scalingRect != null && (transform == null || (Double.compare(transform.rotateSkew0, 0.0) == 0 && Double.compare(transform.rotateSkew1, 0.0) == 0))) { addScalingGridUse(transform, boundRect, href, instanceName, scalingRect, characterId, characterName, blendMode, filters); @@ -474,18 +474,18 @@ public class SVGExporter { if (characterName != null) { image.setAttribute("data-characterName", characterName); } - + setBlendMode(image, blendMode); - + handleFilters(image, filters); - - image.setAttribute("xlink:href", "#" + href); + + image.setAttribute("xlink:href", "#" + href); _svgGs.peek().appendChild(image); return image; } - + private void setBlendMode(Element element, int blendMode) { - switch(blendMode) { + switch (blendMode) { case BlendMode.MULTIPLY: element.setAttribute("style", "mix-blend-mode: multiply"); break; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index bdb070e69..df08c54d2 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -888,7 +888,7 @@ public class Timeline { if (filters != null) { for (FILTER filter : filters) { - img = filter.apply(img, unzoom, (int)deltaXMax, (int)deltaYMax, (int)Math.round(newWidth - 2 * deltaXMax), (int)Math.round(newHeight - 2 * deltaYMax)); + img = filter.apply(img, unzoom, (int) deltaXMax, (int) deltaYMax, (int) Math.round(newWidth - 2 * deltaXMax), (int) Math.round(newHeight - 2 * deltaYMax)); } } if (blendMode > 1) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/ConvolveOp.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/ConvolveOp.java index 908a95fa4..d5a8d621f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/ConvolveOp.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/types/filters/ConvolveOp.java @@ -54,6 +54,27 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { this.srcY = srcY; this.srcWidth = srcWidth; this.srcHeight = srcHeight; + } + + @Override + public BufferedImage createCompatibleDestImage(BufferedImage src, + ColorModel dstCM) { + if (dstCM != null) { + return new BufferedImage(dstCM, + src.getRaster().createCompatibleWritableRaster(), + src.isAlphaPremultiplied(), null); + } + + return new BufferedImage(src.getWidth(), src.getHeight(), src.getType()); + } + + @Override + public final RenderingHints getRenderingHints() { + return hints; + } + + public final Kernel getKernel() { + return (Kernel) kernel.clone(); } @Override @@ -82,27 +103,6 @@ public class ConvolveOp implements BufferedImageOp, RasterOp { return dst; } - @Override - public BufferedImage createCompatibleDestImage(BufferedImage src, - ColorModel dstCM) { - if (dstCM != null) { - return new BufferedImage(dstCM, - src.getRaster().createCompatibleWritableRaster(), - src.isAlphaPremultiplied(), null); - } - - return new BufferedImage(src.getWidth(), src.getHeight(), src.getType()); - } - - @Override - public final RenderingHints getRenderingHints() { - return hints; - } - - public final Kernel getKernel() { - return (Kernel) kernel.clone(); - } - @Override public final WritableRaster filter(Raster src, WritableRaster dest) { if (src == dest) {