net.sourceforge.plantuml.klimt.drawing.eps.DriverPolygonEps 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.eps;
import net.sourceforge.plantuml.klimt.ClipContainer;
import net.sourceforge.plantuml.klimt.UClip;
import net.sourceforge.plantuml.klimt.UParam;
import net.sourceforge.plantuml.klimt.color.ColorMapper;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColorGradient;
import net.sourceforge.plantuml.klimt.drawing.UDriver;
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.UPolygon;
public class DriverPolygonEps implements UDriver {
private final ClipContainer clipContainer;
public DriverPolygonEps(ClipContainer clipContainer) {
this.clipContainer = clipContainer;
}
public void draw(UPolygon shape, double x, double y, ColorMapper mapper, UParam param, EpsGraphics eps) {
final double points[] = new double[shape.getPoints().size() * 2];
int i = 0;
for (XPoint2D pt : shape.getPoints()) {
points[i++] = pt.getX() + x;
points[i++] = pt.getY() + y;
}
final UClip clip = clipContainer.getClip();
if (clip != null) {
for (int j = 0; j < points.length; j += 2) {
if (clip.isInside(points[j], points[j + 1]) == false) {
return;
}
}
}
if (shape.getDeltaShadow() != 0) {
eps.epsPolygonShadow(shape.getDeltaShadow(), points);
}
final HColor back = param.getBackcolor();
if (back instanceof HColorGradient) {
eps.setStrokeColor(param.getColor().toColor(mapper));
eps.epsPolygon((HColorGradient) back, mapper, points);
} else {
eps.setFillColor(back.toColor(mapper));
eps.setStrokeColor(param.getColor().toColor(mapper));
eps.epsPolygon(points);
}
}
}