feat(renderer): enhance window geometry application and improve color theme handling in AsciiPatternRenderer

This commit is contained in:
extio-de
2026-02-01 18:51:39 +01:00
parent 1a20739724
commit c851ea31b1
2 changed files with 24 additions and 9 deletions

View File

@@ -397,13 +397,28 @@ public class G2DMainFrame extends Frame {
} }
private void applyReferenceWindowGeometry() { private void applyReferenceWindowGeometry() {
// final var mode = this.getGraphicsConfiguration().getDevice().getDisplayMode();
// final var size = ImmutableCoordI2.create(Math.min(mode.getWidth(), RendererControl.REFERENCE_RESOLUTION.getX()), Math.min(mode.getHeight(), RendererControl.REFERENCE_RESOLUTION.getY()));
// this.setLocation(mode.getWidth() / 2 - size.getX() / 2, mode.getHeight() / 2 - size.getY() / 2);
final var ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final var ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
final var bounds = ge.getDefaultScreenDevice().getDefaultConfiguration().getBounds(); final var bounds = ge.getDefaultScreenDevice().getDefaultConfiguration().getBounds();
this.setLocation(bounds.x, bounds.y); final int screenW = (int) bounds.getWidth();
this.setSize((int) Math.min(bounds.getWidth(), RendererControl.REFERENCE_RESOLUTION.getX()), (int) Math.min(bounds.getHeight(), RendererControl.REFERENCE_RESOLUTION.getY())); final int screenH = (int) bounds.getHeight();
final int refW = RendererControl.REFERENCE_RESOLUTION.getX();
final int refH = RendererControl.REFERENCE_RESOLUTION.getY();
int width;
int height;
if (screenW > refW || screenH > refH) {
width = Math.max((int) Math.round(screenW * 2.0 / 3.0), refW);
height = Math.max((int) Math.round(screenH * 2.0 / 3.0), refH);
}
else {
width = Math.min(screenW, refW);
height = Math.min(screenH, refH);
}
final int x = bounds.x + (bounds.width - width) / 2;
final int y = bounds.y + (bounds.height - height) / 2;
this.setLocation(x, y);
this.setSize(width, height);
} }
public void handleMouseReleased(final MouseEvent e, final CoordI2 offset) { public void handleMouseReleased(final MouseEvent e, final CoordI2 offset) {

View File

@@ -77,10 +77,10 @@ public class AsciiPatternRenderer implements PatternRenderer {
Color bgColor = backgroundColor; Color bgColor = backgroundColor;
if (bgColor == null) { if (bgColor == null) {
bgColor = theme.getBorderInner().toColor(); bgColor = theme.getBackgroundNormal().toColor();
} }
if (highlight) { if (highlight) {
bgColor = theme.getBackgroundNormal().toColor(); bgColor = theme.getBorderInner().toColor();
} }
if (pressed) { if (pressed) {
bgColor = theme.getSelectionPrimary().toColor(); bgColor = theme.getSelectionPrimary().toColor();
@@ -101,10 +101,10 @@ public class AsciiPatternRenderer implements PatternRenderer {
textColor = theme.getTextNormal().toColor(); textColor = theme.getTextNormal().toColor();
} }
else if (highlight) { else if (highlight) {
textColor = theme.getSelectionSecondary().toColor(); textColor = theme.getTextDisabled().toColor();
} }
else { else {
textColor = theme.getTextDisabled().toColor(); textColor = theme.getSelectionSecondary().toColor();
} }
g2d.setColor(textColor); g2d.setColor(textColor);