net.sourceforge.plantuml.skin.CircleInterface 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.skin;
import net.sourceforge.plantuml.klimt.UStroke;
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.shape.UDrawable;
import net.sourceforge.plantuml.klimt.shape.UEllipse;
public class CircleInterface implements UDrawable {
private final float thickness;
private final double headDiam;
private final HColor backgroundColor;
private final HColor foregroundColor;
public CircleInterface(HColor backgroundColor, HColor foregroundColor, double headDiam, float thickness) {
this.backgroundColor = backgroundColor;
this.foregroundColor = foregroundColor;
this.headDiam = headDiam;
this.thickness = thickness;
}
public void drawU(UGraphic ug) {
final UEllipse head = UEllipse.build(headDiam, headDiam);
ug.apply(UStroke.withThickness(thickness)).apply(backgroundColor.bg()).apply(foregroundColor)
.apply(new UTranslate(thickness, thickness)).draw(head);
}
public double getPreferredWidth(StringBounder stringBounder) {
return headDiam + 2 * thickness;
}
public double getPreferredHeight(StringBounder stringBounder) {
return headDiam + 2 * thickness;
}
}