예제 #1
0
        private void WriteEllipseAttributes(SvgEllipse svg, EllipseVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var rect = vObject.Rectangle;

            svg.Cx = rect.CenterX;
            svg.Cy = rect.CenterY;
            svg.Rx = rect.Width / 2;
            svg.Ry = rect.Height / 2;
            var m = new Matrix();

            m.RotateAt(rect.Angle, new System.Drawing.PointF(rect.CenterX, rect.CenterY));
            svg.Transform = m;

            svg.StrokeWidth = vObject.BorderWidth;

            var cm = vObject.GetColorManagement(true);

            svg.Stroke = ColorManagement.GetPreviewColor(cm, vObject.BorderColor);
            svg.CustomAttributes.Add(new SvgVoAttribute("border-color", _serializer.Serialize(vObject.BorderColor)));
            svg.Fill = ColorManagement.GetPreviewColor(cm, vObject.FillColor);
            svg.CustomAttributes.Add(new SvgVoAttribute("fill-color", _serializer.Serialize(vObject.FillColor)));

            if (vObject.FixedBorderWidth)
            {
                svg.CustomAttributes.Add(new SvgVoAttribute("fixed-border-width", vObject.FixedBorderWidth));
            }
        }
예제 #2
0
        private void WriteSvgAttributes(SvgVoSvg svg, SvgVObject vObject)
        {
            WriteRectangleAttributes(svg, vObject);

            svg.Svg = vObject.Svg;

            var cm = vObject.GetColorManagement(true);

            svg.SetStrokeColor(vObject.StrokeColor, ColorManagement.GetPreviewColor(cm, vObject.StrokeColor), _serializer);
        }
예제 #3
0
        private void WriteDashLineAttributes(SvgVoDashLine svg, DashedLineVObject vObject)
        {
            WriteLineAttributes(svg, vObject);

            var cm = vObject.GetColorManagement(true);

            svg.SetAltColor(vObject.AltColor, ColorManagement.GetPreviewColor(cm, vObject.AltColor), _serializer);

            svg.AltDashWidth = vObject.AltDashWidth;
            svg.DashWidth    = vObject.DashWidth;
        }
예제 #4
0
        private void WritePolylineAttributes(SvgPolyline svg, PolylineVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var points = svg.Points;

            foreach (var p in vObject.GetPoints())
            {
                points.Add(p.ToPoint());
            }

            var cm = vObject.GetColorManagement(true);

            svg.Stroke = ColorManagement.GetPreviewColor(cm, vObject.Color);
            svg.CustomAttributes.Add(new SvgVoAttribute("color", _serializer.Serialize(vObject.Color)));

            svg.StrokeWidth = vObject.Width;
            svg.Fill        = RgbColor.Transparent;
        }
예제 #5
0
        private void WriteTextAttributes(SvgVoText svg, BaseTextVObject vObject)
        {
            WriteContentAttributes(svg, vObject);

            var cm = vObject.GetColorManagement(true);

            svg.SetTextColor(vObject.TextColor, ColorManagement.GetPreviewColor(cm, vObject.TextColor), _serializer);

            svg.Text = vObject.Text;

            svg.Font = new FontSettings(vObject.Font);

            svg.Underline       = vObject.Underline;
            svg.Alignment       = vObject.Alignment;
            svg.Tracking        = vObject.Tracking;
            svg.Leading         = vObject.Leading;
            svg.IsRichText      = vObject.IsRichText;
            svg.VerticalScale   = vObject.VerticalScale;
            svg.HorizontalScale = vObject.HorizontalScale;
        }
예제 #6
0
        private void WriteLineAttributes(SvgLine svg, LineVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var cm = vObject.GetColorManagement(true);

            svg.Stroke = ColorManagement.GetPreviewColor(cm, vObject.Color);
            svg.CustomAttributes.Add(new SvgVoAttribute("color", _serializer.Serialize(vObject.Color)));

            svg.StrokeWidth = vObject.Width;
            svg.X1          = vObject.Point0.X;
            svg.Y1          = vObject.Point0.Y;
            svg.X2          = vObject.Point1.X;
            svg.Y2          = vObject.Point1.Y;

            if (vObject.FixedWidth)
            {
                svg.CustomAttributes.Add(new SvgVoAttribute("fixed-width", vObject.FixedWidth));
            }
        }
예제 #7
0
        private void WriteShapeAttributes(SvgVoShape svg, ShapeVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var rect = vObject.Rectangle;

            vObject.Angle = 0;
            svg.Path      = vObject.GetTransformedPath().ToPathCommands();
            vObject.Angle = rect.Angle;

            var m = new Matrix();

            m.RotateAt(rect.Angle, new System.Drawing.PointF(rect.CenterX, rect.CenterY));
            svg.Transform = m;

            var cm = vObject.GetColorManagement(true);

            svg.SetFillColor(vObject.FillColor, ColorManagement.GetPreviewColor(cm, vObject.FillColor), _serializer);
            svg.SetBorderColor(vObject.BorderColor, ColorManagement.GetPreviewColor(cm, vObject.BorderColor), _serializer);
            svg.StrokeWidth      = vObject.BorderWidth;
            svg.FixedBorderWidth = vObject.FixedBorderWidth;
        }
예제 #8
0
        private void WriteRectangleAttributes(SvgVoRectangle svg, RectangleVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var rect = vObject.Rectangle;

            svg.X      = rect.CenterX - rect.Width / 2;
            svg.Y      = rect.CenterY - rect.Height / 2;
            svg.Width  = rect.Width;
            svg.Height = rect.Height;
            var m = new Matrix();

            m.RotateAt(rect.Angle, new System.Drawing.PointF(rect.CenterX, rect.CenterY));
            svg.Transform = m;

            var cm = vObject.GetColorManagement(true);

            svg.SetFillColor(vObject.FillColor, ColorManagement.GetPreviewColor(cm, vObject.FillColor), _serializer);
            svg.SetBorderColor(vObject.BorderColor, ColorManagement.GetPreviewColor(cm, vObject.BorderColor), _serializer);
            svg.StrokeWidth      = vObject.BorderWidth;
            svg.FixedBorderWidth = vObject.FixedBorderWidth;
        }
예제 #9
0
        private void WriteGridAttributes(SvgVoGrid svg, GridVObject vObject)
        {
            WriteBaseRectangleVObjectAttributes(svg, vObject);

            var cm = vObject.GetColorManagement(true);

            svg.SetVerticalLineColor(vObject.VerticalLineColor, ColorManagement.GetPreviewColor(cm, vObject.VerticalLineColor), _serializer);
            svg.SetHorizontalLineColor(vObject.HorizontalLineColor, ColorManagement.GetPreviewColor(cm, vObject.HorizontalLineColor), _serializer);

            svg.StrokeWidth = vObject.LineWidth;

            svg.Cols  = vObject.Cols;
            svg.Rows  = vObject.Rows;
            svg.StepX = vObject.StepX;
            svg.StepY = vObject.StepY;

            var rect = vObject.Rectangle.ToRectangleF();

            svg.X = rect.X;
            svg.Y = rect.Y;
            svg.FixedStrokeWidth = vObject.FixedLineWidth;
        }