use of limelight.styles.Style in project limelight by slagyr.
the class BackgroundPainter method paint.
public void paint(Graphics2D graphics, PaintablePanel panel) {
Style style = panel.getStyle();
Border border = panel.getBorderShaper();
Shape insideBorder = border.getShapeInsideBorder();
Color backgroundColor = style.getCompiledBackgroundColor().getColor();
if (style.getCompiledGradient().isOn())
GradientPainter.instance.paint(graphics, panel);
else {
if (backgroundColor.getAlpha() > 0) {
graphics.setColor(backgroundColor);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
graphics.fill(insideBorder);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
NoneableValue<StringValue> backgroundImageAttribute = style.getCompiledBackgroundImage();
if (!backgroundImageAttribute.isNone()) {
try {
Box borderFrame = panel.getBorderedBounds();
Scene rootPanel = panel.getRoot();
// TODO MDM - getting a NullPointer here. The Panel was removed from the scene in between the start of the paint cycle and here.
if (rootPanel == null)
return;
ImageCache cache = rootPanel.getImageCache();
Image image = cache.getImage(backgroundImageAttribute.getAttribute().getValue());
Graphics2D borderedGraphics = (Graphics2D) graphics.create(borderFrame.x, borderFrame.y, borderFrame.width, borderFrame.height);
style.getCompiledBackgroundImageFillStrategy().fill(borderedGraphics, image, style.getCompiledBackgroundImageX(), style.getCompiledBackgroundImageY());
} catch (IOException e) {
e.printStackTrace();
}
}
}
use of limelight.styles.Style in project limelight by slagyr.
the class BorderPainter method paint.
public void paint(Graphics2D graphics, PaintablePanel panel) {
Style style = panel.getStyle();
Pen pen = new Pen(graphics);
Border border = panel.getBorderShaper();
if (border.hasTopBorder())
pen.withColor(style.getCompiledTopBorderColor().getColor()).withStroke(border.getTopWidth()).withAntialiasing(false).draw(border.getTopLine());
if (border.hasTopRightCorner())
pen.withColor(style.getCompiledTopRightBorderColor().getColor()).withStroke(border.getTopRightWidth()).withAntialiasing(true).draw(border.getTopRightArc());
if (border.hasRightBorder())
pen.withColor(style.getCompiledRightBorderColor().getColor()).withStroke(border.getRightWidth()).withAntialiasing(false).draw(border.getRightLine());
if (border.hasBottomRightCorner())
pen.withColor(style.getCompiledBottomRightBorderColor().getColor()).withStroke(border.getBottomRightWidth()).withAntialiasing(true).draw(border.getBottomRightArc());
if (border.hasBottomBorder())
pen.withColor(style.getCompiledBottomBorderColor().getColor()).withStroke(border.getBottomWidth()).withAntialiasing(false).draw(border.getBottomLine());
if (border.hasBottomLeftCorner())
pen.withColor(style.getCompiledBottomLeftBorderColor().getColor()).withStroke(border.getBottomLeftWidth()).withAntialiasing(true).draw(border.getBottomLeftArc());
if (border.hasLeftBorder())
pen.withColor(style.getCompiledLeftBorderColor().getColor()).withStroke(border.getLeftWidth()).withAntialiasing(false).draw(border.getLeftLine());
if (border.hasTopLeftCorner())
pen.withColor(style.getCompiledTopLeftBorderColor().getColor()).withStroke(border.getTopLeftWidth()).withAntialiasing(true).draw(border.getTopLeftArc());
}
use of limelight.styles.Style in project limelight by slagyr.
the class ScrollLayout method layoutRows.
public void layoutRows(PropPanel panel, Dimension consumeDimension, LinkedList<Row> rows, int dx, int dy) {
Style style = panel.getStyle();
int y = style.getCompiledVerticalAlignment().getY(consumeDimension.height, panel.getChildConsumableBounds());
y = Math.max(0, y);
y -= dy;
for (Row row : rows) {
int x = style.getCompiledHorizontalAlignment().getX(row.width, panel.getChildConsumableBounds());
x = Math.max(0, x);
x -= dx;
row.layoutComponents(x, y, style.getCompiledVerticalAlignment());
y += row.height;
}
}
use of limelight.styles.Style in project limelight by slagyr.
the class TextPanelTextPainter method paint.
@Override
public void paint(Graphics2D graphics, limelight.ui.model.text.TextModel model) {
if (!model.hasText())
return;
float y = model.getYOffset();
Style style = model.getContainer().getStyle();
graphics.setColor(style.getCompiledTextColor().getColor());
for (TypedLayout line : model.getLines()) {
int x = model.getXOffset(line);
y += line.getAscent();
line.draw(graphics, x, y);
y += line.getDescent() + line.getLeading();
}
}
use of limelight.styles.Style in project limelight by slagyr.
the class BuiltInStylesTest method hasCurtains.
@Test
public void hasCurtains() throws Exception {
Style curtains = styles.get("limelight_builtin_curtains");
assertNotNull(curtains);
assertEquals("on", curtains.getFloat());
}
Aggregations