Skip to content

Conversation

HeikoKlare
Copy link
Contributor

@HeikoKlare HeikoKlare commented Oct 13, 2025

With the support of SVGs and the addition of the ImageDataAtSizeProvider, it is possible for many Image instances to provide a handle that represents the image at sharply rendered specific size in addition to the existing support of providing an image at different zooms of a base size.

This change adds according support to the MacOS implementations of GC and Image. The GC#drawImage() method accepting only destination position and size now makes use of enhanced Image capabilities to load the image at the desired size if possible instead of just using the best fitting zoomed handle.

Can be tested with the snippets provided for the Windows implementation PR:

Copy link
Contributor

github-actions bot commented Oct 13, 2025

Test Results

  115 files  ±0    115 suites  ±0   13m 26s ⏱️ +20s
4 554 tests ±0  4 538 ✅ ±0  16 💤 ±0  0 ❌ ±0 
  311 runs  ±0    308 ✅ ±0   3 💤 ±0  0 ❌ ±0 

Results for commit 6af993c. ± Comparison against base commit ac18a18.

♻️ This comment has been updated with latest results.

});
}

@FunctionalInterface
Copy link
Contributor

Choose a reason for hiding this comment

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

the name does not make sense as it does not consume a handle , but an image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I just removed the interface as it's only an image consumer.

@HeikoKlare HeikoKlare force-pushed the render-at-size-macos branch from c26d738 to adff2de Compare October 16, 2025 07:59
return Optional.empty();
}
Image image = new Image(device, imageData.get());
NSBitmapImageRep representation = image.getRepresentation(100);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldnt the image.getRepresentation be inside the if condition? also not very clear to me why do we get and remove representation at 100.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it can be inside the if block. I fixed that with the latest commit.
We create the image based on image data in the line before (1881), which effectively creates an image with a 100% representation (out of the given image data). For that reason, we retrieve the representation at that same zoom. We then use the createRepFromSourceAndApplyFlag to apply the style flag on that representation (which adds another representation with that styling to the image), so that we need to remove the original (unstyled) representation afterwards.

@HeikoKlare HeikoKlare force-pushed the render-at-size-macos branch from adff2de to 2b33ae5 Compare October 16, 2025 13:54
Copy link
Contributor

@arunjose696 arunjose696 left a comment

Choose a reason for hiding this comment

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

The code changes LGTM

With the support of SVGs and the addition of the
ImageDataAtSizeProvider, it is possible for many Image instances to
provide a handle that represents the image at sharply rendered specific
size in addition to the existing support of providing an image at
different zooms of a base size.

This change adds according support to the MacOS implementations of GC
and Image. The GC#drawImage() method accepting only destination position
and size now makes use of enhanced Image capabilities to load the image
at the desired size if possible instead of just using the best fitting
zoomed handle.
@HeikoKlare HeikoKlare force-pushed the render-at-size-macos branch from 2b33ae5 to 6af993c Compare October 16, 2025 19: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 MacOS

2 participants