net.sourceforge.plantuml.klimt.shape.SimpleTextBlockBordered Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.klimt.shape;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
class SimpleTextBlockBordered extends AbstractTextBlock implements TextBlock {
// ::remove file when __HAXE__
private final TextBlock textBlock;
private final HColor color;
public SimpleTextBlockBordered(TextBlock textBlock, HColor color) {
this.textBlock = textBlock;
this.color = color;
}
public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D dim = textBlock.calculateDimension(stringBounder);
return dim.delta(1, 1);
}
public void drawU(UGraphic ug) {
final XDimension2D dim = textBlock.calculateDimension(ug.getStringBounder());
textBlock.drawU(ug.apply(new UTranslate(1, 1)));
ug.apply(color).draw(URectangle.build(dim.getWidth(), dim.getHeight()));
}
}