Skip to content

Support drawing images at custom sizes/zooms #326

@HeikoKlare

Description

@HeikoKlare

Description
Currently, image representations are tied to zoom values (usually according device/monitor zooms). In some situation, one wants to draw images at sizes independent from any device/monitor zoom but may want to use an arbitrary zoom value or even an arbitrary size.
There are already GC#drawImage() methods accepting destination sizes and then performing according (potentially blurry) scaling of the images at the GC level.

Potential use cases:

Goal
It shall be possible to draw images at a custom zoom/size at the best achievable quality. This means either

  • rescaling from the most fitting zoomed version of the image that exists
  • rasterizing the image at the according size from an SVG source

The first use cases I would expect to be supported are:

  • Drawing in best possible quality in the GC#drawImage() methods accepting a destination size
  • Scaling the annotation ruler according to a custom editor zoom with sharp images

Additional Knowledge
This will probably require new API to Image in SWT that allow to request an image at a specific size rather than a given zoom.

We potentially need to careful to not create additional handles/representations for each such size, as otherwise we can easily run out of handles (on Windows). Instead of providing the image data or a handle itself via Image API, we might also just provide API to perform an operation on some ImageData or handle for a specific image zoom/size, such that, e.g., the GC can pass a callback for performing the drawing operation on the Image and the Image itself takes care of providing according image data or a (temporary) handle.

This will also require extensions to the ImageLoader and FileFormat implementation, as for SVGs it will probably be necessary to allow passing sizes instead of zoom to the loading implementation.

Metadata

Metadata

Assignees

Labels

HiDPIA HiDPI-Related Issue or FeatureSWTIssue for SWT

Type

No type

Projects

Status

🏗 In Work: Short

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions