国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項超值服

開通VIP
Windows8裁切圖片的一部分

Windows8裁切圖片的一部分

(2013-01-24 14:51:35)
標(biāo)簽:

雜談

using System;
using System.IO;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Graphics.Imaging;
using Windows.Storage;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Navigation;

       private async void GetContent()
       {
           uintstartX = 100;
           uintstartY = 100;
           uintheight = 300;
           uint width= 300;

          StorageFile image1 = awaitStorageFile.GetFileFromApplicationUriAsync(newUri("ms-appx:///image/test1.jpg"));
           using(IRandomAccessStream stream1 = awaitimage1.OpenAsync(FileAccessMode.Read))
           {
              BitmapDecoder decoder = awaitBitmapDecoder.CreateAsync(stream1);

              byte[] pixels = awaitGetPixelData(decoder, startX, startY, width, height,decoder.PixelWidth, decoder.PixelHeight);

              WriteableBitmapwriteableBitmap = new WriteableBitmap((int)width,(int)height);
              Stream pixStream =writeableBitmap.PixelBuffer.AsStream();
              pixStream.Write(pixels, 0,(int)(width * height * 4));

              this.msiImage.Source =writeableBitmap;
           }
       }

       private async Task GetPixelData(BitmapDecoderdecoder, uint startPointX, uint startPointY, uint width, uintheight, uint scaledWidth, uint scaledHeight)
       {
          BitmapBounds bounds = new BitmapBounds();
           bounds.X =startPointX;
           bounds.Y =startPointY;
          bounds.Height = height;
          bounds.Width = width;
          BitmapTransform transform = new BitmapTransform();
          transform.Bounds = bounds;
          transform.ScaledWidth = scaledWidth;
          transform.ScaledHeight = scaledHeight;

           // Get thecropped pixels within the bounds of transform.
          PixelDataProvider pix = awaitdecoder.GetPixelDataAsync(BitmapPixelFormat.Bgra8,BitmapAlphaMode.Straight,
              transform,
             ExifOrientationMode.IgnoreExifOrientation,ColorManagementMode.ColorManageToSRgb);
           byte[]pixels = pix.DetachPixelData();
           returnpixels;
       }
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
Win 8中WPF listview與listBox的Drag、Drop操作
DispatcherTimer與Dispatcher小小應(yīng)用
WPF自定義控件庫之窗口
NGUI所見即所得之UIGrid & UITable
iPhone圖片UIImage對象操作的一些方法
WinUI 3 Preview 3 發(fā)布了,再一次試試它的性能
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服