mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 22:10:47 +00:00
SVG Shapes import - non-scaling strokes
This commit is contained in:
@@ -102,6 +102,12 @@ public class SvgImporter {
|
||||
public Tag importSvg(ShapeTag st, String svgXml, boolean fill) {
|
||||
shapeTag = st;
|
||||
|
||||
if (st instanceof DefineShape4Tag) {
|
||||
DefineShape4Tag shape4 = (DefineShape4Tag) st;
|
||||
shape4.usesNonScalingStrokes = false;
|
||||
shape4.usesScalingStrokes = false;
|
||||
}
|
||||
|
||||
SHAPEWITHSTYLE shapes = new SHAPEWITHSTYLE();
|
||||
shapes.fillStyles = new FILLSTYLEARRAY();
|
||||
shapes.lineStyles = new LINESTYLEARRAY();
|
||||
@@ -1685,6 +1691,22 @@ public class SvgImporter {
|
||||
SvgLineJoin lineJoin = style.getStrokeLineJoin();
|
||||
if (lineStyle instanceof LINESTYLE2) {
|
||||
LINESTYLE2 lineStyle2 = (LINESTYLE2) lineStyle;
|
||||
|
||||
String vectorEffect = style.getVectorEffect();
|
||||
if ("non-scaling-stroke".equals(vectorEffect)) {
|
||||
lineStyle2.noHScaleFlag = true;
|
||||
lineStyle2.noVScaleFlag = true;
|
||||
if (shapeTag instanceof DefineShape4Tag) {
|
||||
DefineShape4Tag shape4 = (DefineShape4Tag) shapeTag;
|
||||
shape4.usesNonScalingStrokes = true;
|
||||
}
|
||||
} else {
|
||||
if (shapeTag instanceof DefineShape4Tag) {
|
||||
DefineShape4Tag shape4 = (DefineShape4Tag) shapeTag;
|
||||
shape4.usesScalingStrokes = true;
|
||||
}
|
||||
}
|
||||
|
||||
int swfCap = lineCap == SvgLineCap.BUTT ? LINESTYLE2.NO_CAP
|
||||
: lineCap == SvgLineCap.ROUND ? LINESTYLE2.ROUND_CAP
|
||||
: lineCap == SvgLineCap.SQUARE ? LINESTYLE2.SQUARE_CAP : 0;
|
||||
|
||||
@@ -204,6 +204,10 @@ class SvgStyle {
|
||||
public double getStopOpacity() {
|
||||
return getValue(element, "stop-opacity");
|
||||
}
|
||||
|
||||
public String getVectorEffect() {
|
||||
return getValue(element, "vector-effect");
|
||||
}
|
||||
|
||||
public SvgFill getFillWithOpacity() {
|
||||
SvgFill fill = getFill();
|
||||
@@ -704,6 +708,9 @@ class SvgStyle {
|
||||
double stopOpacity = Double.parseDouble(value);
|
||||
return stopOpacity;
|
||||
}
|
||||
case "vector-effect": {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
//ignore
|
||||
|
||||
@@ -67,6 +67,7 @@ public class SvgStyleProperty {
|
||||
p.put("opacity", new SvgStyleProperty("opacity", false, 1.0));
|
||||
p.put("stop-color", new SvgStyleProperty("stop-color", false, Color.BLACK));
|
||||
p.put("stop-opacity", new SvgStyleProperty("stop-opacity", false, 1.0));
|
||||
p.put("vector-effect", new SvgStyleProperty("vector-effect", false, "none"));
|
||||
properties = p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user