Ejemplo n.º 1
0
        public void DrawRectangle(LuaBrush luaBrush, double x, double y, double height, double width)
        {
            x      *= _scale;
            y      *= _scale;
            height *= _scale;
            width  *= _scale;

            _ctx.DrawRectangle(luaBrush.Brush, new Pen(), new Rect(x, y, width, height));
        }
Ejemplo n.º 2
0
        public void DrawLine(LuaBrush luaBrush, double startX, double startY, double endX, double endY,
                             double thickness)
        {
            startX    *= _scale;
            startY    *= _scale;
            endX      *= _scale;
            endY      *= _scale;
            thickness *= _scale;

            _ctx.DrawLine(new Pen(luaBrush.Brush, thickness), new Point(startX, startY), new Point(endX, endY));
        }
Ejemplo n.º 3
0
        public void DrawEllipse(LuaBrush luaBrush, double x, double y, double height, double width)
        {
            x      *= _scale;
            y      *= _scale;
            height *= _scale;
            width  *= _scale;

            var center = new Point(x + width / 2, y + height / 2);

            _ctx.DrawEllipse(luaBrush.Brush, new Pen(), center, width, height);
        }
Ejemplo n.º 4
0
        public double DrawText(LuaBrush luaBrush, double x, double y, string text, int fontSize)
        {
            x        *= _scale;
            y        *= _scale;
            fontSize *= _scale;

            var typeFace  = new Typeface(Font, new FontStyle(), new FontWeight(), new FontStretch());
            var formatted = new FormattedText(text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, typeFace,
                                              fontSize, luaBrush.Brush);

            _ctx.DrawText(formatted, new Point(x, y));
            return(formatted.Width / _scale);
        }