Ejemplo n.º 1
0
partial         void SaveImage(SurfaceSaver surfaceSaver, RenderTarget2D target)
        {
            var saver = SurfaceSaver.Create();
            var filename = $"output-{DateTime.Now:yyyyMMdd-HHmmss}.png";
            var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), filename);

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

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

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

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

            var dir = AndroidEnvironment.GetExternalStoragePublicDirectory(
                AndroidEnvironment.DirectoryPictures).AbsolutePath;
            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;
        }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
0
 partial void SaveImage(SurfaceSaver surfaceSaver, RenderTarget2D target);