protected virtual void ApplyCroppedBounds(CroppingAdorner ca) { if (ca == null) return; if (this.imageToCrop.Source != null) { ca.ClippingRectangle = ImageToCropper(this.CroppedImageBounds); ca.InvalidateVisual(); } }
private void AddCropToElement(FrameworkElement fel) { if (_felCur != null) { RemoveCropFromCur(); } Rect rcInterior = new Rect( (double)Rect.GetValue(Canvas.LeftProperty), (double)Rect.GetValue(Canvas.TopProperty), Rect.Width, Rect.Height); AdornerLayer aly = AdornerLayer.GetAdornerLayer(fel); _clp = new CroppingAdorner(fel, rcInterior); aly.Add(_clp); imgCrop.Source = _clp.BpsCrop(); _clp.CropChanged += CropChanged; _felCur = fel; if (rbRed.IsChecked != true) { SetClipColorGrey(); } }
private void AddCropToElement(FrameworkElement fel) { if (_felCur != null) { RemoveCropFromCur(); } Rect rcInterior = new Rect( fel.ActualWidth * 0.2, fel.ActualHeight * 0.2, fel.ActualWidth * 0.6, fel.ActualHeight * 0.6); AdornerLayer aly = AdornerLayer.GetAdornerLayer(fel); croppingAdorner = new CroppingAdorner(fel, rcInterior); aly.Add(croppingAdorner); croppingAdorner.CropChanged += CropChanged; _felCur = fel; SetClipColorGrey(); }
protected virtual void ReportCroppedBounds(CroppingAdorner ca) { if (ca == null) return; if (this.imageToCrop.Source != null) { this.CroppedImageBounds = CropperToImage(ca.ClippingRectangle); } }