1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-19 11:45:09 +00:00

Merge pull request #752 from matthew16550/replaceTransparentByWhite

Delete replaceTransparentByWhite parameter from ISkinParam.getBackgroundColor()
This commit is contained in:
arnaudroques 2021-11-08 16:21:42 +01:00 committed by GitHub
commit a40484d5c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 42 additions and 49 deletions

View File

@ -138,7 +138,7 @@ public class AnnotatedWorker {
} }
private HColor getBackgroundColor() { private HColor getBackgroundColor() {
return getSkinParam().getBackgroundColor(false); return getSkinParam().getBackgroundColor();
} }
private TextBlock addLegend(TextBlock original) { private TextBlock addLegend(TextBlock original) {

View File

@ -65,7 +65,7 @@ public interface ISkinParam extends ISkinSimple {
public boolean useUnderlineForHyperlink(); public boolean useUnderlineForHyperlink();
public HColor getBackgroundColor(boolean replaceTransparentByWhite); public HColor getBackgroundColor();
public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable);

View File

@ -283,15 +283,9 @@ public class SkinParam implements ISkinParam {
return result; return result;
} }
public HColor getBackgroundColor(boolean replaceTransparentByWhite) { public HColor getBackgroundColor() {
final HColor result = getHtmlColor(ColorParam.background, null, false); final HColor result = getHtmlColor(ColorParam.background, null, false);
if (result == null) { return result != null ? result : HColorUtils.WHITE;
return HColorUtils.WHITE;
}
if (replaceTransparentByWhite && HColorUtils.transparent().equals(result)) {
return HColorUtils.WHITE;
}
return result;
} }
public String getValue(String key) { public String getValue(String key) {
@ -356,7 +350,7 @@ public class SkinParam implements ISkinParam {
assert param != ColorParam.background; assert param != ColorParam.background;
// final boolean acceptTransparent = param == ColorParam.background // final boolean acceptTransparent = param == ColorParam.background
// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; // || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground;
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, getBackgroundColor(false)); return getIHtmlColorSet().getColorOrWhite(themeStyle, value, getBackgroundColor());
} }
public char getCircledCharacter(Stereotype stereotype) { public char getCircledCharacter(Stereotype stereotype) {

View File

@ -73,11 +73,11 @@ public class SkinParamBackcolored extends SkinParamDelegator {
} }
@Override @Override
public HColor getBackgroundColor(boolean replaceTransparentByWhite) { public HColor getBackgroundColor() {
if (backColorGeneral != null) { if (backColorGeneral != null) {
return backColorGeneral; return backColorGeneral;
} }
return super.getBackgroundColor(replaceTransparentByWhite); return super.getBackgroundColor();
} }
@Override @Override

View File

@ -75,8 +75,8 @@ public class SkinParamDelegator implements ISkinParam {
} }
@Override @Override
public HColor getBackgroundColor(boolean replaceTransparentByWhite) { public HColor getBackgroundColor() {
return skinParam.getBackgroundColor(replaceTransparentByWhite); return skinParam.getBackgroundColor();
} }
@Override @Override

View File

@ -267,7 +267,7 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
return backgroundColor; return backgroundColor;
} }
return this.getSkinParam().getBackgroundColor(false); return this.getSkinParam().getBackgroundColor();
} }
} }

View File

@ -119,10 +119,10 @@ public class VCompactFactory implements FtileFactory {
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor = // backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); // style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false); backgroundColor = skinParam.getBackgroundColor();
} else { } else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false); backgroundColor = skinParam.getBackgroundColor();
} }
return new FtileCircleStop(skinParam(), backgroundColor, borderColor, swimlane, style); return new FtileCircleStop(skinParam(), backgroundColor, borderColor, swimlane, style);
} }
@ -143,10 +143,10 @@ public class VCompactFactory implements FtileFactory {
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor = // backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); // style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false); backgroundColor = skinParam.getBackgroundColor();
} else { } else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false); backgroundColor = skinParam.getBackgroundColor();
} }
return new FtileCircleEnd(skinParam(), backgroundColor, borderColor, swimlane, style); return new FtileCircleEnd(skinParam(), backgroundColor, borderColor, swimlane, style);
} }

View File

@ -135,7 +135,7 @@ public final class EntityFactory {
final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack(); final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack();
final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false); final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false);
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, folder.setSpecificColorTOBEREMOVED(ColorType.BACK,
c1 == null ? skinParam.getBackgroundColor(false) : c1); c1 == null ? skinParam.getBackgroundColor() : c1);
} else { } else {
folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK)); folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors(skinParam).getColor(ColorType.BACK));
} }

View File

@ -150,7 +150,7 @@ public class PSystemSalt extends TitledDiagram implements WithSprite {
} }
public HColor getBackcolor() { public HColor getBackcolor() {
return getSkinParam().getBackgroundColor(false); return getSkinParam().getBackgroundColor();
} }
}; };
} }

View File

