Skip to content

Commit a112556

Browse files
ShahzaibIbrahimfedejeanne
authored andcommitted
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.
1 parent e62052f commit a112556

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

news/4.38/platform_isv.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,27 @@ gc.drawImage(image, 0, 0, 200, 100);
3333
#### Additional Note
3434
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.
3535
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
39+
40+
<details>
41+
<summary>Contributors</summary>
42+
43+
- [Shahzaib Ibrahim](https://github.com/ShahzaibIbrahim)
44+
</details>
45+
46+
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

Comments
 (0)