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

Added RGBA support for Android. #64

Merged
merged 6 commits into from
May 10, 2024
Merged

Added RGBA support for Android. #64

merged 6 commits into from
May 10, 2024

Conversation

pweglik
Copy link
Contributor

@pweglik pweglik commented May 8, 2024

I'm not sure about C++ and Kotlin practices, but I added function that performs RGBA -> ARGB frame buffer conversion. This way, you can use resize plugin with Skia Frame processor from vision camera v4.

Copy link
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey!

Thank you so much for your PR, that's pretty dope.

I wanna have a few changes in that code though.

  1. Instead of passing the Image format to C++ with a custom created enum, we can just get the format of the JImage on the native side. Please use that approach instead, so in JImage we just add a int getFormat() method and compare it with the C++ Image Format types (HardwareBuffer maybe).
  2. Instead of creating two functions in C++, we just stick to one single function (called imageToFrameBuffer) and add a switch in there. To me that sounds more logical
  3. Any chance we can have iOS support in there?

@pweglik
Copy link
Contributor Author

pweglik commented May 9, 2024

  1. I added getFormat, but those int values come from: https://developer.android.com/reference/android/graphics/ImageFormat and https://developer.android.com/reference/android/graphics/PixelFormat#RGBA_8888
    I'm not really proficient in JNI and native code, so for now I left hardcoded in C++.
  2. Done
  3. I don't really know Swift/ObjC, so I can't help here. Also I think it works on iOS, as I've received no error when I set Camera props to 'rgb'.

Copy link
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

@mrousavy mrousavy merged commit 6d91c6e into mrousavy:main May 10, 2024
5 checks passed
@lin826
Copy link

lin826 commented May 28, 2024

Looking forward to the new release with this support for Android ❤️

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

Successfully merging this pull request may close these issues.

None yet

3 participants