コード例 #1
0
            /**
             * Interpolate between where the image should start and end in order to translate
             * the image so that the point that is touched is what ends up centered at the end
             * of the zoom.
             * @param t
             */
            private void TranslateImageToCenterTouchPosition(float t)
            {
                float  targetX = startTouch.X + t * (endTouch.X - startTouch.X);
                float  targetY = startTouch.Y + t * (endTouch.Y - startTouch.Y);
                PointF curr    = view.TransformCoordBitmapToTouch(bitmapX, bitmapY);

                view.matrix.PostTranslate(targetX - curr.X, targetY - curr.Y);
            }
コード例 #2
0
            public DoubleTapZoom(TouchImageView view, float targetZoom, float focusX, float focusY, bool stretchImageToSuper)
            {
                this.view = view;
                view.SetState(TouchState.ANIMATE_ZOOM);
                startTime                = DateTime.Now.Ticks;
                this.startZoom           = view.normalizedScale;
                this.targetZoom          = targetZoom;
                this.stretchImageToSuper = stretchImageToSuper;
                PointF bitmapPoint = view.TransformCoordTouchToBitmap(focusX, focusY, false);

                this.bitmapX = bitmapPoint.X;
                this.bitmapY = bitmapPoint.Y;

                //
                // Used for translating image during scaling
                //
                startTouch = view.TransformCoordBitmapToTouch(bitmapX, bitmapY);
                endTouch   = new PointF(view.viewWidth / 2, view.viewHeight / 2);
            }