@ -164,7 +164,7 @@ public class SmetanaPath implements UDrawable {
private void printExtremityAtStart(UGraphic ug) { private void printExtremityAtStart(UGraphic ug) {
final ExtremityFactory extremityFactory2 = link.getType().getDecor2() final ExtremityFactory extremityFactory2 = link.getType().getDecor2()
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor(false)); .getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor());
if (extremityFactory2 == null) { if (extremityFactory2 == null) {
return; return;
} }
@ -188,7 +188,7 @@ public class SmetanaPath implements UDrawable {
private void printExtremityAtEnd(UGraphic ug) { private void printExtremityAtEnd(UGraphic ug) {
final ExtremityFactory extremityFactory1 = link.getType().getDecor1() final ExtremityFactory extremityFactory1 = link.getType().getDecor1()
.getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor(false)); .getExtremityFactoryComplete(diagram.getSkinParam().getBackgroundColor());
if (extremityFactory1 == null) { if (extremityFactory1 == null) {
return; return;
} }

View File

@ -85,7 +85,7 @@ public class CommandGrouping extends SingleLineCommand2<SequenceDiagram> {
HColor backColorGeneral = null; HColor backColorGeneral = null;
if (s2 != null) { if (s2 != null) {
backColorGeneral = colorSet.getColor(diagram.getSkinParam().getThemeStyle(), s2, backColorGeneral = colorSet.getColor(diagram.getSkinParam().getThemeStyle(), s2,
diagram.getSkinParam().getBackgroundColor(false)); diagram.getSkinParam().getBackgroundColor());
} }
String comment = arg.get("COMMENT", 0); String comment = arg.get("COMMENT", 0);
final GroupingType groupingType = GroupingType.getType(type); final GroupingType groupingType = GroupingType.getType(type);

View File

@ -75,7 +75,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent {
this.roundCorner = style.value(PName.RoundCorner).asInt(); this.roundCorner = style.value(PName.RoundCorner).asInt();
if (spriteContainer instanceof SkinParamBackcolored) { if (spriteContainer instanceof SkinParamBackcolored) {
style = style.eventuallyOverride(PName.BackGroundColor, style = style.eventuallyOverride(PName.BackGroundColor,
((SkinParamBackcolored) spriteContainer).getBackgroundColor(false)); ((SkinParamBackcolored) spriteContainer).getBackgroundColor());
} }
this.groupBorder = style.value(PName.LineColor).asColor(spriteContainer.getThemeStyle(), this.groupBorder = style.value(PName.LineColor).asColor(spriteContainer.getThemeStyle(),
getIHtmlColorSet()); getIHtmlColorSet());

View File

@ -286,14 +286,14 @@ public class Rose {
smallFont = smallFont.changeColor(smallColor); smallFont = smallFont.changeColor(smallColor);
} }
return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], styles == null ? null : styles[1], return new ComponentRoseGroupingHeader(styles == null ? null : styles[0], styles == null ? null : styles[1],
param.getBackgroundColor(false), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder), param.getBackgroundColor(), getSymbolContext(stereotype, param, ColorParam.sequenceGroupBorder),
bigFont, smallFont, stringsToDisplay, param, roundCorner); bigFont, smallFont, stringsToDisplay, param, roundCorner);
} }
if (type == ComponentType.GROUPING_ELSE) { if (type == ComponentType.GROUPING_ELSE) {
return new ComponentRoseGroupingElse(styles == null ? null : styles[0], return new ComponentRoseGroupingElse(styles == null ? null : styles[0],
getHtmlColor(param, stereotype, ColorParam.sequenceGroupBorder), getHtmlColor(param, stereotype, ColorParam.sequenceGroupBorder),
getUFont2(param, FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param, getUFont2(param, FontParam.SEQUENCE_GROUP), stringsToDisplay.get(0), param,
param.getBackgroundColor(false), roundCorner); param.getBackgroundColor(), roundCorner);
} }
if (type == ComponentType.GROUPING_SPACE) { if (type == ComponentType.GROUPING_SPACE) {
return new ComponentRoseGroupingSpace(7); return new ComponentRoseGroupingSpace(7);

View File

@ -67,7 +67,7 @@ public abstract class AbstractEntityImage extends AbstractTextBlock implements I
} }
public final HColor getBackcolor() { public final HColor getBackcolor() {
return skinParam.getBackgroundColor(false); return skinParam.getBackgroundColor();
} }
protected final Stereotype getStereo() { protected final Stereotype getStereo() {

View File

@ -946,7 +946,7 @@ public class Cluster implements Moveable {
skinParam.getIHtmlColorSet()); skinParam.getIHtmlColorSet());
} }
if (backColor == null || backColor.equals(HColorUtils.transparent())) { if (backColor == null || backColor.equals(HColorUtils.transparent())) {
backColor = new HColorBackground(skinParam.getBackgroundColor(false)); backColor = new HColorBackground(skinParam.getBackgroundColor());
} }
return backColor; return backColor;
} }
@ -958,7 +958,7 @@ public class Cluster implements Moveable {
} }
if (backColor == null if (backColor == null
|| backColor.equals(HColorUtils.transparent()) /* || stateBack instanceof HtmlColorTransparent */) { || backColor.equals(HColorUtils.transparent()) /* || stateBack instanceof HtmlColorTransparent */) {
final HColor tmp = skinParam.getBackgroundColor(false); final HColor tmp = skinParam.getBackgroundColor();
backColor = new HColorBackground(tmp); backColor = new HColorBackground(tmp);
} }
return backColor; return backColor;

