LitDev.Engines.FIP.CMYKLayers C# (CSharp) Method

CMYKLayers() public method

Creates CMYK layesr from RGB image
public CMYKLayers ( Bitmap OriginalImage ) : System.Drawing.Bitmap[]
OriginalImage System.Drawing.Bitmap Original ARGB image
return System.Drawing.Bitmap[]
        public Bitmap[] CMYKLayers(Bitmap OriginalImage)
        {
            Bitmap OutputImageC = new System.Drawing.Bitmap(OriginalImage.Width, OriginalImage.Height);
            Bitmap OutputImageM = new System.Drawing.Bitmap(OriginalImage.Width, OriginalImage.Height);
            Bitmap OutputImageY = new System.Drawing.Bitmap(OriginalImage.Width, OriginalImage.Height);
            Bitmap OutputImageK = new System.Drawing.Bitmap(OriginalImage.Width, OriginalImage.Height);

            for (int x = 0; x < OriginalImage.Width; x++)
            {
                for (int y = 0; y < OriginalImage.Height; y++)
                {
                    Color pixel = OriginalImage.GetPixel(x, y);

                    Double[] cmyk = rgb2cmyk(pixel);

                    Double C = cmyk[0];
                    Double M = cmyk[1];
                    Double Y = cmyk[2];
                    Double K = cmyk[3];

                    Color newColorC = cmyk2rgb(new Double[4] { C, 0, 0, 0 });
                    Color newColorM = cmyk2rgb(new Double[4] { 0, M, 0, 0 });
                    Color newColorY = cmyk2rgb(new Double[4] { 0, 0, Y, 0 });
                    Color newColorK = cmyk2rgb(new Double[4] { 0, 0, 0, K });

                    OutputImageC.SetPixel(x, y, newColorC);
                    OutputImageM.SetPixel(x, y, newColorM);
                    OutputImageY.SetPixel(x, y, newColorY);
                    OutputImageK.SetPixel(x, y, newColorK);
                }
            }

            Bitmap[] OutputImage = new Bitmap[4] { OutputImageC, OutputImageM, OutputImageY, OutputImageK };

            return OutputImage;
        }