public override RectMini GetWindowBounds() { var returnValue = new RectMini(); var rect = Window.Current.Bounds; returnValue.Bottom = rect.Bottom; returnValue.Height = rect.Height; returnValue.Left = rect.Left; returnValue.Right = rect.Right; returnValue.Top = rect.Top; returnValue.Width = rect.Width; return returnValue; }
public override RectMini GetObjectBounds(object obj) { RectMini returnValue = null; var element = obj as FrameworkElement; if (element == null) return null; var buttonTransform = element.TransformToVisual(null); var point = buttonTransform.TransformPoint(new Point()); returnValue = new RectMini { Left = point.X, Top = point.Y, Width = element.ActualWidth, Height = element.ActualHeight, Right = point.X + element.ActualWidth, Bottom = point.Y + element.ActualHeight }; return returnValue; }
/// <summary> /// GetBitmapPart /// </summary> /// <param name="writeableBitmap">WriteableBitmap source</param> /// <param name="sourceRect">Rect</param> /// <returns>WriteableBitmap part</returns> public abstract object GetBitmapPart(object writeableBitmap, RectMini sourceRect);
/// <summary> /// Get Part Image /// </summary> /// <param name="writeableBitmap"></param> /// <param name="sourceRect"></param> /// <returns></returns> public override object GetBitmapPart(object writeableBitmap, RectMini sourceRect) { WriteableBitmap wbm = BitmapFactory.New((int) sourceRect.Width, (int) sourceRect.Height); if (!(writeableBitmap is WriteableBitmap)) return wbm; var rect = new Rect(sourceRect.Left, sourceRect.Top, sourceRect.Width, sourceRect.Height); wbm.Blit(new Rect(0.0, 0.0, sourceRect.Width, sourceRect.Height), (WriteableBitmap) writeableBitmap, rect, WriteableBitmapExtensions.BlendMode.None); return wbm; }