Ejemplo n.º 1
0
        /// <summary>
        /// Transform a rectangle with all matrices with potential animation phases.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="phaseY"></param>
        public SKRect RectToPixelPhaseHorizontal(SKRect r, float phaseY)
        {
            // multiply the height of the rect with the phase
            r.Left  *= phaseY;
            r.Right *= phaseY;

            return(MatrixOffset.MapRect(ViewPortHandler.touchMatrix
                                        .MapRect(MatrixValueToPx.MapRect(r))));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Transform a rectangle with all matrices with potential animation phases.
        /// </summary>
        /// <param name="r"></param>
        /// <param name="phaseY"></param>
        public SKRect RectToPixelPhase(SKRect r, float phaseY)
        {
            // multiply the height of the rect with the phase
            r.Top    *= phaseY;
            r.Bottom *= phaseY;

            return(MatrixOffset.MapRect(ViewPortHandler.touchMatrix
                                        .MapRect(MatrixValueToPx.MapRect(r))));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Prepares the matrix that contains all offsets.
 /// </summary>
 public void PrepareMatrixOffset(bool inverted)
 {
     MatrixOffset.Reset();
     if (!inverted)
     {
         MatrixOffset.PostTranslate(ViewPortHandler.OffsetLeft,
                                    ViewPortHandler.ChartHeight - ViewPortHandler.OffsetBottom);
     }
     else
     {
         MatrixOffset.SetTranslate(ViewPortHandler.OffsetLeft, -ViewPortHandler.OffsetTop);
         MatrixOffset.PostScale(1f, -1f);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Transforms the given array of touch positions(pixels) (x, y, x, y, ...)
        /// into values on the chart.
        /// </summary>
        public void PixelsToValue(float[] pixels)
        {
            Matrix tmp = mPixelToValueMatrixBuffer;

            tmp.Reset();

            // invert all matrixes to convert back to the original value
            MatrixOffset.Invert(tmp);
            tmp.MapPoints(pixels);

            ViewPortHandler.touchMatrix.Invert(tmp);
            tmp.MapPoints(pixels);

            MatrixValueToPx.Invert(tmp);
            tmp.MapPoints(pixels);
        }
Ejemplo n.º 5
0
 public void PointValueToPixel(float[] points)
 {
     MatrixValueToPx.MapPoints(points);
     MatrixOffset.MapPoints(points);
     ViewPortHandler.touchMatrix.MapPoints(points);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Transform a rectangle with all matrices.
 /// </summary>
 /// <param name="r"></param>
 public void RectValueToPixel(RectF r)
 {
     MatrixValueToPx.MapRect(r);
     ViewPortHandler.touchMatrix.MapRect(r);
     MatrixOffset.MapRect(r);
 }
Ejemplo n.º 7
0
 public SKPoint PointValueToPixel(float x, float y)
 {
     return(MatrixOffset
            .MapPoint(ViewPortHandler.TouchMatrix.MapPoint(MatrixValueToPx.MapPoint(x, y))));
 }
Ejemplo n.º 8
0
 public SKPoint[] PointValuesToPixel(SKPoint[] pts)
 {
     pts = MatrixValueToPx.MapPoints(pts);
     pts = ViewPortHandler.TouchMatrix.MapPoints(pts);
     return(MatrixOffset.MapPoints(pts));
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Transform a rectangle with all matrices.
 /// </summary>
 /// <param name="r"></param>
 public SKRect RectValueToPixel(SKRect r)
 {
     r = MatrixValueToPx.MapRect(r);
     r = ViewPortHandler.touchMatrix.MapRect(r);
     return(MatrixOffset.MapRect(r));
 }