Beispiel #1
0
        public SvgGraphicsContext MapGraphicsContextToSvg(Point point, double rotation, GraphicsContext context)
        {
            var svgContext = new SvgGraphicsContext
            {
                Coordinate = MapPoint(point, rotation),
                Pen = MapPen(context),
                Font = MapFont(context),
                UnitType = UnitType,
                Fill = new SvgColourServer { Colour = ConvertRDotNetColor(context.Background) },
                Opacity = (float)(1 - context.Gamma),
                TextAnchor = SvgTextAnchor.Middle
            };

            return svgContext;
        }
 public void DrawCircle(Point center, double radius, GraphicsContext context, DeviceDescription description)
 {
     var svgContext = _mapper.MapGraphicsContextToSvg(center, context);
     AddChild(new SvgCircle
     {
         CenterX = svgContext.Coordinate.X,
         CenterY = svgContext.Coordinate.Y,
         Fill = svgContext.Fill,
         FillOpacity = svgContext.Opacity,
         Radius = new SvgUnit(svgContext.UnitType, (float)(radius)),
         Stroke = svgContext.Pen.Stroke,
         StrokeDashArray = svgContext.Pen.StrokeDashArray,
         StrokeLineCap = svgContext.Pen.StrokeLineCap,
         StrokeLineJoin = svgContext.Pen.StrokeLineJoin,
         StrokeWidth = svgContext.Pen.StrokeWidth
     });
 }
Beispiel #3
0
        public void DrawCircle(Point center, double radius, GraphicsContext context, DeviceDescription description)
        {
            var svgContext = _mapper.MapGraphicsContextToSvg(center, context);

            AddChild(new SvgCircle
            {
                CenterX         = svgContext.Coordinate.X,
                CenterY         = svgContext.Coordinate.Y,
                Fill            = svgContext.Fill,
                FillOpacity     = svgContext.Opacity,
                Radius          = new SvgUnit(svgContext.UnitType, (float)(radius)),
                Stroke          = svgContext.Pen.Stroke,
                StrokeDashArray = svgContext.Pen.StrokeDashArray,
                StrokeLineCap   = svgContext.Pen.StrokeLineCap,
                StrokeLineJoin  = svgContext.Pen.StrokeLineJoin,
                StrokeWidth     = svgContext.Pen.StrokeWidth
            });
        }
 public void DrawLine(Point source, Point destination, GraphicsContext context, DeviceDescription description)
 {
     var svgContext = _mapper.MapGraphicsContextToSvg(source, context);
     var end = _mapper.MapPoint(destination, 0d);
     AddChild(new SvgLine
     {
         EndX = end.X,
         EndY = end.Y,
         Fill = svgContext.Fill,
         FillOpacity = svgContext.Opacity,
         StartX = svgContext.Coordinate.X,
         StartY = svgContext.Coordinate.Y,
         Stroke = svgContext.Pen.Stroke,
         StrokeDashArray = svgContext.Pen.StrokeDashArray,
         StrokeLineCap = svgContext.Pen.StrokeLineCap,
         StrokeLineJoin = svgContext.Pen.StrokeLineJoin,
         StrokeWidth = svgContext.Pen.StrokeWidth
     });
 }
Beispiel #5
0
        public void DrawText(string s, Point location, double rotation, double adjustment, GraphicsContext context, DeviceDescription description)
        {
            var svgContext = _mapper.MapGraphicsContextToSvg(location, rotation, context);

            AddChild(new SvgText
            {
                Fill       = svgContext.Pen.Stroke,
                FontFamily = svgContext.Font.Family,
                FontSize   = svgContext.Font.Size,
                FontWeight = svgContext.Font.Weight,
                Text       = s,
                TextAnchor = svgContext.TextAnchor,
                Transforms = new SvgTransformCollection {
                    svgContext.Coordinate.Rotation
                },
                X = createUnitCollection(svgContext.Coordinate.X),
                Y = createUnitCollection(svgContext.Coordinate.Y)
            });
        }
