Windows phone 8 是否在诺基亚图像处理SDK 1.2中裁剪图像?
您能给我一个使用诺基亚图像处理SDK 1.2裁剪图像的示例代码吗?正如您所知,我用于裁剪图像的“编辑会话”类已在SDK 1.2中出现。Windows phone 8 是否在诺基亚图像处理SDK 1.2中裁剪图像?,windows-phone-8,sdk,crop,nokia,imaging,Windows Phone 8,Sdk,Crop,Nokia,Imaging,您能给我一个使用诺基亚图像处理SDK 1.2裁剪图像的示例代码吗?正如您所知,我用于裁剪图像的“编辑会话”类已在SDK 1.2中出现。 感谢您的关注。这是诺基亚api参考文档的摘录,可在此处找到: 此示例获取CameraCaptureTask结果照片并对其应用[裁剪]过滤器 async void CaptureTask_Completed(object sender, PhotoResult e) { // Create a source to read the image from
感谢您的关注。这是诺基亚api参考文档的摘录,可在此处找到: 此示例获取CameraCaptureTask结果照片并对其应用[裁剪]过滤器
async void CaptureTask_Completed(object sender, PhotoResult e)
{
// Create a source to read the image from PhotoResult stream
using (var source = new StreamImageSource(e.ChosenPhoto))
{
// Create effect collection with the source stream
using (var filters = new FilterEffect(source))
{
// Initialize the filter
var sampleFilter = new CropFilter(new Windows.Foundation.Rect(0, 0, 500, 500));
// Add the filter to the FilterEffect collection
filters.Filters = new IFilter[] { sampleFilter };
// Create a target where the filtered image will be rendered to
var target = new WriteableBitmap((int)ImageControl.ActualWidth, (int)ImageControl.ActualHeight);
// Create a new renderer which outputs WriteableBitmaps
using (var renderer = new WriteableBitmapRenderer(filters, target))
{
// Render the image with the filter(s)
await renderer.RenderAsync();
// Set the output image to Image control as a source
ImageControl.Source = target;
}
}
}
}