コード例 #1
0
        /// <summary>
        /// Sets the information used to provide color correction when previewing the result of a filter.
        /// </summary>
        /// <param name="colorProfiles">The color management information.</param>
        /// <exception cref="ArgumentNullException"><paramref name="colorProfiles"/> is null.</exception>
        public void SetColorProfiles(HostColorManagement colorProfiles)
        {
            if (colorProfiles == null)
            {
                throw new ArgumentNullException(nameof(colorProfiles));
            }

            hostColorProfiles = colorProfiles;
        }
コード例 #2
0
        public PSFilterHost(BitmapSource sourceImage, System.Windows.Media.Color primary, System.Windows.Media.Color secondary, Region selectedRegion, IntPtr parentWindowHandle)
#endif
        {
            if (sourceImage == null)
            {
                throw new ArgumentNullException(nameof(sourceImage));
            }

            int imageWidth  = 0;
            int imageHeight = 0;

#if GDIPLUS
            imageWidth  = sourceImage.Width;
            imageHeight = sourceImage.Height;
#else
            imageWidth  = sourceImage.PixelWidth;
            imageHeight = sourceImage.PixelHeight;
#endif

            if (imageWidth > 32000 || imageHeight > 32000)
            {
                string message = string.Empty;
                if (imageWidth > 32000 && imageHeight > 32000)
                {
                    message = Resources.ImageSizeTooLarge;
                }
                else
                {
                    if (imageWidth > 32000)
                    {
                        message = Resources.ImageWidthTooLarge;
                    }
                    else
                    {
                        message = Resources.ImageHeightTooLarge;
                    }
                }

                throw new ImageSizeTooLargeException(message);
            }

#if GDIPLUS
            source = (Bitmap)sourceImage.Clone();
#else
            source = sourceImage.Clone();
#endif
            disposed         = false;
            dest             = null;
            filterParameters = null;
            primaryColor     = primary;
            secondaryColor   = secondary;
            if (selectedRegion != null)
            {
                this.selectedRegion = selectedRegion.Clone();
            }
            else
            {
                this.selectedRegion = null;
            }
            owner             = parentWindowHandle;
            pseudoResources   = null;
            abortFunc         = null;
            hostInfo          = null;
            hostColorProfiles = null;
            sessionSettings   = null;
        }