Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[icrate] Missing CoreGraphics and functions required for HDR/EDR #485

Closed
mbrla0 opened this issue Aug 25, 2023 · 2 comments
Closed

[icrate] Missing CoreGraphics and functions required for HDR/EDR #485

mbrla0 opened this issue Aug 25, 2023 · 2 comments
Labels
A-framework Affects the framework crates and the translator for them bug Something isn't working

Comments

@mbrla0
Copy link

mbrla0 commented Aug 25, 2023

Is there any reason why icrate is missing support for CoreGraphics? Additionally, I find it weird that this crate is also missing both the setColorSpace and setWantsExtendedDynamicRangeContent functions. These are needed to properly make use of one of the HDR modes (Extended Dynamic Range) supported by Metal, as explained in this example.

(Edit: The functions are for properties in both CAMetalLayer and MTKView, my bad :))

@mbrla0 mbrla0 changed the title [icrate] Missing CoreGraphics and MTKView functions required for HDR/EDR [icrate] Missing CoreGraphics and functions required for HDR/EDR Aug 25, 2023
@silvanshade
Copy link
Contributor

silvanshade commented Aug 25, 2023

Is there any reason why icrate is missing support for CoreGraphics?

I crate doesn't have bindings for several of the Core* frameworks at this point, not just CoreGraphics.

The main reason why is because the custom header-translator program that icrate uses to scan the frameworks and generate the Rust FFI declarations doesn't have great support for some of the lower-level more C-oriented functionality that the Core* frameworks require versus the more Objective-C oriented ones.

And although the header-translator generally works reasonably well, there are often times where certain methods have to be skipped during generation due to the header-translator not being able to correctly parse the corresponding code in the header, or support lacking for some part of the definition on the Rust side.

This is the case for setColorSpace. And setWantsExtendedDynamicRangeContent isn't available because CAMetalLayer isn't supported by icrate yet (for the above reasons).

It's often still possible to work around these missing functions by using msg_send_id! to call the selector directly, although this is obviously less safe, so more care needs to be taken to ensure the types are correct.

@madsmtm madsmtm added bug Something isn't working A-framework Affects the framework crates and the translator for them labels Sep 3, 2023
@madsmtm madsmtm added this to the Rewrite header translator milestone Sep 5, 2023
@madsmtm
Copy link
Owner

madsmtm commented May 17, 2024

CAMetalLayer is available since 05f6787, and in 888ba81 I added a bit of documentation for how to interoperate with core-graphics.

Adding CoreGraphics proper is tracked in #556, so going to close this.

@madsmtm madsmtm closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-framework Affects the framework crates and the translator for them bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants