net.sourceforge.plantuml.png.PngTitler 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.png;
import net.sourceforge.plantuml.cucadiagram.DisplaySection;
import net.sourceforge.plantuml.klimt.color.HColorSet;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.style.ISkinSimple;
import net.sourceforge.plantuml.style.Style;
public class PngTitler {
private final DisplaySection text;
private final Style style;
private final HColorSet set;
private final ISkinSimple spriteContainer;
public PngTitler(DisplaySection text, Style style, HColorSet set, ISkinSimple spriteContainer) {
this.style = style;
this.set = set;
this.spriteContainer = spriteContainer;
this.text = text;
}
public XDimension2D getTextDimension(StringBounder stringBounder) {
final TextBlock textBloc = getRibbonBlock();
if (textBloc == null)
return null;
return textBloc.calculateDimension(stringBounder);
}
public TextBlock getRibbonBlock() {
final Display display = text.getDisplay();
if (display == null)
return null;
return style.createTextBlockBordered(display, set, spriteContainer, Style.ID_TITLE);
}
}