mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-29 00:06:34 +00:00
wip
This commit is contained in:
parent
7cca06b667
commit
02b244a320
@ -35,8 +35,6 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.svek.image;
|
package net.sourceforge.plantuml.svek.image;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
|
||||||
|
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -52,8 +50,8 @@ import net.sourceforge.plantuml.LineParam;
|
|||||||
import net.sourceforge.plantuml.SkinParamUtils;
|
import net.sourceforge.plantuml.SkinParamUtils;
|
||||||
import net.sourceforge.plantuml.Url;
|
import net.sourceforge.plantuml.Url;
|
||||||
import net.sourceforge.plantuml.UseStyle;
|
import net.sourceforge.plantuml.UseStyle;
|
||||||
|
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||||
import net.sourceforge.plantuml.creole.Stencil;
|
import net.sourceforge.plantuml.creole.Stencil;
|
||||||
import net.sourceforge.plantuml.cucadiagram.Bodier;
|
|
||||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||||
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
|
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
|
||||||
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
import net.sourceforge.plantuml.cucadiagram.ILeaf;
|
||||||
@ -174,15 +172,23 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W
|
|||||||
|
|
||||||
final HColor borderColor;
|
final HColor borderColor;
|
||||||
final UStroke stroke;
|
final UStroke stroke;
|
||||||
|
|
||||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||||
|
HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER);
|
||||||
|
|
||||||
if (UseStyle.useBetaStyle()) {
|
if (UseStyle.useBetaStyle()) {
|
||||||
final Style style = getStyle();
|
final Style style = getStyle();
|
||||||
borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
|
if (headerBackcolor == null)
|
||||||
|
headerBackcolor = backcolor == null ? getStyleHeader().value(PName.BackGroundColor)
|
||||||
|
.asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()) : backcolor;
|
||||||
|
|
||||||
if (backcolor == null)
|
if (backcolor == null)
|
||||||
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
rect.setDeltaShadow(style.value(PName.Shadowing).asDouble());
|
rect.setDeltaShadow(style.value(PName.Shadowing).asDouble());
|
||||||
stroke = style.getStroke();
|
stroke = style.getStroke();
|
||||||
|
|
||||||
@ -207,6 +213,14 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W
|
|||||||
ug.startGroup(typeIDent);
|
ug.startGroup(typeIDent);
|
||||||
ug.apply(stroke).draw(rect);
|
ug.apply(stroke).draw(rect);
|
||||||
|
|
||||||
|
UGraphic ugHeader = ug;
|
||||||
|
if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) {
|
||||||
|
final Shadowable rect2 = new URectangle(widthTotal, dimTitle.getHeight());
|
||||||
|
rect2.setDeltaShadow(0);
|
||||||
|
ugHeader = ugHeader.apply(headerBackcolor.bg());
|
||||||
|
ugHeader.apply(stroke).draw(rect2);
|
||||||
|
}
|
||||||
|
|
||||||
final ULayoutGroup header = getLayout(stringBounder);
|
final ULayoutGroup header = getLayout(stringBounder);
|
||||||
header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight());
|
header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight());
|
||||||
|
|
||||||
|
@ -43,14 +43,28 @@ import net.sourceforge.plantuml.SignatureUtils;
|
|||||||
|
|
||||||
public class UImageSvg implements UShape {
|
public class UImageSvg implements UShape {
|
||||||
|
|
||||||
|
private static final String EMPTY_SVG = "<svg width=10 height=10></svg>";
|
||||||
private final String svg;
|
private final String svg;
|
||||||
private final double scale;
|
private final double scale;
|
||||||
|
|
||||||
public UImageSvg(String svg, double scale) {
|
public UImageSvg(String svg, double scale) {
|
||||||
this.svg = Objects.requireNonNull(svg);
|
this.svg = clean(Objects.requireNonNull(svg));
|
||||||
this.scale = scale;
|
this.scale = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String clean(String svg) {
|
||||||
|
svg = svg.toLowerCase().replaceAll("\\s", "");
|
||||||
|
if (svg.contains("<script>"))
|
||||||
|
return EMPTY_SVG;
|
||||||
|
if (svg.contains("</script>"))
|
||||||
|
return EMPTY_SVG;
|
||||||
|
if (svg.contains("<foreignobject"))
|
||||||
|
return EMPTY_SVG;
|
||||||
|
if (svg.contains("</foreignobject>"))
|
||||||
|
return EMPTY_SVG;
|
||||||
|
return svg;
|
||||||
|
}
|
||||||
|
|
||||||
public String getMD5Hex() {
|
public String getMD5Hex() {
|
||||||
return SignatureUtils.getMD5Hex(svg);
|
return SignatureUtils.getMD5Hex(svg);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 0;
|
final int beta = 1;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user