Exemplo n.º 1
0
        // Grows the cropping rectange by (dx, dy) in image space.
        private void moveBy(float dx, float dy)
        {
            Rect invalRect = new Rect(DrawRect);

            cropRect.Offset(dx, dy);

            // Put the cropping rectangle inside image rectangle.
            cropRect.Offset(
                Math.Max(0, imageRect.Left - cropRect.Left),
                Math.Max(0, imageRect.Top - cropRect.Top));

            cropRect.Offset(
                Math.Min(0, imageRect.Right - cropRect.Right),
                Math.Min(0, imageRect.Bottom - cropRect.Bottom));

            DrawRect = computeLayout();
            invalRect.Union(DrawRect);
            invalRect.Inset(-10, -10);
            context.Invalidate(invalRect);
        }