Skip to content

Commit

Permalink
Detect current monitor (screen) change to trigger text and legend redraw
Browse files Browse the repository at this point in the history
  • Loading branch information
jzy3d committed Apr 27, 2022
1 parent e8f3307 commit a4c7f04
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 151 deletions.
22 changes: 1 addition & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,7 @@ Extensions
* <a href="https://github.com/jzy3d/bigpicture">jzy3d-bigpicture</a> : drivers to few big data storage to draw massive amount of points


## Architecture

Creating a chart implies building and wiring the below high-level components.

<img src="doc/Components.png"/>


### Customize chart with factories

The ```IChartFactory``` builds all objects that will define how the chart will look (```Axis```, ```View```, ```Camera```, ```Chart```).

The ```IPainterFactory``` builds every objects that allow compatibility across windowing toolkits and GPU/CPU. The chart factories and drawable have no knowledge of concrete AWT, SWT, Swing, etc. This is all powered by the painter factory introduced in Jzy3d 2.0.

The ```Drawable``` class hierarchy defines geometries able to use a ```IPainter``` to draw something.

<img src="doc/Factories.png"/>


### Native and emulated elements

<img src="doc/Interop.png"/>

## Dependent libraries

Expand Down Expand Up @@ -222,7 +202,7 @@ Integration tests compare charts to baseline images pixel wise. They are importa
* Different OS have different frame insets (changing actual rendering area size) leading to chart screenshots of different size accross OS.
* Different OS have different frame insets (changing actual rendering area size) leading to chart a different layout (colorbar position)
* Different OS have different font rasterization (despite using the JVM font raterizer to minimize OS impact), hence text labels do not match despite having only a few pixel difference.
* A non HiDPI chart screenshot will not have the same size than the baseline that was generated on a Retina display (x2 pixel ratio). Integration tests that may be impacted by HiDPI are gathered in `jzy3d-tests-java9` since at lest Java 9 JREs are required to detect HiDPI for EmulGL charts.
* A non HiDPI chart screenshot will not have the same size than the baseline that was generated on a Retina display (x2 pixel ratio). Integration tests that may be impacted by HiDPI are gathered in `jzy3d-tests-java9` since at lest Java 9 JREs are required to detect HiDPI for EmulGL charts.

This will run all test named `**/ITTest*.java` and unit tests.

