码迷,mamicode.com
首页 > Windows程序 > 详细

Win10 for Phone 裁剪保存

时间:2015-06-02 01:40:58      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:

//StorageFolder savedPics = ApplicationData.Current.LocalFolder;
//BitmapImage bi = new BitmapImage();

//RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap();
//await renderTargetBitmap.RenderAsync(GridImage);

//IBuffer buffer = await renderTargetBitmap.GetPixelsAsync();
//StorageFile newfile = await savedPics.CreateFileAsync("snap.jpg", CreationCollisionOption.ReplaceExisting);
//using (var writeStream = await newfile.OpenAsync(FileAccessMode.ReadWrite))
//{
// BitmapEncoder jpgencode = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, writeStream);
// byte[] data = buffer.ToArray();

// Rect temp = MeasureUtil.GetBounds(GridImage, LayoutRoot);

// jpgencode.BitmapTransform.Bounds = new BitmapBounds
// {
// X = (uint)Math.Round((measureRect.X - temp.X), 0),
// Y = (uint)Math.Round((measureRect.Y - temp.Y), 0),
// Width = (uint)Math.Round(measureRect.Width, 0),
// Height = (uint)Math.Round(measureRect.Height, 0)
// };

// jpgencode.SetPixelData(
// BitmapPixelFormat.Bgra8,
// BitmapAlphaMode.Straight,
// (uint)renderTargetBitmap.PixelWidth,
// (uint)renderTargetBitmap.PixelHeight,
// 96d, 96d, data);


// bi.SetSource(writeStream);

// // 如果需要设置图片的固定宽、高,可以使用 WriteableBitmap 对象
// //WriteableBitmap wb = new WriteableBitmap(480, 480);
// //wb.SetSource(WriteStream);
// //imgResult.Source = wb;

// await jpgencode.FlushAsync();
//}

Win10 for Phone 裁剪保存

标签:

原文地址:http://www.cnblogs.com/luquanmingren/p/4545352.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!