Skip to content

Conversation

@arunjose696
Copy link
Contributor

@arunjose696 arunjose696 commented Oct 14, 2025

This change introduces support for loading and drawing images at custom sizes in the GTK versions of GC and Image. The GC#drawImage() method, which only accepts the destination position and size, now attempts to load image at the destination size in case if it is provided by ImageFilenameProvider returning svgs or if the image is created with a imageDataAtSizeProvider.

Changes can be tested with snippets in #2526 for svgs and the tests with image dataAtSize provider which are enabled for linux along with this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 14, 2025

Test Results

  118 files  ±0    118 suites  ±0   16m 8s ⏱️ + 1m 12s
4 646 tests  - 1  4 629 ✅ ±0  17 💤  - 1  0 ❌ ±0 
  330 runs  ±0    326 ✅ ±0   4 💤 ±0  0 ❌ ±0 

Results for commit 583bf9b. ± Comparison against base commit a6cdf00.

This pull request removes 1 test.
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_graphics_GC ‑ test_drawImageLorg_eclipse_swt_graphics_ImageIIII_ImageDataAtSizeProvider(int)

♻️ This comment has been updated with latest results.

Copy link
Contributor

@HeikoKlare HeikoKlare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change seems to work fine and in general also the implementation looks fine. I have one question regarding the zoom changes performed on the involved images.

@laeubi
Copy link
Contributor

laeubi commented Oct 21, 2025

GTK already has org.eclipse.swt.graphics.Image.drawScaled(GC, ImageData, int, int, float) can't that be used? this also seems to use the imageprovider to get a scaled variant?

@HeikoKlare
Copy link
Contributor

GTK already has org.eclipse.swt.graphics.Image.drawScaled(GC, ImageData, int, int, float) can't that be used? this also seems to use the imageprovider to get a scaled variant?

I guess you refer to drawAtSize()? That method is used to scale an image and not to render it at a specific size. It can only use what's given at different zooms to do a best-possible scaling from. But it will usually lead to blurry results whereas the new functionality is capable of rendering sharply at any size, given an SVG, an ImageDataAtSizeProvider or the like. But that's nothing specific for GTK, it is the same for every OS and GTK is the last to adopt this functionality (Windows and MacOS are already implemented).

@arunjose696 arunjose696 force-pushed the arunjose696/467/IDSP_linux branch from 5eb8858 to cb93be5 Compare October 28, 2025 08:55
@HeikoKlare HeikoKlare force-pushed the arunjose696/467/IDSP_linux branch from cb93be5 to 0e7762e Compare October 28, 2025 11:59
This change introduces support for loading and drawing images at custom sizes in the GTK versions of GC and Image.
The GC#drawImage() method, which  only accepts the destination position and size, now attempts to load image at the destination size in case if it is provided by
ImageFilenameProvider returning svgs or if the image is created with a imageDataAtSizeProvider.
@HeikoKlare HeikoKlare force-pushed the arunjose696/467/IDSP_linux branch from 0e7762e to 583bf9b Compare October 28, 2025 13:05
@akurtakov
Copy link
Member

akurtakov commented Oct 28, 2025

I have tested this PR using Snippet 2 from #2526 .
While blur is gone, the "half" drawings are actually same as full. I haven't looked into why this happens. This is the case both with and without this PR.

@HeikoKlare
Copy link
Contributor

While blur is gone, the "half" drawings are actually same as full. I haven't looked into why this happens. This is the case both with and without this PR.

Seems like the snippet is incorrect. It's the same on Windows: every image looks the same. I always used Snippet 1 from that PR for testing. With that snippet, I see the expected results also on GTK with this PR.

@arunjose696
Copy link
Contributor Author

Snippet2 is broken as it was initially intended to support the case for drawing the images cropped also in that PR but later we decided to leave drawing the cropped images for later. I have updated the snippet to only draw the full image now.

@HeikoKlare HeikoKlare merged commit cb61a92 into eclipse-platform:master Oct 29, 2025
17 checks passed
@HeikoKlare HeikoKlare deleted the arunjose696/467/IDSP_linux branch October 29, 2025 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend ImageDataAtSizeProvider support to Linux

4 participants