Skip to content

Wrong type of ImageData generated by smooth scaling #228

@HeikoKlare

Description

@HeikoKlare

The DPIUtil method for auto-scaling image data

private static ImageData autoScaleImageData (Device device, final ImageData imageData, float scaleFactor)

performs the scaling via drawing the image using an anti-aliased GC into a new image when auto-scale mode SMOOTH is enabled.

The created image, into which the rescaled image is drawn, does not take the characteristics of the original image data into account (e.g., containing a transparency mask) but simply initializes the image with alpha data. One consequence is that rescaling images of type SWT.ICON, which use a transparency mask, lose their transparency mask and thus their image type when rescaling (eclipse-platform/eclipse.platform.swt#1790).

The autoScaleImageData method shall be improved to return image data with the same characteristics (in particular the type of transparency) used by the original data when the auto-scaling mode is SMOOTH.
One possibility might be to apply a similar solution as in eclipse-platform/eclipse.platform.swt#1790 but inside the auto-scaling implementation rather than in a consumer.

See also:

Metadata

Metadata

Labels

HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

✅ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions