/// <summary> /// The imageComplete method is part of the ImageConsumer API which /// this class must implement to retrieve the pixels. /// <para> /// Note: This method is intended to be called by the ImageProducer /// of the Image whose pixels are being grabbed. Developers using /// this class to retrieve pixels from an image should avoid calling /// this method directly since that operation could result in problems /// with retrieving the requested pixels. /// </para> /// </summary> /// <param name="status"> the status of image loading </param> public virtual void ImageComplete(int status) { lock (this) { Grabbing = false; switch (status) { default: goto case ImageConsumer_Fields.IMAGEERROR; case ImageConsumer_Fields.IMAGEERROR: Flags |= ImageObserver_Fields.ERROR | ImageObserver_Fields.ABORT; break; case ImageConsumer_Fields.IMAGEABORTED: Flags |= ImageObserver_Fields.ABORT; break; case ImageConsumer_Fields.STATICIMAGEDONE: Flags |= ImageObserver_Fields.ALLBITS; break; case ImageConsumer_Fields.SINGLEFRAMEDONE: Flags |= ImageObserver_Fields.FRAMEBITS; break; } Producer.RemoveConsumer(this); Monitor.PulseAll(this); } }
/// <summary> /// Removes an ImageConsumer from the list of consumers interested in /// data for this image. /// /// <para> /// This method is public as a side effect /// of this class implementing /// the <code>ImageProducer</code> interface. /// It should not be called from user code, /// and its behavior if called from user code is unspecified. /// /// </para> /// </summary> /// <seealso cref= ImageConsumer </seealso> public virtual void RemoveConsumer(ImageConsumer ic) { lock (this) { if (Proxies != null) { ImageFilter imgf = (ImageFilter)Proxies[ic]; if (imgf != null) { Src.RemoveConsumer(imgf); Proxies.Remove(ic); if (Proxies.Count == 0) { Proxies = null; } } } } }