net.sourceforge.plantuml.svek.RoundedNorth 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.svek;
import net.sourceforge.plantuml.klimt.UPath;
import net.sourceforge.plantuml.klimt.UShape;
import net.sourceforge.plantuml.klimt.UStroke;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.shape.UDrawable;
import net.sourceforge.plantuml.klimt.shape.URectangle;
public final class RoundedNorth implements UDrawable {
private final double width;
private final double height;
private final HColor backColor;
private final double rounded;
public RoundedNorth(double width, double height, HColor backColor, double rounded) {
if (width == 0)
throw new IllegalArgumentException();
if (height == 0)
throw new IllegalArgumentException();
this.width = width;
this.height = height;
this.rounded = rounded;
this.backColor = backColor;
}
public void drawU(UGraphic ug) {
if (backColor.isTransparent())
return;
final UShape header;
if (rounded == 0) {
header = URectangle.build(width, height);
} else {
final UPath path = UPath.none();
path.moveTo(rounded / 2, 0);
path.lineTo(width - rounded / 2, 0);
path.arcTo(rounded / 2, rounded / 2, 0, 0, 1, width, rounded / 2);
path.lineTo(width, height);
path.lineTo(0, height);
path.lineTo(0, rounded / 2);
path.arcTo(rounded / 2, rounded / 2, 0, 0, 1, rounded / 2, 0);
path.closePath();
header = path;
}
ug.apply(UStroke.simple()).apply(backColor).apply(backColor.bg()).draw(header);
}
}