Example #1
0
        ///////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Create ImageData for any missing channels.
        /// </summary>
        public void CreateMissingChannels()
        {
            var channelCount = PsdFile.ColorMode.MinChannelCount();

            for (Int16 id = 0; id < channelCount; id++)
            {
                if (!Channels.ContainsId(id))
                {
                    var size = Rect.Height * Rect.Width;

                    var ch = new Channel(id, this);
                    ch.ImageData = new Byte[size];
                    unsafe
                    {
                        fixed(Byte *ptr = &ch.ImageData[0])
                        {
                            Util.Fill(ptr, ptr + size, (Byte)255);
                        }
                    }

                    Channels.Add(ch);
                }
            }
        }