Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Color1"></param>
        /// <param name="Color2"></param>
        /// <returns></returns>
        public static int DistanceRGB(ARGB_Rev Color1, ARGB_Rev Color2)
        {
            var R = Math.Abs(Color1.R - Color2.R);
            var G = Math.Abs(Color1.G - Color2.G);
            var B = Math.Abs(Color1.B - Color2.B);

            return((R * R) + (G * G) + (B * B));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Color1"></param>
        /// <param name="Color2"></param>
        /// <param name="Offset"></param>
        /// <returns></returns>
        public static ARGB_Rev Mix(ARGB_Rev Color1, ARGB_Rev Color2, float Offset = 0.5f)
        {
            var Offset1A = MathUtils.FastClamp(Offset, 0, 1);
            var Offset2A = 1 - Offset1A;

            var Offset1C = Offset1A * (Color1.Af);
            var Offset2C = Offset2A * (Color2.Af);

            MathUtils.NormalizeSum(ref Offset1C, ref Offset2C);

            return(new ARGB_Rev(
                       (int)(Color1.A + Color2.A),
                       (int)(Color1.R * Offset1C + Color2.R * Offset2C),
                       (int)(Color1.G * Offset1C + Color2.G * Offset2C),
                       (int)(Color1.B * Offset1C + Color2.B * Offset2C)
                       ));
        }
Esempio n. 3
0
		public static int DistanceRGB(ARGB_Rev Color1, ARGB_Rev Color2)
		{
			var R = Math.Abs(Color1.R - Color2.R);
			var G = Math.Abs(Color1.G - Color2.G);
			var B = Math.Abs(Color1.B - Color2.B);
			return (R * R) + (G * G) + (B * B);
		}
Esempio n. 4
0
		/// <summary>
		/// 
		/// </summary>
		/// <param name="Color1"></param>
		/// <param name="Color2"></param>
		/// <param name="Offset"></param>
		/// <returns></returns>
		public static ARGB_Rev Mix(ARGB_Rev Color1, ARGB_Rev Color2, float Offset = 0.5f)
		{
			var Offset1A = MathUtils.FastClamp(Offset, 0, 1);
			var Offset2A = 1 - Offset1A;

			var Offset1C = Offset1A * (Color1.Af);
			var Offset2C = Offset2A * (Color2.Af);

			MathUtils.NormalizeSum(ref Offset1C, ref Offset2C);

			return new ARGB_Rev(
				(int)(Color1.A + Color2.A),
				(int)(Color1.R * Offset1C + Color2.R * Offset2C),
				(int)(Color1.G * Offset1C + Color2.G * Offset2C),
				(int)(Color1.B * Offset1C + Color2.B * Offset2C)
			);
		}