Beispiel #1
0
        partial void SaveImage(SurfaceSaver surfaceSaver, RenderTarget2D target)
        {
            var filename = $"output-{DateTime.Now:yyyyMMdd-HHmmss}.png";
            var path     = filename;

            using (var stream = File.OpenWrite(path))
                surfaceSaver.SaveAsPng(rtarget, stream);

            confirmMsgText    = $"Image saved to {filename}";
            confirmMsgOpacity = 1;
        }
Beispiel #2
0
        partial void SaveImage(SurfaceSaver surfaceSaver, RenderTarget2D target)
        {
            var filename = $"output-{DateTime.Now:yyyyMMdd-HHmmss}.png";

            var dir = AndroidEnvironment.GetExternalStoragePublicDirectory(
                AndroidEnvironment.DirectoryPictures).AbsolutePath;
            var path = Path.Combine(dir, filename);

            using (var stream = File.OpenWrite(path))
                surfaceSaver.SaveAsPng(rtarget, stream);

            MediaScannerConnection.ScanFile(ApplicationContext, new String[] { path },
                                            new String[] { MimeTypeMap.Singleton.GetMimeTypeFromExtension("png") }, null);

            confirmMsgText    = $"Image saved to photo gallery";
            confirmMsgOpacity = 1;
        }
Beispiel #3
0
        partial void SaveImage(SurfaceSaver surfaceSaver, RenderTarget2D target)
        {
            using (var stream = new MemoryStream())
            {
                surfaceSaver.SaveAsPng(rtarget, stream);
                stream.Flush();
                stream.Seek(0, SeekOrigin.Begin);

                using (var imgData = Foundation.NSData.FromStream(stream))
                    using (var img = UIKit.UIImage.LoadFromData(imgData))
                    {
                        img.SaveToPhotosAlbum(null);
                    }

                confirmMsgText    = $"Image saved to photo gallery";
                confirmMsgOpacity = 1;
            }
        }