1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 06:17:33 +00:00
This commit is contained in:
Arnaud Roques 2022-04-04 23:07:57 +02:00
parent 7cca06b667
commit 02b244a320
3 changed files with 33 additions and 5 deletions

View File

@ -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());

View File

@ -43,14 +43,28 @@ import net.sourceforge.plantuml.SignatureUtils;
public class UImageSvg implements UShape {
private static final String EMPTY_SVG = "<svg width=10 height=10></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("<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() {
return SignatureUtils.getMD5Hex(svg);
}

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 0;
final int beta = 1;
return beta;
}