Feature/available image bounds#60
Conversation
|
I guess the question really becomes, do we consider it a requirement to expose the Box data type and its functions as first class citizens in swift? If the answer is yes, theres work to be done to make the interface and expose it. If not, something like this might be sufficient. |
|
As a Swift/Apple platform OTIO user, I would probably prefer having CGRect-based APIs to work with. CGRect-related data structures might have already been available in Swift Foundation in Linux runtime. I would need to double-check that though. |
|
hey @jchen9 I concur - if they are available, lets def use them. I didn't see them in the Swift Standard Library but I may have missed something! |
|
Yeah, they are there. I tried Swift |
|
Oh thats unexpected. Thanks for the info @jchen9 - I'll def leverage CG* for the types. Thats great news. |
|
@jchen9 thanks for letting us know about CGRect being available in Foundation (cross-platform), are you aware the minimum Swift version that was made available in? I propose, if it's possible, we try to target a minimum We should also consider duplicating the package manifest code in a |
|
I can't find prebuilt Swift 5.9 Linux binary from Swift.org. From the history of https://github.com/swiftlang/swift-corelibs-foundation/blob/main/Sources/Foundation/NSGeometry.swift these structs might have been in the |
|
Hi there! If we chose to go w/ Swift 5.9 I presume that also means we are safe to assume Foundation on all Swift supported platforms should have CGRect - therefore its ok to refactor this PR and adopt CGRect to be exposed from the API? Give a thumbs up and I will try to find some time to work on it and close this out. Thanks ya'll |
|
Yes, that sounds good to me. See also this PR: #61 |
Signed-off-by: vade <vade@vade.info>
Signed-off-by: vade <vade@vade.info>
…mply use CGRect structs as appropriate. Signed-off-by: vade <vade@vade.info>
37b2cbb to
66e3d65
Compare
Signed-off-by: vade <vade@vade.info>
088fa7c to
090246c
Compare
|
@jminor apologies for the delay - i pushed the changes, including a small test - i added a clip reference test OTIO sourced from the main OTIO testing resources. |
…t explaining usage. Signed-off-by: vade <vade@vade.info>
Signed-off-by: vade <vade@vade.info>
Signed-off-by: vade <vade@vade.info>
|
Thanks for the prompt review @jminor I cleaned up based off of your suggestions. Much obliged! |
Link the Issue(s) this Pull Request is related to.
Fixes #51Summarize your change.
I wanted to open a discussion on the 'right' way of exposing in a cross platform swift native manner the image_bounds of a media reference. This is absolutely a draft and just meant to spark some discussion.
We need a standard way to bridge C++
std::optional<IMATH_NAMESPACE::Box2d>across Obj-C and into Swift.This PR proposes exposes CGRect (see discussion) which is available cross platform in Foundation.
We then add 3 new functions to
opentimelineio.h / .m:which we can expose to swift MediaReference class as a property which is a CGRect? from the standard library.
Thoughts?
Reference associated tests.
Added 1 test and 1 OTIO file borrowed from the main repo to facilitate testing