Expand Down
Binary file removed doc/Maven.png
Binary file not shown.
1 change: 1 addition & 0 deletions doc/api.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="app.diagrams.net" modified="2022-04-27T09:58:05.685Z" agent="5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36" etag="gYKmEQDrgL7EdAE5viEA" version="15.8.7" type="device"><diagram id="vX6Ck_gIVoLiWwozYTH6" name="Maven">7Z1Zd6JK14B/Ta/1fRfJYh4uGQVRcJ7umGUSZBDx17+QaLpjEo7JwcQ+0t2xYwFFQe1d9VTtvat+wUyw78RqtO6Hhun/ggBj/wtmf0EQiWDlZ5VQPCdgIPKcYMeO8ZwE/k4YOwfzmAgcUzPHMJNXJ6Zh6KdO9DpRDzcbU09fpalxHOavT7NC//VdI9U23ySMddV/mzp3jHT9nEpA+O90wXTs9enOIEY+HwnU08nHJ0nWqhHmfyTB3C+YicMwff4t2DOmX72703t5vo7/4OhLwWJzk15yAd/N10DiawbcA/r7FYtnhfpwzCVJi9MD7xJjL7Ll7+AvmLYc32dCP4zL75twU55C27FqOOUtz5KTNA49U4lU3UmrqgZe0k6vDapSquMbexJGZcID/DuFDtM0DM4Se6aVniWNjq/6Kc1XNdOnVd2z4zDbGGclekozjeOTPJfl7JR1GvjH4/naSc1xeZPqNeSlKJdpb9/w8XXtzDg1938kHd94xwwDM42L8pTjURg+1v5R/EHo+Wv+W5Yg/Cgx6z/kCDmJkXqUX/sl699VXP5yrOVP1Dj0cY1DZzX+C4Ity9RV8pPVvlajKuskNTe64/+ftZINLxRztm8MANAMtNEkRRAs5kl70ueZxSHu2TPepQEw7SYjUkNUzysfrRiXHxEF0Tk+zXpRNzczECQLebfNopiKfkE0p5OL+XS7MzeUrTOjg7JZaVa23qnMjtitZ3yh+Km3ngjJ1lQBQJkvMi8DgOFhqYWJ4g4OaXUDZDYqs0oFEB+HJOp6azkqAGYdhKst6WXloZAs6yhNeyIP8Fk4Xpor2qXFwBzOcwGx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oJCGLJVE/aAaRdvdQKHmk8L3BLnLTEBCyC1nw27zBJvAuIcASyEgU2s26+cBAOSYhQE6vOxv9v4025bXz6bqwEgW+X7AIoO1Cy6XKxwGaSJWwXEedUfsYsMNC2gtRzpcTSMkIb0/8KKqM0plJunghNkFwO0G8IoRKgT7bh/zdkYuO9N5uPAG9GgoZBxIj61VV9up6/k6z6GgSzMovdPcHmorI9TscZ2NWXmpQFLs9imot8wxUIJgSGRpbj2kXCRl5n125WCJPT7o2H5Io6hvkhMFkcMwQVkNL/bZajoAe0XmWIS23U0txuNokN0f2ElVzN6hmrUof3p7e9sXvPI3Ro9Ji1xmftaxE4M3RvjAr+xh8jpxPHXEHkhqeJ/zEKcGqwG/mSsqHfTJeYjXDFWeUj4l8PRSgDOYeu/YM1VVR0rmODv2gldnh19z1qtc/4Sb8mvFN/8Or8oTyD9u/RqzqmQIU4NnGYCfVrhXn9DrPPUlg99EBvyGsrrSHw+9YbSzd/Ia1sqEI6+djv+mturYR0YlI1P9B3Vv/gnhDRN4Ky7/HXGxM8doZaWVlUtkxamGLUlZhlZeWnm5QF780C7Ln66DVl5aeblAXqLQV+NWVlpZuUBWnicCWllpZeUCWcliyzScFltacblIXIpAC3/HC7fS0kpLjbSUt9iocdFKSystF0hLbmqtpLSSUispke4/uOpO/ZRY/JMJ/r6MqVc2wX/CCvRxUAAE42/Nsx+EWII4/nit8CCiZlVz7L5iSZqwwZ+FWL7Y5H8s/IuoCaHF2hDLNsTydrSttn265RDLkyn/vj3/bzfEstH9f+6sU7w2S12u3j8YYFl+jcNKvl6Odcq3s+6Hhlmd8T8=</diagram></mxfile>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.awt.geom.AffineTransform;
import java.util.List;
import org.jzy3d.colors.AWTColor;
import org.jzy3d.maths.Coord2d;
import org.jzy3d.plot2d.rendering.AWTGraphicsUtils;
import org.jzy3d.plot3d.rendering.legends.overlay.LegendLayout.Corner;
import org.jzy3d.plot3d.rendering.view.AWTRenderer2d;
Expand All @@ -23,8 +22,6 @@ public class OverlayLegendRenderer implements AWTRenderer2d {
protected List<Legend> info;
protected LegendLayout layout = new LegendLayout();

Coord2d scale = new Coord2d(1,1);

public OverlayLegendRenderer(List<Legend> info) {
super();
this.info = info;
Expand All @@ -34,15 +31,12 @@ public OverlayLegendRenderer(List<Legend> info) {
public void paint(Graphics g, int canvasWidth, int canvasHeight) {
Graphics2D g2d = (Graphics2D) g;


//g2d.scale(2, 2);
g2d.scale(scale.x, scale.y);

AWTGraphicsUtils.configureRenderingHints(g2d);

if (layout.font != null)
if (layout.font != null) {
g2d.setFont(layout.font);

}

FontMetrics fm = g.getFontMetrics();
int textHeight = fm.getHeight();
int textWidthMax = maxStringWidth(fm);
Expand All @@ -68,6 +62,9 @@ public void paint(Graphics g, int canvasWidth, int canvasHeight) {
g2d.fillRect(xBoxPos, yBoxPos, boxWidth, boxHeight);
}

//System.out.println("OverlayLegendRenderer : Canvas " + canvasWidth + " x " + canvasHeight);
//System.out.println("OverlayLegendRenderer : Font size " + layout.font.getSize());


// Text position
int xTextPos = xBoxPos + layout.txtMarginX;
Expand All @@ -80,19 +77,13 @@ public void paint(Graphics g, int canvasWidth, int canvasHeight) {
yTextPos += (layout.txtInterline + textHeight);
}


// Border
g2d.setColor(AWTColor.toAWT(layout.borderColor));
g2d.drawRect(xBoxPos, yBoxPos, boxWidth, boxHeight);


// Reset scale for other renderers
//g2d.scale(1/scale.x, 1/scale.y);

}



public void paintLegend(Graphics2D g2d, int textHeight, int textWidthMax, int xTextPos,
int yTextPos, Legend line) {
// Text
Expand Down Expand Up @@ -151,11 +142,11 @@ public void setLayout(LegendLayout layout) {
this.layout = layout;
}

public Coord2d getScale() {
/*public Coord2d getScale() {
return scale;
}
public void setScale(Coord2d scale) {
this.scale = scale;
}
}*/
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,7 @@ public void dispose() {
super.dispose();
renderers.clear();
}

// DON T KNOW WHY THE HELL IT IS THERE. MOVED TO SUPER CLASS
/*@Override
protected void renderAxeBox(IAxis axe, Scene scene, Camera camera, Coord3d scaling,
boolean axeBoxDisplayed) {
if (axeBoxDisplayed) {
painter.glMatrixMode_ModelView();
scene.getLightSet().disable(painter);
axe.setScale(scaling);
axe.draw(painter);
if (displayAxisWholeBounds) { // for debug
AxisBox abox = (AxisBox) axe;
BoundingBox3d box = abox.getWholeBounds();
Parallelepiped p = new Parallelepiped(box);
p.setFaceDisplayed(false);
p.setWireframeColor(Color.MAGENTA);
p.setWireframeDisplayed(true);
p.draw(painter);
}
scene.getLightSet().enableLightIfThereAreLights(painter);
}
}*/


// MOVE TO SUPER CLASS THAT HAS EMPTY IMPLEMENTATION FOR FORGOTTEN REASON
@Override
Expand Down
30 changes: 28 additions & 2 deletions jzy3d-core/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
Jzy3d - Core
================================

Provides the base definition of charts without the rendering backend that may be implemented by JOGL (in all module named `jzy3d-native-jogl-*`) or EmulGL (in `jzy3d-emul-gl`).
Provides the base definition of charts without the rendering backend that may be implemented by JOGL (in all module named `jzy3d-native-jogl-*`) or EmulGL (in `jzy3d-emul-gl-*`).

## Javadoc schemas



## Software Architecture

Creating a chart implies building and wiring the below high-level components.

<img src="doc/Components.png"/>


### Customize chart with factories

The ```IChartFactory``` builds all objects that will define how the chart will look (```Axis```, ```View```, ```Camera```, ```Chart```).

The ```IPainterFactory``` builds every objects that allow compatibility across windowing toolkits and GPU/CPU. The chart factories and drawable have no knowledge of concrete AWT, SWT, Swing, etc. This is all powered by the painter factory introduced in Jzy3d 2.0.

The ```Drawable``` class hierarchy defines geometries able to use a ```IPainter``` to draw something.

<img src="doc/Factories.png"/>


### Native and emulated elements

<img src="doc/Interop.png"/>


## Javadoc schemas reference

### Camera

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions jzy3d-core/doc/core.drawio

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
import org.jzy3d.painters.Font;
import org.jzy3d.plot3d.primitives.axis.layout.IAxisLayout;
import org.jzy3d.plot3d.rendering.view.View;
import org.jzy3d.plot3d.text.renderers.TextRenderer;

/**
* This is the greatest {@link IFontSizePolicy} since it scale base font with current pixel scale.
*
* This is only suitable for EmulGL chart, as Native chart often rely on {@link TextRenderer}
* which does not support more font than {@link Font} defaults. Using a {@link JOGLTextRenderer}
* instead allows more font size and styles.
* This is mainly useful to keep the same text size visually when a chart is moved from a HiDPI
* screen to a non HiDPI screen.
*
* If base font has not been set, it will be based on default {@link IAxisLayout#getFont()}
* The base font is based on {@link IAxisLayout#getFont()}.
*
* @author martin
* @author Martin Pernollet
*/
public class HiDPIProportionalFontSizePolicy implements IFontSizePolicy {
protected View view;
Expand All @@ -25,6 +23,10 @@ public HiDPIProportionalFontSizePolicy(View view) {
this.view = view;
}

/**
* Modifies the {@link IAxisLayout} font according to the pixel scale returned by the {@link View}
* and the font that was returned by {@link IAxisLayout} at the first call to this method.
*/
@Override
public Font apply(IAxisLayout layout) {
// Fix base font if not defined
Expand All @@ -34,20 +36,14 @@ public Font apply(IAxisLayout layout) {

// Scale base font
Coord2d scale = view.getPixelScale();
font.setHeight((int) (font.getHeight() * scale.getY()));

if (!Float.isNaN(scale.getY())) {
int height = (int) (font.getHeight() * scale.getY());
font.setHeight(height);
}

// Set and return
layout.setFont(font);
return layout.getFont();
}

public Font getBaseFont() {
return baseFont;
}

public void setBaseFont(Font baseFont) {
this.baseFont = baseFont;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ public interface IScreenCanvas extends ICanvas {
public void display();

public IAnimator getAnimation();

//public void repeatRepaint();
}
Original file line number Diff line number Diff line change
@@ -1,39 +1,60 @@
package org.jzy3d.plot3d.rendering.canvas;

public abstract class PixelScaleWatch implements Runnable {
// does nothing by default
protected void firePixelScaleInit(double pixelScaleX, double pixelScaleY) {
}

protected abstract void firePixelScaleChanged(double pixelScaleX, double pixelScaleY);

public abstract double getPixelScaleX();

public abstract double getPixelScaleY();

double prevX = -1;
double prevY = -1;

long watchIntervalMs = 10;

@Override
public void run() {
while(true) {
while (true) {
watchPixelScaleAndNotifyUponChange();

try {
Thread.sleep(300);
Thread.sleep(watchIntervalMs);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

protected void watchPixelScaleAndNotifyUponChange() {
double x = getPixelScaleX();
double x = getPixelScaleX();
double y = getPixelScaleY();
if((prevX!=-1)&&(prevY!=-1)) {
if((x!=prevX)||(y!=prevY)) {

if ((prevX != -1) && (prevY != -1)) {
if ((x != prevX) || (y != prevY)) {
firePixelScaleChanged(x, y);
}
}

else {
if ((x != prevX) || (y != prevY)) {
firePixelScaleInit(x, y);
}
}

prevX = x;
prevY = y;


}


public long getWatchIntervalMs() {
return watchIntervalMs;
}

public void setWatchIntervalMs(long watchIntervalMs) {
this.watchIntervalMs = watchIntervalMs;
}

}
}
Loading

0 comments on commit a4c7f04

Please sign in to comment.