Пример #1
0
		/// <summary>
		/// Initializes a new <see cref="ColorBarGraphic"/> with the specified physical dimensions and orientation.
		/// </summary>
		/// <param name="size">The desired physical size of the colour bar.</param>
		/// <param name="orientation">A value specifying the desired orientation of the colour bar.</param>
		public ColorBarGraphic(Size size, ColorBarOrientation orientation)
		{
			_size = size;
			_location = new PointF(0, 0);
			_orientation = orientation;
			_reversed = false;
			_gradientPixelData = null;
			_colorMapManagerProxy = new ColorMapManager(new ColorMapInstallerProxy());
		}
Пример #2
0
		/// <summary>
		/// Called to unload the colour bar graphic and any associated resources.
		/// </summary>
		protected virtual void UnloadColorBar()
		{
			if (_colorBar != null)
			{
				base.Graphics.Remove(_colorBar);
				_colorBar.Dispose();
				_colorBar = null;
			}

			if (_gradientPixelData != null)
			{
				_gradientPixelData.Dispose();
				_gradientPixelData = null;
			}
		}
Пример #3
0
		/// <summary>
		/// Called to create a vertical black and white gradient graphic with black at the top and white at the bottom.
		/// </summary>
		/// <remarks>
		/// This method is called to create a normalized gradient. User options such as <see cref="Reversed"/> and <see cref="Orientation"/> are applied automatically.
		/// </remarks>
		/// <returns>A new normalized gradient graphic.</returns>
		protected virtual GrayscaleImageGraphic CreateVerticalGradient()
		{
			if (_gradientPixelData != null)
				_gradientPixelData.Dispose();
			_gradientPixelData = GradientPixelData.GetGradient(this.Length, this.Width);
			return new GrayscaleImageGraphic(_gradientPixelData.Length, _gradientPixelData.Width, 8, 8, 7, false, false, 1, 0, () => _gradientPixelData.Data);
		}
Пример #4
0
		/// <summary>
		/// Releases all resources used by this <see cref="ColorBarGraphic"/>.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				_colorBar = null;

				if (_gradientPixelData != null)
				{
					_gradientPixelData.Dispose();
					_gradientPixelData = null;
				}
			}

			base.Dispose(disposing);
		}
Пример #5
0
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		/// <param name="source">The source object from which to clone.</param>
		/// <param name="context">The cloning context object.</param>
		protected ColorBarGraphic(ColorBarGraphic source, ICloningContext context)
		{
			context.CloneFields(source, this);

			_colorMapManagerProxy = new ColorMapManager(new ColorMapInstallerProxy());
			if (source._colorMapManagerProxy.ColorMap != null)
				_colorMapManagerProxy.SetMemento(source._colorMapManagerProxy.CreateMemento());

			if (source._gradientPixelData != null)
				_gradientPixelData = source._gradientPixelData.Clone();
		}