-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
eclipse-platform/eclipse.platform.swt
#2563Labels
Milestone
Description
Background
The constructor Cursor(Device, ImageData source, ImageData mask, int hotspotX, int hotspotY)
allows creating a cursor by providing a source image and a 1-bit mask to define transparency. This approach requires developers to manually define mask pixels and works reliably only in fixed DPI environments.
With the introduction of multi-monitor DPI support, this constructor produces inconsistent results.
- Masks do not scale properly when using
DPIUtil.autoScaleImageData
, leading to visual artifacts. - Developers need to handle scaling and mask adjustments manually, which is error-prone.
Recommendation
Deprecate the Cursor(Device, ImageData, ImageData, int, int)
constructor.
Instead, recommend using:
Cursor(Device device, ImageDataProvider imageDataProvider, int hotspotX, int hotspotY)
The ImageDataProvider
variant:
- Provides better results with multi-monitor DPI scaling.
- Allows supplying high-DPI images directly.
- Avoids manual mask management.
Migration Guidance
- For new code, use
Cursor(Device, ImageDataProvider, int, int)
. - Existing usages of source+mask should be refactored to provide ARGB images via
ImageDataProvider
.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
✅ Done