Example #1
0
 /// <summary>
 /// Releases all resources used by this <see cref="CompositeGraphic"/>.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     if (disposing && _cacheItem != null)
     {
         _cacheItem = null;
     }
 }
Example #2
0
        /// <summary>
        /// Fires the <see cref="Graphic.Drawing"/> event.  Should be called by an <see cref="IRenderer"/>
        /// for each object just before it is drawn/rendered, hence the reason it is public.
        /// </summary>
        public override void OnDrawing()
        {
            base.OnDrawing();

            if (_imageGraphic != null || !HasShutters)
            {
                return;
            }

            _cacheItem = GeometricShutterCache.GetCacheItem(GetAllShutters(), _imageRectangle, _fillColor);
            //IMPORTANT: don't just pass the value of Raw, otherwise, memory management won't work (hard reference).
            _imageGraphic = new ColorImageGraphic(_cacheItem.PixelData.Rows, _cacheItem.PixelData.Columns, () => _cacheItem.PixelData.Raw);
            base.Graphics.Add(_imageGraphic);
        }
Example #3
0
        private void Invalidate()
        {
            if (_imageGraphic != null)
            {
                base.Graphics.Remove(_imageGraphic);
                _imageGraphic.Dispose();
                _imageGraphic = null;

                //don't de-allocate and reallocate unnecessarily.
                if (!HasShutters)
                {
                    _cacheItem = null;
                }
            }
        }
		private void Invalidate()
		{
			if (_imageGraphic != null)
			{
				base.Graphics.Remove(_imageGraphic);
				_imageGraphic.Dispose();
				_imageGraphic = null;

				//don't de-allocate and reallocate unnecessarily.
				if (!HasShutters)
					_cacheItem = null;
			}
		}
		/// <summary>
		/// Releases all resources used by this <see cref="CompositeGraphic"/>.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			base.Dispose(disposing);
			if (disposing && _cacheItem != null)
				_cacheItem = null;
		}
		/// <summary>
		/// Fires the <see cref="Graphic.Drawing"/> event.  Should be called by an <see cref="IRenderer"/>
		/// for each object just before it is drawn/rendered, hence the reason it is public.
		/// </summary>
		public override void OnDrawing()
		{
			base.OnDrawing();

			if (_imageGraphic != null || !HasShutters)
				return;

			_cacheItem = GeometricShutterCache.GetCacheItem(GetAllShutters(), _imageRectangle, _fillColor);
			//IMPORTANT: don't just pass the value of Raw, otherwise, memory management won't work (hard reference).
			_imageGraphic = new ColorImageGraphic(_cacheItem.PixelData.Rows, _cacheItem.PixelData.Columns, () => _cacheItem.PixelData.Raw);
			base.Graphics.Add(_imageGraphic);
		}