示例#1
0
        void UpdatePosition()
        {
            var imageSize  = new Size(InnerImage.ActualWidth, InnerImage.ActualHeight);
            var targetSize = new Size(this.ActualWidth, this.ActualHeight);
            var proxySize  = new Size(ProxyImage.ActualWidth, ProxyImage.ActualHeight);
            var cropRect   = CropBitmap.GetGreedyCropRect(imageSize, targetSize, ScaleFaces(Rects, imageSize, proxySize));


            if (cropRect.Width == 0 || cropRect.Height == 0 || proxySize.Width == 0 || targetSize.Width == 0)
            {
                return;
            }

            try
            {
                var w = Resizer.HorizontalOffset;
                var h = Resizer.VerticalOffset;


                var s = Resizer.ChangeView(cropRect.Left * targetSize.Width / cropRect.Width,
                                           cropRect.Top * targetSize.Width / cropRect.Width,
                                           Convert.ToSingle(targetSize.Width / cropRect.Width),
                                           false
                                           );
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
 private void ProxyImage_Loaded(object sender, RoutedEventArgs e)
 {
     if (InnerImage.RenderSize.Height == 0 || InnerImage.RenderSize.Width == 0)
     {
         var s = Resizer.ChangeView(0, 0, 0.1f, true);
     }
     UpdatePosition();
 }