Exemple #1
0
        /// <summary>
        /// Rounds the current scaling factor up to the next power of two.
        /// </summary>
        /// <returns>The new ScaleFactor value.</returns>
        public ScaleFactor GetNextLarger()
        {
            double ratio = Ratio + 0.005;

            int index = Array.FindIndex(
                scales,
                delegate(double scale) {
                return(ratio <= scale);
            });

            if (index == -1)
            {
                index = scales.Length;
            }

            index = Math.Min(index, scales.Length - 1);

            return(ScaleFactor.FromDouble(scales[index]));
        }
Exemple #2
0
        public ScaleFactor GetNextSmaller()
        {
            double ratio = Ratio - 0.005;

            int index = Array.FindIndex(
                scales,
                delegate(double scale) {
                return(ratio <= scale);
            });

            --index;

            if (index == -1)
            {
                index = 0;
            }

            index = Math.Max(index, 0);

            return(ScaleFactor.FromDouble(scales[index]));
        }