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

Expose available_image_bounds on MediaReference / ExternalReference as CGRect? #51

Open
vade opened this issue Feb 10, 2024 · 3 comments

Comments

@vade
Copy link
Contributor

vade commented Feb 10, 2024

Working on an AVFoundation interoperability implementation of OTIO and noticing that Media Reference does not expose its bounds in any way.

While not strictly necessary, its helpful to have access when trying to read an OTIO timeline and do useful stuff with it

@reinecke
Copy link
Member

How to expose these is a really interesting question. We’ve decided to align on Imath for spatial primitives, but we also want our bindings to “feel right” for their context.

Given that CGRect is only available in CoreGraphics (not the cross-platform Foundation), I’d be tempted to try and bind Box2d more directly and then include CGRect conversions in some optional Apple platform aware extensions. This has the downside though that the user needs to manually convert when getting and setting.

One other option is that we could make some custom spatial type protocols that match the underlying Imath types and use extensions to define protocol adherence for types like CGRect. This helps with pain in setting, but getting still requires an unwrap to get to the Apple types.

@reinecke
Copy link
Member

reinecke commented Feb 10, 2024

Oh, just realized, we should move this issue to the Swift-Bindings repo.

@vade
Copy link
Contributor Author

vade commented Feb 10, 2024

Hey @reinecke - Ah this tracks. Maybe theres a 'natural' exposing of the box2D binding, but as you said, an Apple Centric solution would expose a CGRect variant of the box2D binding so clients wouldn't need to worry too much?

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

No branches or pull requests

2 participants