archi: Not using ScaledGraphics class degrades quality at higher zoom

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)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 57 (57 by maintainers)

Most upvoted comments

Suggest this:

  1. You test this

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

as it is for me what should have been the right behavior from the begining

It only took 10 years… 😉

Seems like you want to translate(offset, offset) or something similar ?

Yes. The problem is that in most cases we want x and y to be 0.5 pixel indented. With translate we can do this.

Check out rectangle and rounded rectangle figures in the latest commit in figure-fixes branch 😉

I’ve made progress on the Figures. I want to get us to where we were before removing ScaledGraphics. And once that is done we can think about setting line widths later.

  1. Remove the minus 1 pixel width and height adjustments in ExtendedGraphicsToGraphics2DAdaptor
  2. Make adjustments for width and height by minus 1 pixel in some figures
  3. Use org.eclipse.swt.graphics.Path for drawing fills instead of org.eclipse.draw2d.geometry.PointList.

The key is to use org.eclipse.swt.graphics.Path for drawing where possible.

Here’s an example of AbstractMotivationFigure before these changes. This uses Graphics.fillPolygon(points):

before

And this one uses Graphics.fillPath(path):

after

I wrote a utility method to convert the co-ordinates of org.eclipse.draw2d.geometry.PointList into a org.eclipse.swt.graphics.Path.

By doing this we can draw with more accuracy.

All of this is in the figure-fixes branch.

I’ll release another beta.