コード例 #1
0
        public object EndRender()
        {
            var result = _canvas;

            _canvas = null;
            return(result);
        }
コード例 #2
0
 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";
 }
コード例 #3
0
        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>();
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 public CanvasPattern CreatePattern(HtmlCanvasElement canvas, JsString repetitionType) { return default(CanvasPattern); }
コード例 #7
0
 public void DrawImage(HtmlCanvasElement canvas, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) { }
コード例 #8
0
 public void DrawImage(HtmlCanvasElement canvas, double dx, double dy) { }
コード例 #9
0
 public void TexSubImage2D(int target, int level, int xoffset, int yoffset, int format, int type, HtmlCanvasElement canvas)
 {
 }
コード例 #10
0
 public void TexSubImage2D(int target, int level, int xoffset, int yoffset, int format, int type, HtmlCanvasElement canvas) { }
コード例 #11
0
 public void TexImage2D(int target, int level, int internalformat, int format, int type, HtmlCanvasElement canvas) { }
コード例 #12
0
 public CanvasPattern CreatePattern(HtmlCanvasElement canvas, JsString repetitionType)
 {
     return(default(CanvasPattern));
 }
コード例 #13
0
 public void DrawImage(HtmlCanvasElement canvas, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
 {
 }
コード例 #14
0
 public void DrawImage(HtmlCanvasElement canvas, double dx, double dy)
 {
 }
コード例 #15
0
 public Point GetPosition(HtmlCanvasElement relativeTo)
コード例 #16
0
 public static void UnregisterContextMenu(HtmlCanvasElement htmlCanvasElement)
 {
     // Unregister all events:
     htmlCanvasElement.RightTapped -= HtmlCanvasElement_RightTapped;
 }
コード例 #17
0
 public void TexImage2D(int target, int level, int internalformat, int format, int type, HtmlCanvasElement canvas)
 {
 }