You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update N&N: Clarify rationale for Cursor constructor deprecation in SWT
- Updated the news and noteworthy entry for the deprecation of
Cursor(Device, ImageData, ImageData, int, int)` in SWT.
- Clarified that the constructor was deprecated due to limited DPI
support.
- Explained that the new Cursor(Device, ImageDataProvider, int, int)
constructor provides the best image for all zoom levels, ensuring proper
support for high-DPI displays.
When using the new `drawImage` method, images that can provide size-specific data (such as SVGs or images backed by `ImageDataAtSizeProvider`) are loaded at the destination size, avoiding blurry scaling.
35
35
For all other images the behavior remains the same as before _i.e._ they are loaded at the closest available zoom level.
36
-
This destination-size loading is currently only available in the new method but may be added to the existing method in the future.
36
+
This destination-size loading is currently only available in the new method but may be added to the existing method in the future.
37
+
38
+
### Cursor Constructor Deprecation and Replacement
The constructor `Cursor(Device, ImageData, ImageData, int, int)` has been **deprecated** in SWT due to its limited DPI support.
47
+
This constructor allows creating a cursor by providing a source image and a 1-bit mask to define transparency.
48
+
This approach requires developers to manually define mask pixels and works reliably **only** in fixed DPI environments.
49
+
50
+
However, this approach has become uncommon, as modern practices typically encode mask data directly into the image data itself (for example, by using alpha channels).
51
+
52
+
If you are currently using the deprecated constructor, you can switch to one of the following alternatives:
53
+
54
+
-`Cursor(Device, ImageData, int, int)`: This constructor that accepts a single ImageData object (containing both the image and mask information) is not deprecated since the mask data is directly encoded into the image and as a user you don't need to define mask pixel by pixel.
55
+
56
+
- (**Recommended**) `Cursor(Device, ImageDataProvider, int, int)`: This constructor ensures the best possible image for a cursor at all zoom levels.
57
+
58
+
#### Call for Action
59
+
We encourage you to update your code and use the **recommended** constructor for better compatibility and a more future-proof code.
0 commit comments