use of org.geepawhill.contentment.format.StyleApplier in project contentment by GeePawHill.
the class TypeFace method font.
public static Style font(Font font, Double width, Double opacity) {
StyleApplier applier = new StyleApplier() {
@Override
public void apply(Shape shape) {
if (shape instanceof Text) {
Text text = (Text) shape;
text.setFont(font);
text.setStrokeWidth(width);
text.setOpacity(opacity);
}
}
};
return new Style(FACE, applier, font.getFamily() + " " + font.getSize());
}
use of org.geepawhill.contentment.format.StyleApplier in project contentment by GeePawHill.
the class TypeFace method color.
public static Style color(Paint stroke, Paint fill, Double opacity) {
StyleApplier applier = new StyleApplier() {
@Override
public void apply(Shape shape) {
shape.setStroke(stroke);
shape.setFill(fill);
shape.setOpacity(opacity);
}
};
String value = "Stroke: " + stroke.toString() + " Fill: " + fill.toString() + " Opacity: " + opacity;
return new Style(COLOR, applier, value);
}
use of org.geepawhill.contentment.format.StyleApplier in project contentment by GeePawHill.
the class Frames method frame.
public static Style frame(Paint stroke, Paint fill, Double width, Double opacity, Dash dash) {
StyleApplier applier = new StyleApplier() {
@Override
public void apply(Shape shape) {
shape.setStroke(stroke);
shape.setFill(fill);
shape.setStrokeWidth(width);
shape.setOpacity(opacity);
shape.getStrokeDashArray().clear();
shape.getStrokeDashArray().addAll(dash.array);
}
};
String value = "Frame: " + stroke.toString() + " Fill: " + fill.toString() + " Width: " + width + " Opacity: " + opacity + " Dash: " + dash;
return new Style(KEY, applier, value);
}
Aggregations