-
Notifications
You must be signed in to change notification settings - Fork 32
Convert AWT Image to ImageDescriptor without creating SWT Image #1151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a933d47 to
f55f1f7
Compare
|
Hm... If I understand the current implementation correctly, the screenshot is always taken at 100% zoom and then artificially upscaled to the actual display zoom. This leads to very blurry images. The decorations of the JFrame are a separate issue which I think can only be fixed in the JDK itself. But I would expect the same issue to be at play here. Furthermore, one little quirk is that |
I suppose this makes sense. The whole UI is created and drawn by Swing, so there is no issue with drawing everything at 100% and then scaling it to whatever zoom is requested. Funnily enough, the same approach is what Andreas suggested for e.g. GEF, in order to fix some of the rounding errors. |
d9f6870 to
2e2961e
Compare
| if (EnvironmentUtils.IS_MAC) { | ||
| return 1.0; | ||
| } | ||
| return component.getGraphicsConfiguration().getDefaultTransform().getScaleX(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked long and hard at the changes done in 6d8cdc2 and I think they have aged incredibly poorly. However, without a Mac to test it with, I have no way of checking how good/bad the editor is looking.
Long story short: This keeps the current behavior of taking everything at 100% zoom.
The current implementation always takes a screenshot of the Swing components at 100% zoom, which is then up-scaled to match the display zoom. Doing so results in blurry and low-quality images. Instead, the screenshot is taken at the current zoom level and contained in an ImageDataProvider. When the image is painted this then allows us to use the correctly scaled image data. Note that artifical scaling is still done, if a different zoom level is requested. Closes eclipse-windowbuilder#506

The current implementation always takes a screenshot of the Swing components at 100% zoom, which is then up-scaled to match the display zoom. Doing so results in blurry and low-quality images.
Instead, the screenshot is taken at the current zoom level and contained in an ImageDataProvider. When the image is painted this then allows us to use the correctly scaled image data. Note that artifical scaling is still done, if a different zoom level is requested.
Closes #506