本文整理汇总了C#中System.Windows.Controls.Image.GetRender方法的典型用法代码示例。如果您正苦于以下问题:C# Image.GetRender方法的具体用法?C# Image.GetRender怎么用?C# Image.GetRender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Image
的用法示例。
在下文中一共展示了Image.GetRender方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyCinemagraphButton_Click
private void ApplyCinemagraphButton_Click(object sender, RoutedEventArgs e)
{
if (CinemagraphInkCanvas.Strokes.Count == 0)
{
ShowWarning(ResMessage("Editor.Cinemagraph.WarningNoDrawing"), MessageIcon.Info);
return;
}
ActionStack.Did(ListFrames);
var dpi = ListFrames[0].ImageLocation.DpiOf();
var scaledSize = ListFrames[0].ImageLocation.ScaledSize();
#region Get the Strokes and Clip the Image
var image = ListFrames[0].ImageLocation.SourceFrom();
var rectangle = new RectangleGeometry(new Rect(new System.Windows.Point(0, 0), new System.Windows.Size(image.PixelWidth, image.PixelHeight)));
Geometry geometry = Geometry.Empty;
foreach (Stroke stroke in CinemagraphInkCanvas.Strokes)
{
geometry = Geometry.Combine(geometry, stroke.GetGeometry(), GeometryCombineMode.Union, null);
}
geometry = Geometry.Combine(geometry, rectangle, GeometryCombineMode.Xor, null);
var clippedImage = new System.Windows.Controls.Image
{
Height = image.PixelHeight,
Width = image.PixelWidth,
Source = image,
Clip = geometry
};
clippedImage.Measure(scaledSize);
clippedImage.Arrange(new Rect(scaledSize));
var imageRender = clippedImage.GetRender(dpi, scaledSize);
#endregion
Cursor = Cursors.AppStarting;
_overlayFramesDel = Overlay;
_overlayFramesDel.BeginInvoke(imageRender, dpi, true, OverlayCallback, null);
ClosePanel();
}