/// <summary>
		/// Constructs a new rectangular region of interest, specifying an <see cref="IBoundableGraphic"/> as the source of the definition and pixel data.
		/// </summary>
		/// <param name="rectangle">The rectangular graphic that represents the region of interest.</param>
		public RectangularRoi(IBoundableGraphic rectangle) : base(rectangle.ParentPresentationImage)
		{
			rectangle.CoordinateSystem = CoordinateSystem.Source;
			try
			{
				// note that this is the rectangle complete with orientation information
				_rectangle = rectangle.Rectangle;
			}
			finally
			{
				rectangle.ResetCoordinateSystem();
			}
		}
 /// <summary>
 /// Constructs a new rectangular region of interest, specifying an <see cref="IBoundableGraphic"/> as the source of the definition and pixel data.
 /// </summary>
 /// <param name="rectangle">The rectangular graphic that represents the region of interest.</param>
 public RectangularRoi(IBoundableGraphic rectangle) : base(rectangle.ParentPresentationImage)
 {
     rectangle.CoordinateSystem = CoordinateSystem.Source;
     try
     {
         // note that this is the rectangle complete with orientation information
         _rectangle = rectangle.Rectangle;
     }
     finally
     {
         rectangle.ResetCoordinateSystem();
     }
 }
        /// <summary>
        /// Constructs a new elliptical region of interest, specifying an <see cref="IBoundableGraphic"/> as the source of the definition and pixel data.
        /// </summary>
        /// <param name="ellipse">The elliptical graphic that represents the region of interest.</param>
        public EllipticalRoi(IBoundableGraphic ellipse)
            : base(ellipse.ParentPresentationImage)
        {
            ellipse.CoordinateSystem = CoordinateSystem.Source;
            try
            {
                _bounds = ellipse.Rectangle;

                a  = _bounds.Width / 2;
                b  = _bounds.Height / 2;
                a2 = a * a;
                b2 = b * b;
                h  = _bounds.Left + a;
                k  = _bounds.Top + b;
            }
            finally
            {
                ellipse.ResetCoordinateSystem();
            }
        }
		/// <summary>
		/// Constructs a new elliptical region of interest, specifying an <see cref="IBoundableGraphic"/> as the source of the definition and pixel data.
		/// </summary>
		/// <param name="ellipse">The elliptical graphic that represents the region of interest.</param>
		public EllipticalRoi(IBoundableGraphic ellipse)
			: base(ellipse.ParentPresentationImage)
		{
			ellipse.CoordinateSystem = CoordinateSystem.Source;
			try
			{
				_bounds = ellipse.Rectangle;

				a = _bounds.Width/2;
				b = _bounds.Height/2;
				a2 = a*a;
				b2 = b*b;
				h = _bounds.Left + a;
				k = _bounds.Top + b;
			}
			finally
			{
				ellipse.ResetCoordinateSystem();
			}
		}
Exemple #5
0
        /// <summary>
        /// Draws an ellipse primitive to the specified destination buffer.
        /// </summary>
        /// <param name="buffer">The destination buffer.</param>
        /// <param name="pen">A GDI pen to use for drawing.</param>
        /// <param name="ellipse">The ellipse primitive to be drawn.</param>
        /// <param name="dpi">The intended output DPI.</param>
        public static void DrawEllipsePrimitive(IGdiBuffer buffer, Pen pen, IBoundableGraphic ellipse, float dpi = _nominalScreenDpi)
        {
            buffer.Graphics.Transform     = ellipse.SpatialTransform.CumulativeTransform;
            ellipse.CoordinateSystem      = CoordinateSystem.Source;
            buffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            try
            {
                var rectangle = new RectangleF(ellipse.TopLeft.X, ellipse.TopLeft.Y, ellipse.Width, ellipse.Height);
                rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle);
                var dropShadowOffset = GetDropShadowOffset(ellipse, dpi);

                // Draw drop shadow
                pen.Color = Color.Black;
                pen.Width = CalculateScaledPenWidth(ellipse, 1, dpi);

                SetDashStyle(pen, ellipse);

                buffer.Graphics.DrawEllipse(
                    pen,
                    rectangle.Left + dropShadowOffset.Width,
                    rectangle.Top + dropShadowOffset.Height,
                    rectangle.Width,
                    rectangle.Height);

                // Draw rectangle
                pen.Color = ellipse.Color;

                buffer.Graphics.DrawEllipse(
                    pen,
                    rectangle.Left,
                    rectangle.Top,
                    rectangle.Width,
                    rectangle.Height);
            }
            finally
            {
                buffer.Graphics.SmoothingMode = SmoothingMode.None;
                ellipse.ResetCoordinateSystem();
                buffer.Graphics.ResetTransform();
            }
        }
