// // Set zoom to the specified scale. Image will be centered around the point // (focusX, focusY). These floats range from 0 to 1 and denote the focus point // as a fraction from the left and top of the view. For example, the top left // corner of the image would be (0, 0). And the bottom right corner would be (1, 1). // @param scale // @param focusX // @param focusY // @param scaleType // public void SetZoom(float scale, float focusX, float focusY, ScaleType scaleType) { // // setZoom can be called before the image is on the screen, but at this point, // image and view sizes have not yet been calculated in onMeasure. Thus, we should // delay calling setZoom until the view has been measured. // if (!_onDrawReady) { _delayedZoomVariables = new ZoomVariables(scale, focusX, focusY, scaleType); return; } SetScaleType(scaleType); ResetZoom(); ScaleImage(scale, ViewWidth / 2f, ViewHeight / 2f, false); _matrix.GetValues(_m); _m[Matrix.MtransX] = -((focusX * GetImageWidth()) - (ViewWidth * 0.5f)); _m[Matrix.MtransY] = -((focusY * GetImageHeight()) - (ViewHeight * 0.5f)); _matrix.SetValues(_m); FixTrans(); ImageMatrix = _matrix; }