Suppress warnings for getImageDataAtCurrentZoom()
This PR adds suppression for deprecation warnings related to getImageDataAtCurrentZoom() in the ClipboardExample code.
Test Results
539 files ±0 539 suites ±0 27m 53s ⏱️ - 4m 47s 4 330 tests ±0 4 320 ✅ ±0 9 💤 ±0 1 ❌ ±0 16 579 runs ±0 16 477 ✅ ±0 101 💤 ±0 1 ❌ ±0
For more details on these failures, see this check.
Results for commit 4f8a6acb. ± Comparison against base commit fbdacfbb.
:recycle: This comment has been updated with latest results.
I’d like to proceed with merging this if there are no objections
I do currently not have a better solution (except passing
DPIUtil.getDeviceZoom()to the ordinarygetImageData()).
Isn't that the perfect solution for such an example?
- It avoids deprecated API
- It shows the complexity of high DPI handling
- It explains how to get the the current device's zoom using proper API
There are two problems with that approach:
DPIUtilis internal and not supposed to be used outside SWT. The whole auto-scaling concept is supposed to be SWT-internal.DPIUtil.getDeviceZoom()does not have a proper meaning once monitor-specific scaling is used (as now provided for Windows). You then have to consider the context-dependent zoom.
In this case, it's about retrieving image data in some zoom that did not apply any auto-scaling as via clipboard you cannot pass a proper image with according metadata but only the image data for some specific zoom, so they should have the best available quality. But you may have images that can provide image data in any zoom of best quality (like those rendered from SVGs). Since you don't know where data from a clipboard will be used, you can only use some data in a best-effort manner.
Maybe, in the case where you really want to paste some image data into the clipboard, the best would even be to avoid any auto-scaling and just use the data at 100%, so calling getImageData(100) or just getImageData().
This became obsolete as the usage of getImageDataAtCurrentZoom() has been replaced with:
- https://github.com/eclipse-platform/eclipse.platform.swt/pull/2158