net.sourceforge.plantuml.klimt.drawing.hand.UPolygonHand 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.drawing.hand;
import java.util.List;
import java.util.Random;
import net.sourceforge.plantuml.klimt.Shadowable;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.UPolygon;
public class UPolygonHand {
private final UPolygon poly;
public UPolygonHand(UPolygon source, Random rnd) {
final List pt = source.getPoints();
if (pt.size() == 0) {
poly = new UPolygon();
return;
}
final HandJiggle jiggle = HandJiggle.create(pt.get(0), 1.5, rnd);
for (int i = 1; i < pt.size(); i++) {
jiggle.lineTo(pt.get(i));
}
jiggle.lineTo(pt.get(0));
this.poly = jiggle.toUPolygon();
this.poly.setDeltaShadow(source.getDeltaShadow());
}
public Shadowable getHanddrawn() {
return this.poly;
}
}