Пример #1
0
        private int[] CreateLookupX(int srcWidth, int dstWidth, ScaleFactor scaleFactor)
        {
            var lookup = new int[dstWidth + 1];

            for (var x = 0; x < lookup.Length; ++x)
            {
                var pt       = new Point(x, 0);
                var clientPt = scaleFactor.ScalePoint(pt);

                // Sometimes the scale factor is slightly different on one axis than
                // on another, simply due to accuracy. So we have to clamp this value to
                // be within bounds.
                lookup[x] = Utility.Clamp(clientPt.X, 0, srcWidth - 1);
            }

            return(lookup);
        }
Пример #2
0
        private int[] CreateLookupY(int srcHeight, int dstHeight, ScaleFactor scaleFactor)
        {
            var lookup = new int[dstHeight + 1];

            for (var y = 0; y < lookup.Length; ++y)
            {
                var pt       = new Point(0, y);
                var clientPt = scaleFactor.ScalePoint(pt);

                // Sometimes the scale factor is slightly different on one axis than
                // on another, simply due to accuracy. So we have to clamp this value to
                // be within bounds.
                lookup[y] = Utility.Clamp(clientPt.Y, 0, srcHeight - 1);
            }

            return(lookup);
        }
Пример #3
0
 public Point SurfaceToClient(Point surfacePt)
 {
     return(ScaleFactor.ScalePoint(surfacePt));
 }