Beispiel #1
0
        public static iText.Kernel.Colors.DeviceGray MakeDarker(iText.Kernel.Colors.DeviceGray grayColor)
        {
            float v          = grayColor.GetColorValue()[0];
            float multiplier = Math.Max(0f, (v - 0.33f) / v);

            return(new iText.Kernel.Colors.DeviceGray(v * multiplier));
        }
Beispiel #2
0
        public static iText.Kernel.Colors.DeviceGray MakeLighter(iText.Kernel.Colors.DeviceGray grayColor)
        {
            float v = grayColor.GetColorValue()[0];

            if (v == 0f)
            {
                return(new iText.Kernel.Colors.DeviceGray(0.3f));
            }
            float multiplier = Math.Min(1f, v + 0.33f) / v;

            return(new iText.Kernel.Colors.DeviceGray(v * multiplier));
        }