/// <summary> /// Sets the abort function callback delegate. /// </summary> /// <param name="abortCallback">The abort callback.</param> /// <exception cref="ArgumentNullException"><paramref name="abortCallback"/> is null.</exception> public void SetAbortCallback(AbortFunc abortCallback) { if (abortCallback == null) { throw new ArgumentNullException(nameof(abortCallback)); } abortFunc = abortCallback; }
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; }