From 02b244a32019b29071ddf125314b9c31f98d0c30 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Mon, 4 Apr 2022 23:07:57 +0200 Subject: [PATCH] wip --- .../svek/image/EntityImageObject.java | 20 ++++++++++++++++--- .../plantuml/ugraphic/UImageSvg.java | 16 ++++++++++++++- .../sourceforge/plantuml/version/Version.java | 2 +- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 0b9093b88..c182fa355 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -35,8 +35,6 @@ */ package net.sourceforge.plantuml.svek.image; -import net.sourceforge.plantuml.awt.geom.Dimension2D; - import java.awt.geom.Rectangle2D; import java.util.EnumMap; import java.util.Map; @@ -52,8 +50,8 @@ import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.awt.geom.Dimension2D; import net.sourceforge.plantuml.creole.Stencil; -import net.sourceforge.plantuml.cucadiagram.Bodier; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.ILeaf; @@ -174,15 +172,23 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W final HColor borderColor; final UStroke stroke; + HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); + HColor headerBackcolor = getEntity().getColors().getColor(ColorType.HEADER); if (UseStyle.useBetaStyle()) { final Style style = getStyle(); borderColor = style.value(PName.LineColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); + + if (headerBackcolor == null) + headerBackcolor = backcolor == null ? getStyleHeader().value(PName.BackGroundColor) + .asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()) : backcolor; + if (backcolor == null) backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet()); + rect.setDeltaShadow(style.value(PName.Shadowing).asDouble()); stroke = style.getStroke(); @@ -207,6 +213,14 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil, W ug.startGroup(typeIDent); 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); header.drawU(ug, dimTotal.getWidth(), dimTitle.getHeight()); diff --git a/src/net/sourceforge/plantuml/ugraphic/UImageSvg.java b/src/net/sourceforge/plantuml/ugraphic/UImageSvg.java index 97db79872..38012d112 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UImageSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/UImageSvg.java @@ -43,14 +43,28 @@ import net.sourceforge.plantuml.SignatureUtils; public class UImageSvg implements UShape { + private static final String EMPTY_SVG = ""; private final String svg; private final double scale; public UImageSvg(String svg, double scale) { - this.svg = Objects.requireNonNull(svg); + this.svg = clean(Objects.requireNonNull(svg)); this.scale = scale; } + private String clean(String svg) { + svg = svg.toLowerCase().replaceAll("\\s", ""); + if (svg.contains("")) + return EMPTY_SVG; + if (svg.contains("")) + return EMPTY_SVG; + return svg; + } + public String getMD5Hex() { return SignatureUtils.getMD5Hex(svg); } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index d2e0c5ef4..658a3a21e 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 0; + final int beta = 1; return beta; }