/// <summary> /// Sets up a new instance of this class with the given values. /// </summary> /// <param name="renderControl">Control to render to.</param> /// <param name="flags">Flags to setup this control with.</param> public GraphicsCanvas(Control renderControl, GraphicsFlags flags, CanvasRenderHandler handler) { _renderControl = renderControl; _graphicsCanvas = GraphicsManager.Driver.CreateCanvas(renderControl, flags); if (handler != null) { _renderDelegate += handler; // Fix this so its removed when canvas is destroyed!. } _driver = GraphicsManager.Driver; GraphicsManager.RenderTarget = this; }
/// <summary> /// Sets up a new instance of this class with the given values. /// </summary> /// <param name="renderControl">Control to render to.</param> /// <param name="flags">Flags to setup this control with.</param> public GraphicsCanvas(Control renderControl, GraphicsFlags flags, CanvasRenderHandler handler) { _renderControl = renderControl; _graphicsCanvas = GraphicsManager.Driver.CreateCanvas(renderControl, flags); if (handler != null) _renderDelegate += handler; // Fix this so its removed when canvas is destroyed!. _driver = GraphicsManager.Driver; GraphicsManager.RenderTarget = this; }
/// <summary> /// Creates a canvas that can be rendered to by the current driver. /// </summary> /// <param name="control">Control to render this canvases graphics to.</param> /// <returns>New renderable canvas.</returns> public static GraphicsCanvas CreateCanvas(Control control, GraphicsFlags flags, CanvasRenderHandler handler) { GraphicsCanvas canvas = new GraphicsCanvas(control, flags, handler); ClearRenderState(); return(canvas); }
/// <summary> /// Creates a canvas that can be rendered to by the current driver. /// </summary> /// <param name="control">Control to render this canvases graphics to.</param> /// <returns>New renderable canvas.</returns> public static GraphicsCanvas CreateCanvas(Control control, GraphicsFlags flags, CanvasRenderHandler handler) { GraphicsCanvas canvas = new GraphicsCanvas(control, flags, handler); ClearRenderState(); return canvas; }