Ejemplo n.º 1
0
        /// <summary>
        /// Returns
        /// <see cref="DeviceCmyk">DeviceCmyk</see>
        /// color which is darker than given one
        /// </summary>
        /// <param name="cmykColor">the DeviceCmyk color to be made darker</param>
        /// <returns>darker color</returns>
        public static iText.Kernel.Colors.DeviceCmyk MakeDarker(iText.Kernel.Colors.DeviceCmyk cmykColor)
        {
            DeviceRgb rgbEquivalent = ConvertCmykToRgb(cmykColor);
            DeviceRgb darkerRgb     = DeviceRgb.MakeDarker(rgbEquivalent);

            return(ConvertRgbToCmyk(darkerRgb));
        }
Ejemplo n.º 2
0
        public virtual void MakeDarkerTest()
        {
            DeviceRgb rgbColor       = new DeviceRgb(50, 100, 150);
            DeviceRgb darkerRgbColor = DeviceRgb.MakeDarker(rgbColor);
            // check the resultant darkness of RGB items with using this multiplier
            float multiplier = Math.Max(0f, (150f / 255 - 0.33f) / (150f / 255));

            NUnit.Framework.Assert.AreEqual(multiplier * (50f / 255), darkerRgbColor.GetColorValue()[0], 0.0001);
            NUnit.Framework.Assert.AreEqual(multiplier * (100f / 255), darkerRgbColor.GetColorValue()[1], 0.0001);
            NUnit.Framework.Assert.AreEqual(multiplier * (150f / 255), darkerRgbColor.GetColorValue()[2], 0.0001);
        }