use of de.mossgrabers.framework.graphics.IGraphicsInfo in project DrivenByMoss by git-moss.
the class AbstractGraphicDisplay method renderImage.
private void renderImage() {
this.image.render(this.configuration.isAntialiasEnabled(), gc -> {
final int width = this.dimensions.getWidth();
final int height = this.dimensions.getHeight();
final double separatorSize = this.dimensions.getSeparatorSize();
// Clear display
final ColorEx colorBorder = this.configuration.getColorBorder();
gc.fillRectangle(0, 0, width, height, colorBorder);
final List<IComponent> elements = this.info.getComponents();
final int size = elements.size();
if (size == 0)
return;
final int gridWidth = width / size;
final double paintWidth = gridWidth - separatorSize;
final double offsetX = separatorSize / 2.0;
final IGraphicsInfo graphicsInfo = new DefaultGraphicsInfo(gc, this.configuration, this.dimensions);
for (int i = 0; i < size; i++) {
final IComponent component = elements.get(i);
if (component != null)
component.draw(graphicsInfo.withBounds(i * gridWidth + offsetX, 0, paintWidth, height));
}
final String notification = this.info.getNotification();
if (notification == null)
return;
final ColorEx colorText = this.configuration.getColorText();
gc.drawTextInBounds(notification, 0, 0, width, height, Align.CENTER, colorText, colorBorder, height / 4.0);
});
}
Aggregations