I have a Xamarin.Forms / Android app that displays graphics in an OpenGLView.I'm trying to use the NuGet "ImageFromXamarinUI" to capture an instantaneous screenshot of the graphics at a point in time, and save it to a file.
My "capture" code currently looks like:
Stream imageStream = await myPage.myOpenGLView.CaptureImageAsync(); string myCaptureFilename = $"MLM - {ParamsEqSetName} - {System.DateTime.Now.ToString("yyyy_MM_d_HH_mm")}"; using (Stream stream = File.Open($"/storage/emulated/0/Pictures/{myCaptureFilename}", FileMode.Create)) { imageStream.CopyTo(stream); stream.Close(); stream.Dispose(); }
The file is being created successfully. But, when I try to open it as an image with the Photos app, I get a blank, black screen.
I expect to see the graphics that were being displayed at the moment that I executed the capture code. Instead, I get a blank, black screen.