Example #1
0
 /// <summary>
 /// Initializes the member variables before calling <see cref="Render"/> or <see cref="Refresh"/>.
 /// </summary>
 protected virtual void Initialize(DrawArgs drawArgs)
 {
     _drawMode   = drawArgs.DrawMode;
     _sceneGraph = drawArgs.SceneGraph;
     _surface    = drawArgs.RenderingSurface;
     Dpi         = drawArgs.Dpi;
 }
Example #2
0
        /// <summary>
        /// Renders the specified scene graph to the graphics surface.
        /// </summary>
        /// <remarks>
        /// Calling code should take care to handle any exceptions in a manner suitable to the context of
        /// the rendering operation. For example, the view control for an
        /// <see cref="ITile"/> may wish to display the error message in the tile's client area <i>without
        /// crashing the control</i>, whereas an image export routine may wish to notify the user via an error
        /// dialog and have the export output <i>fail to be created</i>. Automated routines (such as unit
        /// tests) may even wish that the exception bubble all the way to the top for debugging purposes.
        /// </remarks>
        /// <param name="drawArgs">A <see cref="DrawArgs"/> object that specifies the graphics surface and the scene graph to be rendered.</param>
        /// <exception cref="RenderingException">Thrown if any <see cref="Exception"/> is encountered in the rendering pipeline.</exception>
        public virtual void Draw(DrawArgs drawArgs)
        {
            try
            {
                Initialize(drawArgs);

                if (drawArgs.RenderingSurface.ClientRectangle.Width == 0 || drawArgs.RenderingSurface.ClientRectangle.Height == 0)
                {
                    return;
                }

                if (DrawMode == DrawMode.Render)
                {
                    Render();
                }
                else
                {
                    Refresh();
                }
            }
            catch (Exception e)
            {
                throw new RenderingException(e, drawArgs);
            }
            finally
            {
                _sceneGraph = null;
                _surface    = null;
            }
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of <see cref="DrawArgs"/>.
 /// </summary>
 public DrawArgs(
     IRenderingSurface surface,
     DrawMode drawMode)
 {
     _renderingSurface = surface;
     _drawMode         = drawMode;
 }
 private void DisposeSurface()
 {
     if (_surface != null)
     {
         _surface.Dispose();
         _surface = null;
     }
 }
Example #5
0
 private void DisposeSurface()
 {
     if (_renderingSurface != null)
     {
         _renderingSurface.Dispose();
         _renderingSurface = null;
     }
 }
 private void DisposeSurface()
 {
     if (_surface != null)
     {
         _surface.Invalidated -= OnSurfaceInvalidated;
         _surface.Dispose();
         _surface = null;
     }
 }
Example #7
0
		/// <summary>
		/// Initializes a new instance of <see cref="DrawArgs"/>.
		/// </summary>
		public DrawArgs(
			IRenderingSurface surface, 
			Screen screen,
			DrawMode drawMode)
		{
			_renderingSurface = surface;
			_screen = screen;
			_drawMode = drawMode;
		}
Example #8
0
 /// <summary>
 /// Initializes a new instance of <see cref="DrawArgs"/>.
 /// </summary>
 public DrawArgs(
     IRenderingSurface surface,
     Screen screen,
     DrawMode drawMode)
 {
     _renderingSurface = surface;
     _screen           = screen;
     _drawMode         = drawMode;
 }
Example #9
0
 private void DisposeSurface()
 {
     try
     {
         if (_surface != null)
         {
             _surface.Dispose();
         }
     }
     finally
     {
         _surface = null;
     }
 }
Example #10
0
        private void DisposeSurface()
        {
            if (_surface != null)
            {
                _surface.Dispose();
                _surface = null;
            }

            if (_bitmap != null)
            {
                _bitmap.Dispose();
                _bitmap = null;
            }
        }
Example #11
0
        public MagnificationForm(PresentationImage image, Point startPointTile, RenderMagnifiedImage render)
		{
			InitializeComponent();

            Visible = false;
			this.DoubleBuffered = false;
			this.SetStyle(ControlStyles.DoubleBuffer, false);
			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
			this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);

			if (Form.ActiveForm != null)
				this.Owner = Form.ActiveForm;

			_startPointTile = startPointTile;
            _render = render;

            _surface = image.ImageRenderer.GetRenderingSurface(Handle, ClientRectangle.Width, ClientRectangle.Height);

            _startPointDesktop = Centre = Cursor.Position;
		}
        public MagnificationForm(PresentationImage image, Point startPointTile, RenderMagnifiedImage render)
        {
            InitializeComponent();

            Visible             = false;
            this.DoubleBuffered = false;
            this.SetStyle(ControlStyles.DoubleBuffer, false);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);

            if (Form.ActiveForm != null)
            {
                this.Owner = Form.ActiveForm;
            }

            _startPointTile = startPointTile;
            _render         = render;

            _surface = image.ImageRenderer.GetRenderingSurface(Handle, ClientRectangle.Width, ClientRectangle.Height);

            _startPointDesktop = Centre = Cursor.Position;
        }
Example #13
0
		/// <summary>
		/// Initializes the member variables before calling <see cref="Render"/> or <see cref="Refresh"/>.
		/// </summary>
		protected virtual void Initialize(DrawArgs drawArgs)
		{
			_drawMode = drawArgs.DrawMode;
			_sceneGraph = drawArgs.SceneGraph;
			_surface = drawArgs.RenderingSurface;
			Dpi = drawArgs.Dpi;
		}
Example #14
0
		private void DisposeSurface()
		{
			try
			{
				if (_surface != null)
				{
					_surface.Invalidated -= OnSurfaceInvalidated;
					_surface.Dispose();
				}
			}
			finally
			{
				_surface = null;
			}
		}
Example #15
0
		private void DisposeSurface()
		{
			try
			{
				if (_surface != null)
					_surface.Dispose();
			}
			finally
			{
				_surface = null;
			}
		}
Example #16
0
        private void DisposeSurface()
		{
			if (_surface != null)
			{
                _surface.Dispose();
                _surface = null;
			}
		}
Example #17
0
		/// <summary>
		/// Renders the specified scene graph to the graphics surface.
		/// </summary>
		/// <remarks>
		/// Calling code should take care to handle any exceptions in a manner suitable to the context of
		/// the rendering operation. For example, the view control for an
		/// <see cref="ITile"/> may wish to display the error message in the tile's client area <i>without
		/// crashing the control</i>, whereas an image export routine may wish to notify the user via an error
		/// dialog and have the export output <i>fail to be created</i>. Automated routines (such as unit
		/// tests) may even wish that the exception bubble all the way to the top for debugging purposes.
		/// </remarks>
		/// <param name="drawArgs">A <see cref="DrawArgs"/> object that specifies the graphics surface and the scene graph to be rendered.</param>
		/// <exception cref="RenderingException">Thrown if any <see cref="Exception"/> is encountered in the rendering pipeline.</exception>
		public virtual void Draw(DrawArgs drawArgs)
		{
			try
			{
				Initialize(drawArgs); 
				
				if (drawArgs.RenderingSurface.ClientRectangle.Width == 0 || drawArgs.RenderingSurface.ClientRectangle.Height == 0)
					return;
								
				if (DrawMode == DrawMode.Render)
					Render();
				else
					Refresh();
			}
			catch (Exception e)
			{
				throw new RenderingException(e, drawArgs);
			}
			finally
			{
				_sceneGraph = null;
				_surface = null;
			}
		}