Sub ConvertToBitmap (data() As Byte, mWidth As Int, mHeight As Int) As B4XBitmap
Dim WriteableImage As JavaObject
WriteableImage.InitializeNewInstance("javafx.scene.image.WritableImage", Array(mWidth, mHeight))
Dim writer As JavaObject = WriteableImage.RunMethod("getPixelWriter", Null)
Dim PixelFormat As JavaObject
PixelFormat.InitializeStatic("javafx.scene.image.PixelFormat")
writer.RunMethod("setPixels", Array(0, 0, mWidth, mHeight, PixelFormat.RunMethod("getByteRgbInstance", Null), _
data, 0, mWidth * 3))
Return WriteableImage
End Sub