IfOutOfRange() public static method

public static IfOutOfRange ( string paramName, int index, int length ) : void
paramName string
index int
length int
return void
Esempio n. 1
0
        private int GetIndex(int x, int y)
        {
            Throw.IfOutOfRange(nameof(x), x, Order);
            Throw.IfOutOfRange(nameof(y), y, Order);

            return((y * Order) + x);
        }
Esempio n. 2
0
        private int GetIndex(int x, int y)
        {
            Throw.IfOutOfRange("x", x, Order);
            Throw.IfOutOfRange("y", y, Order);

            return((y * Order) + x);
        }
Esempio n. 3
0
        /// <summary>
        /// Set the column at the specified x position.
        /// </summary>
        /// <param name="x">The x position</param>
        /// <param name="values">The values</param>
        public void SetColumn(int x, params double[] values)
        {
            Throw.IfOutOfRange(nameof(x), x, Order);
            Throw.IfNull(nameof(values), values);
            Throw.IfTrue(nameof(values), values.Length != Order, "Invalid length");

            for (int y = 0; y < Order; y++)
            {
                SetValue(x, y, values[y]);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Set the row at the specified y position.
        /// </summary>
        /// <param name="y">The y position</param>
        /// <param name="values">The values</param>
        public void SetRow(int y, params double[] values)
        {
            Throw.IfOutOfRange(nameof(y), y, Order);
            Throw.IfNull(nameof(values), values);
            Throw.IfTrue(nameof(values), values.Length != Order, "Invalid length");

            for (int x = 0; x < Order; x++)
            {
                SetValue(x, y, values[x]);
            }
        }
Esempio n. 5
0
        ///<summary>
        /// Copies the images to an Array, starting at a particular Array index.
        ///</summary>
        ///<param name="array">The one-dimensional Array that is the destination.</param>
        ///<param name="arrayIndex">The zero-based index in 'destination' at which copying begins.</param>
        public void CopyTo(MagickImage[] array, int arrayIndex)
        {
            if (_Images.Count == 0)
            {
                return;
            }

            Throw.IfNull("array", array);
            Throw.IfOutOfRange("arrayIndex", arrayIndex, _Images.Count);
            Throw.IfOutOfRange("arrayIndex", arrayIndex, array.Length);

            int indexI = 0;
            int length = Math.Min(array.Length, _Images.Count);

            for (int indexA = arrayIndex; indexA < length; indexA++)
            {
                array[indexA] = _Images[indexI++].Clone();
            }
        }
Esempio n. 6
0
 private void CheckIndex(int x, int y)
 {
     Throw.IfOutOfRange(nameof(x), 0, Image.Width - 1, x, "Invalid X coordinate: {0}.", x);
     Throw.IfOutOfRange(nameof(y), 0, Image.Height - 1, y, "Invalid Y coordinate: {0}.", y);
 }
Esempio n. 7
0
 private void CheckArea(int x, int y, int width, int height)
 {
     CheckIndex(x, y);
     Throw.IfOutOfRange(nameof(width), 1, Image.Width - x, width, "Invalid width: {0}.", width);
     Throw.IfOutOfRange(nameof(height), 1, Image.Height - y, height, "Invalid height: {0}.", height);
 }
Esempio n. 8
0
        /// <summary>
        /// Hclp hu perceptual hash.
        /// </summary>
        /// <param name="index">The index to use.</param>
        /// <returns>The Hclp hu perceptual hash.</returns>
        public double HclpHuPhash(int index)
        {
            Throw.IfOutOfRange(nameof(index), index, 7);

            return(_hclpHuPhash[index]);
        }
Esempio n. 9
0
        /// <summary>
        /// Returns the Hu invariants.
        /// </summary>
        /// <param name="index">The index to use.</param>
        /// <returns>The Hu invariants.</returns>
        public double HuInvariants(int index)
        {
            Throw.IfOutOfRange(nameof(index), index, 8);

            return(_huInvariants[index]);
        }
Esempio n. 10
0
        ///<summary>
        /// The Hu invariants.
        ///</summary>
        public double HuInvariants(int index)
        {
            Throw.IfOutOfRange("index", index, 8);

            return(_HuInvariants[index]);
        }
        ///<summary>
        /// Hclp hu perceptual hash.
        ///</summary>
        public double HclpHuPhash(int index)
        {
            Throw.IfOutOfRange("index", index, 7);

            return(_HclpHuPhash[index]);
        }