I have the below code where i am creating a ImageReader instance in xamarin android, how to change Image Format from ImageFormatType.Rgb565
to PixelFormat.RGBA_8888
i am unable to find the Library or a Enum class for it.
mImageReader = ImageReader.NewInstance(windowWidth, windowHeight, ImageFormatType.Rgb565, 2)
You need to pass an int value of
3
(Android.Graphics.Format.Rgb888
) toImageReader.NewInstance
, but currently you can not.That is a bug/issue in Xamarin.Android auto-generation API process as they do not create a overload that accepts an
Android.Graphics.Format
enum, or just a plainint
as the Java API does.You can do this the same way you would do it in Java via Xamarin.Android's binding to Android.Runtime.JNIEnv or Java.Lang.Reflect
Example using JNI:
Note: Using JNI requires that the assembly be allowed to use "unsafe" code ( on the plus side, JNI is faster execution than using reflection...)
Usage:
or