archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
970 stars 270 forks source link

Not using ScaledGraphics class degrades quality at higher zoom #637

Closed Phillipus closed 4 years ago

Phillipus commented 4 years ago

In order to fix #621 we removed the use of the org.eclipse.draw2d.ScaledGraphics class. However, looking closer at some zoomed diagrams there are now new issues:

  1. The outer rectangle of a box is misaligned on right and bottom sides
  2. Fonts are not smooth
  3. Other artefacts
  4. Fonts loaded via Display#loadFont() are not scaled and rendered correctly (see #628)
Phillipus commented 4 years ago

That's good new though.

Everything we do should work with or without ScaledGraphics...at 100% scale. ScaledGraphics is only used by GEF if scaling/zoom != 1.0:

    protected void paintClientArea(Graphics graphics) {
        if (getChildren().isEmpty())
            return;
        if (scale == 1.0) {
            super.paintClientArea(graphics);
        } else {
            ScaledGraphics g = new ScaledGraphics(graphics);
jbsarrodie commented 4 years ago

Suggest this:

  1. You test this

I've just tested and everything seems ok. Good !

Phillipus commented 4 years ago

You can even set the line width to 0 and we are back to how it was before. Of course, line width of 0 doesn't work on Mac or Linux so it would have to be Windows only...

(Edited to include Linux)

jbsarrodie commented 4 years ago

Some comments on Archi 4.7 beta 7 on this aspect.

I can still see some small drawing issues (here at 400%): image

I can also see some slight differences between 100% and other zoom factors (I guess this is because in this case we don't use translate() and other tricks.

All in all, there is nothing requesting any change in the short term. This is really acceptable for 4.7 final. I'll try to look at them for 4.7.1 or 4.8.

Phillipus commented 4 years ago

Arrowhead is a bit truncated on the left and is not fully filled

It was truncated before. The fill problem is because it is drawing an outline and a fill and they do not line up.

I created a new class com.archimatetool.editor.diagram.figures.connections.PathDrawnPolygonDecoration that helps with AggregationConnectionFigure and CompositionConnectionFigure but for the other connections I could not resolve them. I dug deep into the code and I think there are issues to do with clipping in one of the super classes of org.eclipse.draw2d.PolylineConnection

But connections need further investigation as you say.

Phillipus commented 4 years ago

Let's close this and open individual issues for each individual case.

Phillipus commented 4 years ago

A follow up to this.

Not using scaled graphics in Archi 4.7 has made an improvement to connections that have dots/dashes when exporting to an image at scales greater than 100%, In Archi 4.6 the dots/dashes didn't scale when exporting at higher scales.

Here's an image export at 200% from Archi 4.6:

Default View

And here's the same image export at 200% from Archi 4.7:

Default View2