Open aiden-leong opened 2 weeks ago
BTW: Do you have Discord/Telegram channels for discussion?
Do you have more info on what you're trying to accomplish? e.g is this for a bare CALayer
you own or a CALayer
backing an NSView
?
Since the objc
property of CALayer
is exposed publicly, you can message it directly with objc
calls (e.g let _: () = msg_send![my_view.layer.id, surface];
). You of course need to handle the lifetimes and safety yourself, but this is one of those territories where it's the preferred way of doing it at the moment.
If you wind up finding a more comfortable API and/or you want to buff the CALayer
wrapper to be more comprehensive, a pull request is always welcome. I wouldn't pull IOSurface
into this framework necessarily, similar to how Metal
isn't really in here either (though other crates exist for it). In general I just try to make it possible for crates to interop via the objc
layer if possible.
I considered making a channel on Matrix at one point, but the level of activity here isn't so significant that it's needed.
Do you have more info on what you're trying to accomplish? e.g is this for a bare
CALayer
you own or aCALayer
backing anNSView
?
Yes. I'm trying to rewrite a demo from Apple. (You'll need to download the .zip file.) https://developer.apple.com/documentation/screencapturekit/capturing_screen_content_in_macos
contentLayer.contents = frame.surface
is the final step that put a CapturedFrame
on an NSView
so we can see it on the screen. (It's an OBS-like app.)
Since the objc property of CALayer is exposed publicly, you can message it directly with objc calls (e.g let _: () = msg_send![my_view.layer.id, surface];). You of course need to handle the lifetimes and safety yourself, but this is one of those territories where it's the preferred way of doing it at the moment.
Great. I didn't find the correct way to call msg_send
, now I do. I'll have a try if I can handle the lifetimes.
Cheers.
Apple Docs: https://developer.apple.com/documentation/quartzcore/calayer/1410773-contents
var contents: Any? { get set }
Further, one possible type it accepts is
IOSurface
which is NOT included in this repo.Ref: https://developer.apple.com/documentation/iosurface
Maybe we can create another binding repo for IOSurface.framework?