Beispiel #6
0
        public void DrawLine(Point source, Point destination, GraphicsContext context, DeviceDescription description)
        {
            var svgContext = _mapper.MapGraphicsContextToSvg(source, context);
            var end        = _mapper.MapPoint(destination, 0d);

            AddChild(new SvgLine
            {
                EndX            = end.X,
                EndY            = end.Y,
                Fill            = svgContext.Fill,
                FillOpacity     = svgContext.Opacity,
                StartX          = svgContext.Coordinate.X,
                StartY          = svgContext.Coordinate.Y,
                Stroke          = svgContext.Pen.Stroke,
                StrokeDashArray = svgContext.Pen.StrokeDashArray,
                StrokeLineCap   = svgContext.Pen.StrokeLineCap,
                StrokeLineJoin  = svgContext.Pen.StrokeLineJoin,
                StrokeWidth     = svgContext.Pen.StrokeWidth
            });
        }
        public SvgCoordinateContext MapPoint(Point point, double rotation, SvgUnitType unitType)
        {
            if (point.Y < 0)
            {
                point.Y = Math.Abs(point.Y) - _offset.X;
            }
            else
            {
                point.Y = Height - point.Y;
            }

            var svgStartX = new SvgUnit(unitType, (float)point.X);
            var svgStartY = new SvgUnit(unitType, (float)point.Y);
            var context   = new SvgCoordinateContext
            {
                X        = svgStartX,
                Y        = svgStartY,
                Rotation = new SvgRotate((float)-rotation, svgStartX, svgStartY)
            };

            return(context);
        }
 public SvgGraphicsContext MapGraphicsContextToSvg(Point point, GraphicsContext context)
 {
     return MapGraphicsContextToSvg(point, 0, context);
 }
        public SvgCoordinateContext MapPoint(Point point, double rotation, SvgUnitType unitType)
        {
            if (point.Y < 0)
            {
                point.Y = Math.Abs(point.Y) - _offset.X;
            }
            else
            {
                point.Y = Height - point.Y;
            }

            var svgStartX = new SvgUnit(unitType, (float)point.X);
            var svgStartY = new SvgUnit(unitType, (float)point.Y);
            var context = new SvgCoordinateContext
            {
                X = svgStartX,
                Y = svgStartY,
                Rotation = new SvgRotate((float)-rotation, svgStartX, svgStartY)
            };

            return context;
        }
 public SvgCoordinateContext MapPoint(Point point, SvgUnitType unitType)
 {
     return MapPoint(point, 0, unitType);
 }
 public SvgCoordinateContext MapPoint(Point point, double rotation)
 {
     return MapPoint(point, rotation, UnitType);
 }
        public SvgGraphicsContext MapGraphicsContextToSvg(Point point, double rotation, GraphicsContext context)
        {
            var svgContext = new SvgGraphicsContext
            {
                Coordinate = MapPoint(point, rotation),
                Pen = MapPen(context),
                Font = MapFont(context),
                UnitType = UnitType,
                Fill = new SvgColourServer { Colour = ConvertRDotNetColor(context.Background) },
                Opacity = (float)(1 - context.Gamma),
                TextAnchor = SvgTextAnchor.Middle
            };

            return svgContext;
        }
 public SvgGraphicsContext MapGraphicsContextToSvg(Point point, GraphicsContext context)
 {
     return(MapGraphicsContextToSvg(point, 0, context));
 }
Beispiel #14
0
 public SvgCoordinateContext MapPoint(Point point)
 {
     return MapPoint(point, 0, UnitType);
 }
 public SvgCoordinateContext MapPoint(Point point, double rotation)
 {
     return(MapPoint(point, rotation, UnitType));
 }
 public void DrawText(string s, Point location, double rotation, double adjustment, GraphicsContext context, DeviceDescription description)
 {
     var svgContext = _mapper.MapGraphicsContextToSvg(location, rotation, context);
     AddChild(new SvgText
     {
         Fill = svgContext.Pen.Stroke,
         FontFamily = svgContext.Font.Family,
         FontSize = svgContext.Font.Size,
         FontWeight = svgContext.Font.Weight,
         Text = s,
         TextAnchor = svgContext.TextAnchor,
         Transforms = new SvgTransformCollection { svgContext.Coordinate.Rotation },
         X = createUnitCollection(svgContext.Coordinate.X),
         Y = createUnitCollection(svgContext.Coordinate.Y)
     });
 }
 public SvgCoordinateContext MapPoint(Point point, SvgUnitType unitType)
 {
     return(MapPoint(point, 0, unitType));
 }