View File

@ -109,7 +109,7 @@ public final class ConcurrentStateImage extends AbstractTextBlock implements IEn
HColor backColor) { HColor backColor) {
this.separator = Separator.fromChar(concurrentSeparator); this.separator = Separator.fromChar(concurrentSeparator);
this.skinParam = skinParam; this.skinParam = skinParam;
this.backColor = skinParam.getBackgroundColor(false); this.backColor = skinParam.getBackgroundColor();
this.inners.addAll(images); this.inners.addAll(images);
} }

View File

@ -139,7 +139,7 @@ public final class CucaDiagramFileMakerSvek2InternalImage extends AbstractTextBl
} }
public HColor getBackcolor() { public HColor getBackcolor() {
return skinParam.getBackgroundColor(false); return skinParam.getBackgroundColor();
} }
public double getOverscanX(StringBounder stringBounder) { public double getOverscanX(StringBounder stringBounder) {

View File

@ -396,12 +396,12 @@ public final class GeneralImageBuilder {
return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(), return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(),
dotData.getSkinParam().getIHtmlColorSet()); dotData.getSkinParam().getIHtmlColorSet());
} }
return dotData.getSkinParam().getBackgroundColor(false); return dotData.getSkinParam().getBackgroundColor();
} }
public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) { public IEntityImage buildImage(BaseFile basefile, String dotStrings[]) {
if (dotData.isDegeneratedWithFewEntities(0)) { if (dotData.isDegeneratedWithFewEntities(0)) {
return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor(false)); return new EntityImageSimpleEmpty(dotData.getSkinParam().getBackgroundColor());
} }
if (dotData.isDegeneratedWithFewEntities(1) && dotData.getUmlDiagramType() != UmlDiagramType.STATE) { if (dotData.isDegeneratedWithFewEntities(1) && dotData.getUmlDiagramType() != UmlDiagramType.STATE) {
final ILeaf single = dotData.getLeafs().iterator().next(); final ILeaf single = dotData.getLeafs().iterator().next();

View File

@ -229,7 +229,7 @@ public class SvekLine implements Moveable, Hideable, GuideLine {
skinParam = link.getColors().mute(skinParam); skinParam = link.getColors().mute(skinParam);
font = font.mute(link.getColors()); font = font.mute(link.getColors());
} }
this.backgroundColor = skinParam.getBackgroundColor(false); this.backgroundColor = skinParam.getBackgroundColor();
this.defaultThickness = skinParam.getThickness(LineParam.arrow, null); this.defaultThickness = skinParam.getThickness(LineParam.arrow, null);
this.arrowLollipopColor = skinParam.getHtmlColor(ColorParam.arrowLollipop, null, false); this.arrowLollipopColor = skinParam.getHtmlColor(ColorParam.arrowLollipop, null, false);
if (arrowLollipopColor == null) { if (arrowLollipopColor == null) {

View File

@ -147,7 +147,7 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage
return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(), return style.value(PName.BackGroundColor).asColor(dotData.getSkinParam().getThemeStyle(),
dotData.getSkinParam().getIHtmlColorSet()); dotData.getSkinParam().getIHtmlColorSet());
} }
return dotData.getSkinParam().getBackgroundColor(false); return dotData.getSkinParam().getBackgroundColor();
} }
private MinMax minMax; private MinMax minMax;

View File

@ -1,5 +1,14 @@
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
import static org.assertj.core.api.Assertions.assertThat;
import java.awt.Color;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines; import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@ -13,15 +22,6 @@ import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.EnumSource;
import java.awt.Color;
import static org.assertj.core.api.Assertions.assertThat;
class SkinParamTest { class SkinParamTest {
// //
@ -43,8 +43,7 @@ class SkinParamTest {
assertThat(skinParam.getAllSpriteNames()).isEmpty(); assertThat(skinParam.getAllSpriteNames()).isEmpty();
assertThat(skinParam.getBackgroundColor(false)).isEqualTo(HColorUtils.WHITE); assertThat(skinParam.getBackgroundColor()).isEqualTo(HColorUtils.WHITE);
assertThat(skinParam.getBackgroundColor(true)).isEqualTo(HColorUtils.WHITE);
assertThat(skinParam.getCircledCharacter(fooStereotype)).isEqualTo('\0'); assertThat(skinParam.getCircledCharacter(fooStereotype)).isEqualTo('\0');