mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-07 12:24:58 +10:00
configurable high dpi
This commit is contained in:
@@ -61,6 +61,7 @@ public interface IPlugInPort extends ISelectionProcessor, IMouseProcessor, IKeyP
|
||||
|
||||
public static final String ANTI_ALIASING_KEY = "antiAliasing";
|
||||
public static final String HI_QUALITY_RENDER_KEY = "hiQualityRender";
|
||||
public static final String HIGH_DPI_RENDERING = "hiDpiRendering";
|
||||
public static final String EXPORT_GRID_KEY = "exportGrid";
|
||||
public static final String STICKY_POINTS_KEY = "stickyPoints";
|
||||
public static final String METRIC_KEY = "metric";
|
||||
|
||||
@@ -311,6 +311,7 @@ public class DrawingCache {
|
||||
this.zoom = zoom;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this.scaleFactor = scaleFactor;
|
||||
}
|
||||
|
||||
public IDIYComponent<?> getComponent() {
|
||||
|
||||
@@ -249,6 +249,10 @@
|
||||
<releaseDate>2025-03-09 00:00:00.000 CET</releaseDate>
|
||||
<name></name>
|
||||
<changes>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>NEW_FEATURE</changeType>
|
||||
<description>Configurable 'High DPI Rendering' feature which makes the diagram smoother on high-resolution displays but can affect performance</description>
|
||||
</org.diylc.appframework.update.Change>
|
||||
<org.diylc.appframework.update.Change>
|
||||
<changeType>IMPROVEMENT</changeType>
|
||||
<description>Upgraded source code structure to modern standards and introduced Maven</description>
|
||||
|
||||
@@ -275,6 +275,7 @@ Heaters
|
||||
Height
|
||||
Help
|
||||
Hi-Quality Rendering
|
||||
High DPI Rendering
|
||||
Highlight Connected Areas
|
||||
Hole
|
||||
Hole Size
|
||||
|
||||
@@ -42,6 +42,7 @@ import javax.swing.AbstractAction;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.KeyStroke;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.diylc.appframework.miscutils.IConfigListener;
|
||||
import org.diylc.appframework.miscutils.IConfigurationManager;
|
||||
|
||||
import org.diylc.common.ComponentType;
|
||||
@@ -98,6 +99,15 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
// GraphicsDevice[] devices = graphicsEnvironment.getScreenDevices();
|
||||
// screenGraphicsConfiguration = devices[0].getDefaultConfiguration();
|
||||
|
||||
configManager.addConfigListener(IPlugInPort.HIGH_DPI_RENDERING,
|
||||
new IConfigListener() {
|
||||
|
||||
@Override
|
||||
public void valueChanged(String key, Object value) {
|
||||
bufferImage = null;
|
||||
}
|
||||
});
|
||||
|
||||
initializeActions();
|
||||
}
|
||||
|
||||
@@ -311,8 +321,12 @@ public class CanvasPanel extends JComponent implements Autoscroll {
|
||||
}
|
||||
|
||||
final Graphics2D g2d = (Graphics2D)g;
|
||||
double scaleFactor = Math.sqrt(g2d.getTransform().getDeterminant());
|
||||
// scaleFactor = 1d;
|
||||
double scaleFactor;
|
||||
if (configManager.readBoolean(IPlugInPort.HIGH_DPI_RENDERING, false)) {
|
||||
scaleFactor = Math.sqrt(g2d.getTransform().getDeterminant());
|
||||
} else {
|
||||
scaleFactor = 1d;
|
||||
}
|
||||
|
||||
Rectangle visibleRect = getVisibleRect();
|
||||
|
||||
|
||||
@@ -100,6 +100,9 @@ public class ConfigPlugin implements IPlugIn {
|
||||
// swingUI.injectMenuAction(
|
||||
// ActionFactory.getInstance().createConfigAction(plugInPort, "Hardware Acceleration", IPlugInPort.HARDWARE_ACCELERATION, false),
|
||||
// CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "High DPI Rendering",
|
||||
IPlugInPort.HIGH_DPI_RENDERING, false), CONFIG_MENU);
|
||||
swingUI.injectMenuAction(
|
||||
ActionFactory.getInstance().createConfigAction(plugInPort, "Hi-Quality Rendering",
|
||||
IPlugInPort.HI_QUALITY_RENDER_KEY, false), CONFIG_MENU);
|
||||
|
||||
Reference in New Issue
Block a user