Esempio n. 1
0
        /// <summary>
        /// Apply the supplied images to the areas of the base image defined by the
        /// channels in the currently loaded mask.
        /// </summary>
        /// <param name="ch1Image">The <see cref="T:System.IO.Stream"/> containing the DDS image to apply to the image when the first channel of the mask is active.</param>
        /// <param name="ch2Image">The <see cref="T:System.IO.Stream"/> containing the DDS image to apply to the image when the second channel of the mask is active.</param>
        /// <param name="ch3Image">The <see cref="T:System.IO.Stream"/> containing the DDS image to apply to the image when the third channel of the mask is active.</param>
        /// <param name="ch4Image">The <see cref="T:System.IO.Stream"/> containing the DDS image to apply to the image when the fourth channel of the mask is active.</param>
        public void ApplyImage(Stream ch1Image, Stream ch2Image, Stream ch3Image, Stream ch4Image)
        {
            if (!this.loaded || !this.MaskLoaded)
            {
                return;
            }

            DdsFile ch1dds = null, ch2dds = null, ch3dds = null, ch4dds = null;

            try
            {
                this.Enabled = false;
                Application.UseWaitCursor = true;
                Application.DoEvents();
                if (ch1Image != null)
                {
                    ch1dds = new DdsFile(); ch1dds.Load(ch1Image, false);
                }
                if (ch2Image != null)
                {
                    ch2dds = new DdsFile(); ch2dds.Load(ch2Image, false);
                }
                if (ch3Image != null)
                {
                    ch3dds = new DdsFile(); ch3dds.Load(ch3Image, false);
                }
                if (ch4Image != null)
                {
                    ch4dds = new DdsFile(); ch4dds.Load(ch4Image, false);
                }
                ddsFile.MaskedApplyImage(this.ddsMask, ch1dds, ch2dds, ch3dds, ch4dds);
            }
            finally { this.Enabled = true; Application.UseWaitCursor = false; Application.DoEvents(); }
            this.ckb_CheckedChanged(null, null);
        }