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
Add an API to get a nativeImage from a named NSImage #10727
Conversation
I think @codebytere was just looking for this feature! Solid idea. |
I'm not sure where to add this information, but in order to make cross-platform development easier, we could also mention Segoe MDL2 somewhere. @MarshallOfSound any ideas? Happy to make the PR. https://docs.microsoft.com/en-us/windows/uwp/style/segoe-ui-symbol-font |
This is incredibly useful! Currently doing this via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bit of a linter 💥 lol but otherwise this is rad!
CGImageRef ref = [image CGImageForProposedRect:nil context:nil hints:nil]; | ||
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:ref]; | ||
[rep setSize:[image size]]; | ||
NSData* pngData = [rep representationUsingType:NSPNGFileType properties:[[NSDictionary alloc] init]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: png_data
Yeah, would be even cooler if someone could figure out how to render an icon from that font into a nativeImage 🤔 I also just added the ability to HSL shift the named image so that the default black touch bar images can become white easily 👍 |
Very cool to see this make it to core. Thanks! |
This is useful for fetching macOS specific images for things like the touchbar.
Fixes #9414