コード例 #1
0
        public static iText.Kernel.Colors.DeviceRgb MakeDarker(iText.Kernel.Colors.DeviceRgb rgbColor)
        {
            float r          = rgbColor.GetColorValue()[0];
            float g          = rgbColor.GetColorValue()[1];
            float b          = rgbColor.GetColorValue()[2];
            float v          = Math.Max(r, Math.Max(g, b));
            float multiplier = Math.Max(0f, (v - 0.33f) / v);

            r = multiplier * r;
            g = multiplier * g;
            b = multiplier * b;
            return(new iText.Kernel.Colors.DeviceRgb(r, g, b));
        }
コード例 #2
0
        public static iText.Kernel.Colors.DeviceRgb MakeLighter(iText.Kernel.Colors.DeviceRgb rgbColor)
        {
            float r = rgbColor.GetColorValue()[0];
            float g = rgbColor.GetColorValue()[1];
            float b = rgbColor.GetColorValue()[2];
            float v = Math.Max(r, Math.Max(g, b));

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

            r = multiplier * r;
            g = multiplier * g;
            b = multiplier * b;
            return(new iText.Kernel.Colors.DeviceRgb(r, g, b));
        }