Exemplo n.º 1
0
        public override drawing::Brush GetPaint(
            Color color
            )
        {
            DeviceCMYKColor spaceColor = (DeviceCMYKColor)color;

            /*
             * NOTE: This convertion algorithm was from Apache FOP.
             */
            //FIXME: verify whether this algorithm is effective (limit checking seems quite ugly to me!).
            float keyCorrection = spaceColor.K / 2.5f;
            int   r             = (int)Math.Round((1 - spaceColor.C + keyCorrection) * 255); if (r > 255)

            {
                r = 255;
            }
            else if (r < 0)
            {
                r = 0;
            }
            int g = (int)Math.Round((1 - spaceColor.M + keyCorrection) * 255); if (g > 255)

            {
                g = 255;
            }
            else if (g < 0)
            {
                g = 0;
            }
            int b = (int)Math.Round((1 - spaceColor.Y + keyCorrection) * 255); if (b > 255)

            {
                b = 255;
            }
            else if (b < 0)
            {
                b = 0;
            }

            return(new drawing::SolidBrush(
                       drawing::Color.FromArgb(r, g, b)
                       ));
        }
Exemplo n.º 2
0
        /**
         * <summary>Gets the color corresponding to the specified components.</summary>
         * <param name="components">Color components to convert.</param>
         */
        public static DeviceColor Get(
            PdfArray components
            )
        {
            if (components == null)
            {
                return(null);
            }

            switch (components.Count)
            {
            case 1:
                return(DeviceGrayColor.Get(components));

            case 3:
                return(DeviceRGBColor.Get(components));

            case 4:
                return(DeviceCMYKColor.Get(components));

            default:
                return(null);
            }
        }
   public SetDeviceCMYKStrokeColor(
 DeviceCMYKColor value
 )
       : base(OperatorKeyword, value)
   {
   }