Adding DynamicallySizableImageDataProvider which enables loading images at custom sizes #2526
+480
−81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementations of DynamicallySizableImageDataProvider can provide image data at a requested targetHeight and targetWidth. The behavior of GC#drawImage() is updated: when drawing a dynamically sizeable image, it requests a handle at the target size. If the image can be loaded at that size, it is used directly; otherwise, the image is loaded as before and scaled using zoom.
In the Windows implementation, if the source or destination width or height is set to zero, the image will be drawn fully, avoiding the need to call getBounds() to determine the image size.
With this changes we need to test the following
Steps to reproduce:
snippet 1 to check drawing svgs at custom sizes (click to show snippet)
**Step 1**: Copy the eclipse.svg to same path where the snippets are and run the below snippet. **Step 2**: Run the snippetpackage org.eclipse.swt.snippets;
before
after
**snippet 2** Drawing images with ImageDataAtSizeProvider
package org.eclipse.swt.snippets;
This depends on #2514 and #2509, Only last commit is relevant to this PR