Exemple #6
0
        private void InternalDrawEllipsePrimitive(IBoundableGraphic ellipse)
        {
            Surface.FinalBuffer.Graphics.Transform = ellipse.SpatialTransform.CumulativeTransform;
            ellipse.CoordinateSystem = CoordinateSystem.Source;

            Surface.FinalBuffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            RectangleF rectangle = new RectangleF(ellipse.TopLeft.X, ellipse.TopLeft.Y, ellipse.Width, ellipse.Height);

            rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle);
            SizeF dropShadowOffset = GetDropShadowOffset(ellipse, Dpi);

            // Draw drop shadow
            _pen.Color = Color.Black;
            _pen.Width = CalculateScaledPenWidth(ellipse, 1, Dpi);

            SetDashStyle(ellipse);

            Surface.FinalBuffer.Graphics.DrawEllipse(
                _pen,
                rectangle.Left + dropShadowOffset.Width,
                rectangle.Top + dropShadowOffset.Height,
                rectangle.Width,
                rectangle.Height);

            // Draw rectangle
            _pen.Color = ellipse.Color;

            Surface.FinalBuffer.Graphics.DrawEllipse(
                _pen,
                rectangle.Left,
                rectangle.Top,
                rectangle.Width,
                rectangle.Height);

            ellipse.ResetCoordinateSystem();
            Surface.FinalBuffer.Graphics.ResetTransform();
        }
Exemple #7
0
		private void InternalDrawEllipsePrimitive(IBoundableGraphic ellipse)
		{
			Surface.FinalBuffer.Graphics.Transform = ellipse.SpatialTransform.CumulativeTransform;
			ellipse.CoordinateSystem = CoordinateSystem.Source;

			Surface.FinalBuffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

			RectangleF rectangle = new RectangleF(ellipse.TopLeft.X, ellipse.TopLeft.Y, ellipse.Width, ellipse.Height);
			rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle);
			SizeF dropShadowOffset = GetDropShadowOffset(ellipse, Dpi);

			// Draw drop shadow
			_pen.Color = Color.Black;
			_pen.Width = CalculateScaledPenWidth(ellipse, 1, Dpi);

			SetDashStyle(ellipse);

			Surface.FinalBuffer.Graphics.DrawEllipse(
				_pen,
				rectangle.Left + dropShadowOffset.Width,
				rectangle.Top + dropShadowOffset.Height,
				rectangle.Width,
				rectangle.Height);

			// Draw rectangle
			_pen.Color = ellipse.Color;

			Surface.FinalBuffer.Graphics.DrawEllipse(
				_pen,
				rectangle.Left,
				rectangle.Top,
				rectangle.Width,
				rectangle.Height);

			ellipse.ResetCoordinateSystem();
			Surface.FinalBuffer.Graphics.ResetTransform();
		}
Exemple #8
0
		/// <summary>
		/// Draws an ellipse primitive to the specified destination buffer.
		/// </summary>
		/// <param name="buffer">The destination buffer.</param>
		/// <param name="pen">A GDI pen to use for drawing.</param>
		/// <param name="ellipse">The ellipse primitive to be drawn.</param>
		/// <param name="dpi">The intended output DPI.</param>
		public static void DrawEllipsePrimitive(IGdiBuffer buffer, Pen pen, IBoundableGraphic ellipse, float dpi = _nominalScreenDpi)
		{
			buffer.Graphics.Transform = ellipse.SpatialTransform.CumulativeTransform;
			ellipse.CoordinateSystem = CoordinateSystem.Source;
			buffer.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
			try
			{
				var rectangle = new RectangleF(ellipse.TopLeft.X, ellipse.TopLeft.Y, ellipse.Width, ellipse.Height);
				rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle);
				var dropShadowOffset = GetDropShadowOffset(ellipse, dpi);

				// Draw drop shadow
				pen.Color = Color.Black;
				pen.Width = CalculateScaledPenWidth(ellipse, 1, dpi);

				SetDashStyle(pen, ellipse);

				buffer.Graphics.DrawEllipse(
					pen,
					rectangle.Left + dropShadowOffset.Width,
					rectangle.Top + dropShadowOffset.Height,
					rectangle.Width,
					rectangle.Height);

				// Draw rectangle
				pen.Color = ellipse.Color;

				buffer.Graphics.DrawEllipse(
					pen,
					rectangle.Left,
					rectangle.Top,
					rectangle.Width,
					rectangle.Height);
			}
			finally
			{
				buffer.Graphics.SmoothingMode = SmoothingMode.None;
				ellipse.ResetCoordinateSystem();
				buffer.Graphics.ResetTransform();
			}
		}