public object EndRender() { var result = _canvas; _canvas = null; return(result); }
public void BeginRender(float width, float height) { _canvas = (HtmlCanvasElement)document.createElement("canvas"); _canvas.width = (int)width; _canvas.height = (int)height; _canvas.style.width = width + "px"; _canvas.style.height = height + "px"; _context = (CanvasRenderingContext2D)_canvas.getContext("2d"); _context.textBaseline = "top"; }
private static void CreateCanvasElement() { var canvas = new HtmlCanvasElement { id = "canvas2D" }; canvas.style.width = new JsString("100%"); canvas.style.height = new JsString("100%"); HtmlContext.document.body.appendChild(canvas); _canvasRenderingContext2D = canvas.As <HtmlCanvasElement>().getContext("2d").As <CanvasRenderingContext2D>(); }
public PointerPoint GetCurrentPoint(HtmlCanvasElement relativeTo) #endif { if (relativeTo == null) { #if MIGRATION return(base.GetPosition(null)); #else return(base.GetCurrentPoint(null)); #endif } else { #if MIGRATION Point pointerPoint = base.GetPosition(this.HtmlCanvas); #else PointerPoint pointerPoint = base.GetCurrentPoint(this.HtmlCanvas); #endif Stack <HtmlCanvasElement> elem = HtmlCanvas.SearchElement(this.HtmlCanvas, relativeTo); #if MIGRATION double x = pointerPoint.X; double y = pointerPoint.Y; #else double x = pointerPoint.Position.X; double y = pointerPoint.Position.Y; #endif if (elem == null) { return(pointerPoint); } while (elem.Count > 0) { var e = elem.Pop(); x -= e.X; y -= e.Y; } #if MIGRATION pointerPoint = new Point(x, y); #else pointerPoint.Position = new Point(x, y); #endif return(pointerPoint); } }
public static void RegisterContextMenu(HtmlCanvasElement htmlCanvasElement, ContextMenu contextMenu) { if (contextMenu != null) { // Remember the HtmlCanvasElement: contextMenu.INTERNAL_HtmlCanvasElementToWhichThisMenuIsAssigned = htmlCanvasElement; // Register the right-click event: htmlCanvasElement.RightTapped -= HtmlCanvasElement_RightTapped; // Note: we unregister the event first, in order not to register twice. htmlCanvasElement.RightTapped += HtmlCanvasElement_RightTapped; } else { UnregisterContextMenu(htmlCanvasElement); } }
public CanvasPattern CreatePattern(HtmlCanvasElement canvas, JsString repetitionType) { return default(CanvasPattern); }
public void DrawImage(HtmlCanvasElement canvas, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) { }
public void DrawImage(HtmlCanvasElement canvas, double dx, double dy) { }
public void TexSubImage2D(int target, int level, int xoffset, int yoffset, int format, int type, HtmlCanvasElement canvas) { }
public void TexImage2D(int target, int level, int internalformat, int format, int type, HtmlCanvasElement canvas) { }
public CanvasPattern CreatePattern(HtmlCanvasElement canvas, JsString repetitionType) { return(default(CanvasPattern)); }
public Point GetPosition(HtmlCanvasElement relativeTo)
public static void UnregisterContextMenu(HtmlCanvasElement htmlCanvasElement) { // Unregister all events: htmlCanvasElement.RightTapped -= HtmlCanvasElement_RightTapped; }