Exemplo n.º 1
0
        /// <summary>
        /// This function writes the staff name, barnumber and region info to the SVG file (if they are present).
        /// The barline itself is drawn when the system (and staff edges) is complete.
        /// </summary>
        public override void WriteDrawObjectsSVG(SvgWriter w)
        {
            base.WriteDrawObjectsSVG(w);

            FramedRegionInfoMetrics upperBox = null;

            if (FramedRegionEndTextMetrics != null)
            {
                upperBox = FramedRegionEndTextMetrics;
            }
            if (FramedRegionStartTextMetrics != null)
            {
                upperBox = (upperBox != null && upperBox.Bottom < FramedRegionStartTextMetrics.Bottom) ? upperBox : FramedRegionStartTextMetrics;
            }
            if (upperBox != null)
            {
                DrawRegionFrameConnector(w, upperBox);
            }

            if (FramedRegionEndTextMetrics != null)
            {
                FramedRegionEndTextMetrics.WriteSVG(w);
            }

            if (FramedRegionStartTextMetrics != null)
            {
                FramedRegionStartTextMetrics.WriteSVG(w);
            }
        }
Exemplo n.º 2
0
 public override void WriteSVG(SvgWriter w)
 {
     w.SvgStartGroup(null, "beamBlock" + SvgScore.UniqueID_Number);
     foreach (Beam beam in Beams)
     {
         if (!(beam is QuaverBeam))
         {
             float topLeft  = 0F;
             float topRight = 0F;
             if (_stemDirection == VerticalDir.down)
             {
                 topLeft  = beam.LeftTopY + _beamThickness;
                 topRight = beam.RightTopY + _beamThickness;
             }
             else
             {
                 topLeft  = beam.LeftTopY - _beamThickness;
                 topRight = beam.RightTopY - _beamThickness;
             }
             w.SvgBeam("beam" + SvgScore.UniqueID_Number, beam.LeftX, beam.RightX, topLeft, topRight, _beamThickness * 1.5F, 0F, 0.65F);
         }
         w.SvgBeam("beam" + SvgScore.UniqueID_Number, beam.LeftX, beam.RightX, beam.LeftTopY, beam.RightTopY, _beamThickness, _strokeThickness, 1.0F);
     }
     w.SvgEndGroup();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Writes out the barline's vertical line(s).
        /// May be called twice per staff.barline:
        ///     1. for the range between top and bottom stafflines (if Barline.Visible is true)
        ///     2. for the range between the staff's lower edge and the next staff's upper edge
        ///        (if the staff's lower neighbour is in the same group)
        /// </summary>
        /// <param name="w"></param>
        public override void WriteSVG(SvgWriter w, double topStafflineY, double bottomStafflineY, bool isEndOfSystem, bool writeDots = false)
        {
            double topY    = TopY(topStafflineY, isEndOfSystem);
            double bottomY = BottomY(bottomStafflineY, isEndOfSystem);

            w.SvgLine(CSSObjectClass.normalBarline, this.Metrics.OriginX, topY, this.Metrics.OriginX, bottomY);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Writes out an SVG Barline.
        /// May be called twice per staff.barline:
        ///     1. for the range between top and bottom stafflines (if Barline.Visible is true)
        ///     2. for the range between the staff's lower edge and the next staff's upper edge
        ///        (if the staff's lower neighbour is in the same group)
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, float topStafflineY, float bottomStafflineY, float singleBarlineStrokeWidth, float stafflineStrokeWidth, bool isLastNoteObject, bool isConnector)
        {
            float topY    = topStafflineY;
            float bottomY = bottomStafflineY;

            if (isLastNoteObject && !isConnector)
            {
                float halfStrokeWidth = (stafflineStrokeWidth / 2);
                topY    -= halfStrokeWidth;
                bottomY += halfStrokeWidth;
            }

            string barlineID;

            if (BarlineType == BarlineType.end)
            {
                barlineID = isConnector ? null : "endBarlineLeft" + SvgScore.UniqueID_Number;
                w.SvgLine(barlineID,
                          this.Metrics.OriginX - (singleBarlineStrokeWidth * 3F), topY,
                          this.Metrics.OriginX - (singleBarlineStrokeWidth * 3F), bottomY,
                          "black", singleBarlineStrokeWidth, null);

                barlineID = isConnector ? null : "endBarlineRight" + SvgScore.UniqueID_Number;
                w.SvgLine(barlineID,
                          this.Metrics.OriginX, topY,
                          this.Metrics.OriginX, bottomY,
                          "black", singleBarlineStrokeWidth * 2F, null);
            }
            else
            {
                barlineID = isConnector ? null : "barline" + SvgScore.UniqueID_Number;
                w.SvgLine(barlineID, this.Metrics.OriginX, topY, this.Metrics.OriginX, bottomY, "black", singleBarlineStrokeWidth, null);
            }
        }
Exemplo n.º 5
0
        public override void WriteSVG(SvgWriter w, int voiceIndex, List <CarryMsgs> carryMsgsPerChannel, bool graphicsOnly)
        {
            w.SvgStartGroup(CSSObjectClass.voice.ToString());

            base.WriteSVG(w, voiceIndex, carryMsgsPerChannel, graphicsOnly);
            w.SvgEndGroup(); // outputVoice
        }
Exemplo n.º 6
0
 public override void WriteSVG(SvgWriter w)
 {
     if (_drawExtender)
     {
         w.SvgLine("extender" + SvgScore.UniqueID_Number, _left, _originY, _right, _originY, "black", _strokeWidth, "butt");
     }
 }
Exemplo n.º 7
0
        public override void WriteSVG(SvgWriter w)
        {
            //w.SvgText(TextInfo, Metrics as TextMetrics); // does not work with DynamicMetrics
            if (Metrics != null)
            {
                Metrics.WriteSVG(w);
            }
            if (_frameInfo != null)
            {
                switch (_frameInfo.FrameType)
                {
                case TextFrameType.none:
                    break;

                case TextFrameType.rectangle:
                    w.SvgRect(CSSObjectClass.regionInfoFrame, Metrics.Left, Metrics.Top, Metrics.Right - Metrics.Left, Metrics.Bottom - Metrics.Top);
                    break;

                case TextFrameType.ellipse:
                    w.SvgEllipse(CSSObjectClass.regionInfoFrame, Metrics.Left, Metrics.Top, (Metrics.Right - Metrics.Left) / 2, ((Metrics.Bottom - Metrics.Top) / 2));
                    break;

                case TextFrameType.circle:
                    w.SvgCircle(CSSObjectClass.regionInfoFrame, Metrics.Right - Metrics.Left, Metrics.Bottom - Metrics.Top, ((Metrics.Right - Metrics.Left) / 2));
                    break;
                }
            }
        }
Exemplo n.º 8
0
 public override void WriteSVG(SvgWriter w)
 {
     foreach (float y in Ys)
     {
         w.SvgLine("ledger" + SvgScore.UniqueID_Number, _left + _strokeWidth, y, _right - _strokeWidth, y, "black", _strokeWidth, null);
     }
 }
Exemplo n.º 9
0
        public void WriteContent(XmlElement xmlElement, SvgWriter svgWriter)
        {
            foreach (var line in new SvgLine[] { _line1, _line2 })
            {
                line.X1          = X1;
                line.Y1          = Y1;
                line.X2          = X2;
                line.Y2          = Y2;
                line.StrokeWidth = StrokeWidth;
            }

            _line1.Stroke = Stroke;
            _line2.Stroke = AltStroke;

            _line1.StrokeDashArray = new List <float>()
            {
                DashWidth, AltDashWidth
            };
            _line2.StrokeDashArray = new List <float>()
            {
                AltDashWidth, DashWidth
            };

            _line2.StrokeDashOffset = DashWidth;

            var xml = svgWriter.CreateXmlElementFromSvg(_line1);

            xmlElement.AppendChild(xml);
            svgWriter.Write(_line1, xml);

            xml = svgWriter.CreateXmlElementFromSvg(_line2);
            xmlElement.AppendChild(xml);
            svgWriter.Write(_line2, xml);
        }
Exemplo n.º 10
0
        public void WriteSVG(SvgWriter w)
        {
            w.WriteStartElement("sliders");

            if (PitchWheelMsbs != null && PitchWheelMsbs.Count > 0 &&
                !(PitchWheelMsbs.Count == 1 && PitchWheelMsbs[0] == M.DefaultPitchWheel))
            {
                w.WriteAttributeString("pitchWheel", M.ByteListToString(PitchWheelMsbs));
            }
            if (PanMsbs != null && PanMsbs.Count > 0 &&
                !(PanMsbs.Count == 1 && PanMsbs[0] == M.DefaultPan))
            {
                w.WriteAttributeString("pan", M.ByteListToString(PanMsbs));
            }
            if (ModulationWheelMsbs != null && ModulationWheelMsbs.Count > 0 &&
                !(ModulationWheelMsbs.Count == 1 && ModulationWheelMsbs[0] == M.DefaultModulationWheel))
            {
                w.WriteAttributeString("modulationWheel", M.ByteListToString(ModulationWheelMsbs));
            }
            if (ExpressionMsbs != null && ExpressionMsbs.Count > 0 &&
                !(ExpressionMsbs.Count == 1 && ExpressionMsbs[0] == M.DefaultExpression))
            {
                w.WriteAttributeString("expressionSlider", M.ByteListToString(ExpressionMsbs));
            }

            w.WriteEndElement();
        }
Exemplo n.º 11
0
        public override void WriteSVG(SvgWriter w)
        {
            //w.SvgText(TextInfo, Metrics as TextMetrics); // does not work with DynamicMetrics
            if (Metrics != null)
            {
                Metrics.WriteSVG(w);
            }
            if (_frameInfo != null)
            {
                switch (_frameInfo.FrameType)
                {
                case TextFrameType.none:
                    break;

                case TextFrameType.rectangle:
                    w.SvgRect("rectangle" + SvgScore.UniqueID_Number, Metrics.Left, Metrics.Top, Metrics.Right - Metrics.Left, Metrics.Bottom - Metrics.Top,
                              _frameInfo.ColorString.String, _frameInfo.StrokeWidth, "none");
                    break;

                case TextFrameType.ellipse:
                    w.SvgEllipse("ellipse" + SvgScore.UniqueID_Number, Metrics.Left, Metrics.Top, (Metrics.Right - Metrics.Left) / 2, (Metrics.Bottom - Metrics.Top) / 2,
                                 _frameInfo.ColorString.String, _frameInfo.StrokeWidth, "none");
                    break;

                case TextFrameType.circle:
                    w.SvgCircle("circle" + SvgScore.UniqueID_Number, Metrics.Right - Metrics.Left, Metrics.Bottom - Metrics.Top, ((Metrics.Right - Metrics.Left) / 2),
                                _frameInfo.ColorString.String, _frameInfo.StrokeWidth, "none");
                    break;
                }
            }
        }
Exemplo n.º 12
0
        public virtual void WriteSVG(SvgWriter w, int systemNumber, int staffNumber, List <CarryMsgs> carryMsgsPerChannel, bool graphicsOnly)
        {
            w.WriteAttributeString("score", "staffName", null, this.Staffname);

            CSSObjectClass stafflinesClass = CSSObjectClass.stafflines;
            CSSObjectClass stafflineClass  = CSSObjectClass.staffline;

            w.SvgStartGroup(stafflinesClass.ToString());
            double stafflineY = this.Metrics.StafflinesTop;

            for (int staffLineIndex = 0; staffLineIndex < NumberOfStafflines; staffLineIndex++)
            {
                w.SvgLine(stafflineClass, this.Metrics.StafflinesLeft, stafflineY, this.Metrics.StafflinesRight, stafflineY);

                if (staffLineIndex < (NumberOfStafflines - 1))
                {
                    stafflineY += Gap;
                }
            }
            w.SvgEndGroup();

            for (var voiceIndex = 0; voiceIndex < Voices.Count; voiceIndex++)
            {
                Voices[voiceIndex].WriteSVG(w, voiceIndex, carryMsgsPerChannel, graphicsOnly);
            }

            foreach (var extender in Extenders)
            {
                extender.Metrics.WriteSVG(w);
            }
        }
Exemplo n.º 13
0
 public override void WriteSVG(SvgWriter w)
 {
     w.SvgStartGroup(CSSObjectClass.ToString());
     w.SvgRect(CSSObjectClass.barNumberFrame, _left, _top, _right - _left, _bottom - _top);
     w.SvgText(CSSObjectClass.barNumberNumber, _number, _barNumberNumberMetrics.OriginX, _barNumberNumberMetrics.OriginY);
     w.SvgEndGroup();
 }
Exemplo n.º 14
0
        /// <summary>
        /// Moritz envelopes distribute the d2s over the whole msDuration,
        /// With the first d2 at position 0, the last d2 at msduration - 1.
        /// This function writes both d1 and d2
        /// </summary>
        /// <returns>The last controller value</returns>
        private byte WriteD1AndD2VTs(SvgWriter w, List <byte> d1s, List <byte> d2s, int msDuration)
        {
            M.Assert(d1s.Count == d2s.Count);
            byte       lastControllerValue = 0; // will always be changed
            List <int> msDurs = GetMsDurs(d1s.Count, msDuration);
            Tuple <List <int>, List <byte>, List <byte> > rVals = Agglommerate(msDurs, d1s, d2s);

            msDurs = rVals.Item1;
            List <byte> rD1s = rVals.Item2;
            List <byte> rD2s = rVals.Item3;

            for (int i = 0; i < msDurs.Count; ++i)
            {
                M.Assert(msDurs[i] > 0, "Moritz never writes controller values that would have to be carried to the next moment.");
                w.WriteStartElement("vt"); // envelope
                w.WriteAttributeString("d1", rD1s[i].ToString());
                w.WriteAttributeString("d2", rD2s[i].ToString());
                w.WriteAttributeString("msDur", msDurs[i].ToString());
                w.WriteEndElement(); // end vt

                lastControllerValue = d2s[i];
            }

            return(lastControllerValue);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Writes out an SVG Voice
        /// </summary>
        /// <param name="w"></param>
        public virtual void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            for (int i = 0; i < NoteObjects.Count; ++i)
            {
                NoteObject noteObject = NoteObjects[i];
                Barline    barline    = noteObject as Barline;
                if (staffIsVisible && barline != null)
                {
                    bool       isLastNoteObject = (i == (NoteObjects.Count - 1));
                    float      top                  = Staff.Metrics.StafflinesTop;
                    float      bottom               = Staff.Metrics.StafflinesBottom;
                    PageFormat pageFormat           = Staff.SVGSystem.Score.PageFormat;
                    float      barlineStrokeWidth   = pageFormat.BarlineStrokeWidth;
                    float      stafflineStrokeWidth = pageFormat.StafflineStemStrokeWidth;
                    barline.WriteSVG(w, top, bottom, barlineStrokeWidth, stafflineStrokeWidth, isLastNoteObject, false);
                }

                ChordSymbol chordSymbol = noteObject as ChordSymbol;
                if (chordSymbol != null)
                {
                    chordSymbol.WriteSVG(w, staffIsVisible);
                }
                else
                {
                    // if this is the first barline, the staff name and (maybe) barnumber will be written.
                    noteObject.WriteSVG(w, staffIsVisible);
                }
            }
        }
Exemplo n.º 16
0
 private static void SetVectorStyles(SvgWriter writer, Func <IFeature, VectorStyle> themeFilter, IFeature feature)
 {
     if (themeFilter != null)
     {
         SetVectorStyles(writer, themeFilter(feature));
     }
 }
Exemplo n.º 17
0
        internal void WriteSvg(SvgWriter w)
        {
            w.WriteStartElement("inputNote");
            w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString());

            if (InputControls != null)
            {
                InputControls.WriteSvg(w);
            }

            if (NoteOnTrkOns != null || NoteOnTrkOffs != null)
            {
                w.WriteStartElement("noteOn");
                WriteNoteOnOff(w, NoteOnTrkOns, NoteOnTrkOffs);
                w.WriteEndElement();                 // noteOn
            }

            if (NotePressures != null)
            {
                NotePressures.WriteSvg(w);
            }

            if (NoteOffTrkOns != null || NoteOffTrkOffs != null)
            {
                w.WriteStartElement("noteOff");
                WriteNoteOnOff(w, NoteOffTrkOns, NoteOffTrkOffs);
                w.WriteEndElement();                 // noteOff
            }

            w.WriteEndElement();             // score:inputNote N.B. This element can be empty!
        }
Exemplo n.º 18
0
        public new void WriteContent(XmlElement xmlElement, SvgWriter svgWriter)
        {
            base.WriteContent(xmlElement, svgWriter);

            // To serialize CurvedText we need to insert path def and textPath tags inside text tag (the last element)
            if (xmlElement.LastChild != null && xmlElement.LastChild.Name == "text")
            {
                var textElement = xmlElement.LastChild as XmlElement;
                textElement.InnerText = "";

                var defsElement = svgWriter.CreateXmlElementFromSvg(new SvgDefs());

                var path = Path.ToSvgPath();
                path.ID = "path_" + ID;

                var xml = svgWriter.CreateXmlElementFromSvg(path);
                defsElement.AppendChild(xml);
                svgWriter.Write(path, xml);

                textElement.AppendChild(defsElement);

                var textPathElement = textElement.OwnerDocument.CreateElement("textPath", XmlNamespace.Svg);
                textPathElement.SetAttribute("href", XmlNamespace.Xlink, "#" + path.ID);
                textPathElement.InnerText = Text;

                textElement.AppendChild(textPathElement);
            }
        }
Exemplo n.º 19
0
        public virtual void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber)
        {
            if (staffIsVisible)
            {
                w.WriteAttributeString("score", "staffName", null, this.Staffname);

                w.SvgStartGroup("stafflines", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString() + "stafflines");
                float stafflineY = this.Metrics.StafflinesTop;
                for (int staffLineIndex = 0; staffLineIndex < NumberOfStafflines; staffLineIndex++)
                {
                    w.SvgLine("staffline" + SvgScore.UniqueID_Number, this.Metrics.StafflinesLeft, stafflineY,
                              this.Metrics.StafflinesRight, stafflineY,
                              "black", StafflineStemStrokeWidth, null);

                    if (staffLineIndex < (NumberOfStafflines - 1))
                    {
                        stafflineY += Gap;
                    }
                }
                w.SvgEndGroup();
            }
            int voiceNumber = 1;

            foreach (Voice voice in Voices)
            {
                voice.WriteSVG(w, staffIsVisible, systemNumber, staffNumber, voiceNumber++);
            }
        }
Exemplo n.º 20
0
        private void WriteSystemsLayer(SvgWriter w, int pageNumber, MetadataWithDate metadataWithDate, bool graphicsOnly, bool printTitleAndAuthorOnScorePage1)
        {
            w.SvgStartGroup(CSSObjectClass.systems.ToString());

            w.SvgText(CSSObjectClass.timeStamp, _infoTextInfo.Text, 32, _infoTextInfo.FontHeight);

            if ((pageNumber == 1 || pageNumber == 0) && printTitleAndAuthorOnScorePage1)
            {
                WritePage1TitleAndAuthor(w, metadataWithDate);
            }

            List <CarryMsgs> carryMsgsPerChannel = new List <CarryMsgs>();

            foreach (Staff staff in Systems[0].Staves)
            {
                foreach (Voice voice in staff.Voices)
                {
                    carryMsgsPerChannel.Add(new CarryMsgs());
                }
            }

            int systemNumber = 1;

            foreach (SvgSystem system in Systems)
            {
                system.WriteSVG(w, systemNumber++, _pageFormat, carryMsgsPerChannel, graphicsOnly);
            }

            w.WriteEndElement();             // end layer
        }
Exemplo n.º 21
0
        public void Serialize(ICanvas canvas, Stream stream)
        {
            try
            {
                using (var storage = new TarArchive(stream, TarArchive.Mode.Create))
                {
                    var svgConverter = new SvgConverter(storage);

                    var svgDoc    = svgConverter.ToSvg(canvas);
                    var xmlDoc    = new XmlDocument();
                    var svgWriter = new SvgWriter(xmlDoc, new TypeResolver());
                    var svgXml    = svgWriter.CreateXmlElementFromSvg(svgDoc);
                    xmlDoc.AppendChild(svgXml);
                    svgWriter.Write(svgDoc, svgXml);

                    storage.WriteToStream(_canvasFileName, s => { xmlDoc.Save(s); });

                    storage.WriteToStream(Path.Combine(_iccFolder, _cmykProfileFileName), s => { canvas.CmykColorProfile.Save(s); });
                    storage.WriteToStream(Path.Combine(_iccFolder, _grayscaleProfileFileName), s => { canvas.GrayscaleColorProfile.Save(s); });
                    storage.WriteToStream(Path.Combine(_iccFolder, _rgbProfileFileName), s => { canvas.RgbColorProfile.Save(s); });
                }
                Console.WriteLine(stream);
            }
            catch (Exception ex)
            {
                Configuration.Logger.Error(Exceptions.CanNotSerializeCanvas, ex);

                throw new SerializationException(Exceptions.CanNotSerializeCanvas, ex);
            }
        }
Exemplo n.º 22
0
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            if (ChordMetrics.BeamBlock != null)
            {
                ChordMetrics.BeamBlock.WriteSVG(w);
            }

            w.SvgStartGroup("inputChord", "inputChord" + SvgScore.UniqueID_Number);

            Debug.Assert(_msDuration > 0);

            if (staffIsVisible)
            {
                w.WriteAttributeString("score", "alignmentX", null, ChordMetrics.OriginX.ToString(M.En_USNumberFormat));
            }
            w.WriteAttributeString("score", "msDuration", null, _msDuration.ToString());

            _inputChordDef.WriteSvg(w);

            w.SvgStartGroup(null, "graphics" + SvgScore.UniqueID_Number);
            ChordMetrics.WriteSVG(w);
            w.SvgEndGroup();

            w.SvgEndGroup();
        }
Exemplo n.º 23
0
 public override void WriteSVG(SvgWriter w)
 {
     if (_drawExtender)
     {
         w.SvgLine(CSSObjectClass, _left, _originY, _right, _originY);
     }
 }
Exemplo n.º 24
0
        public void ExportChord(int index, string outputDir, SvgWriter svgWriter)
        {
            if (index < 0 || index >= Count)
            {
                throw new ArgumentOutOfRangeException("index");
            }

            if (null == svgWriter)
            {
                throw new ArgumentNullException("svgWriter");
            }

            if (String.IsNullOrEmpty(outputDir))
            {
                outputDir = "./";
            }

            if (_lineItems[index] is Chord)
            {
                Chord  c       = (Chord)_lineItems[index];
                string svgText = c.ToSvg(GetOptionsForLine(index));

                string fileName = Path.Combine(outputDir, c.FileName + ".svg");

                svgWriter(svgText, fileName);
            }
        }
Exemplo n.º 25
0
        protected virtual void DrawRegionFrameConnector(SvgWriter w, FramedRegionInfoMetrics framedRegionInfoMetrics)
        {
            double x      = this.Metrics.OriginX;
            double top    = framedRegionInfoMetrics.Bottom;
            double bottom = this.Metrics.Top;

            w.SvgLine(CSSObjectClass.regionFrameConnector, x, top, x, bottom);
        }
Exemplo n.º 26
0
        protected void DrawDots(SvgWriter w, double topLineY, double gap, double dotsX)
        {
            double upperDotOriginY = topLineY + (gap * 1.5);
            double lowerDotOriginY = topLineY + (gap * 2.5);

            w.SvgText(CSSObjectClass.dot, ".", dotsX, upperDotOriginY);
            w.SvgText(CSSObjectClass.dot, ".", dotsX, lowerDotOriginY);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Writes a score:scoreData element
        /// </summary>
        /// <![CDATA[
        /// <score:scoreData>
        ///		<regions>
        ///			<defs>
        ///				<!--
        ///					Each name must be a(any) single character.
        ///				   The first regionDef must have startMsPos= "0".
        ///					"msPosFinalBarline" can be used to indicate the msPos of the final barline in the score.
        ///				-->
        ///				<regionDef class="regionDef" name="a" startMsPos="0" endMsPos="4447" />
        ///				<regionDef class="regionDef" name="b" startMsPos="1234" endMsPos="4447" />
        ///				<regionDef class="regionDef" name="c" startMsPos="2769" endMsPos="7338" />
        ///				<regionDef class="regionDef" name="d" startMsPos="2769" endMsPos="msPosFinalBarline" />
        ///			</defs>
        ///			<!-- Not all the defined regions have to be present in the sequence(d is missing here). -->
        ///			<regionSequence class="regionSequence" sequence="abcbd" />
        ///		</regions>
        ///	</score:scoreData>]]>
        public void WriteSVG(SvgWriter w)
        {
            w.WriteStartElement("score", "scoreData", null);

            RegionSequence.WriteSVG(w);

            w.WriteEndElement();             // end "score:scoreData"
        }
Exemplo n.º 28
0
        /// <summary>
        /// Writes out the stafflines, and noteObjects for an InputStaff.
        /// </summary>
        public override void WriteSVG(SvgWriter w, int systemNumber, int staffNumber)
        {
            w.SvgStartGroup("inputStaff", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString());

            base.WriteSVG(w, true, systemNumber, staffNumber);

            w.SvgEndGroup(); // InputStaff
        }
Exemplo n.º 29
0
        /// <summary>
        /// This function only writes the staff name and barnumber to the SVG file (if they are present).
        /// The barline itself is drawn when the system (and staff edges) is complete.
        /// </summary>
        public override void WriteSVG(SvgWriter w, bool staffIsVisible)
        {
            BarlineMetrics barlineMetrics = Metrics as BarlineMetrics;

            if (barlineMetrics != null && staffIsVisible)
            {
                barlineMetrics.WriteSVG(w);
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Writes this ClefChangeSymbol to the SVG file if both _isVisible is true.
 /// The character metrics have been set in SvgSystem.Justify()
 /// </summary>
 public override void WriteSVG(SvgWriter w, bool staffIsVisible)
 {
     if (_isVisible && staffIsVisible)
     {
         w.SvgStartGroup(null, "clefChange" + SvgScore.UniqueID_Number);
         base.WriteSVG(w, staffIsVisible);
         w.SvgEndGroup();
     }
 }
Exemplo n.º 31
0
        public void WritePolygon()
        {
            const string FileName = "SvgWriterTests_WritePolygon.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WritePolygon(
                        CreatePointList(),
                        w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2, LineStyleHelper.GetDashArray(LineStyle.Solid)));
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 32
0
        public void WriteLine()
        {
            const string FileName = "SvgWriterTests_WriteLine.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WriteLine(
                        new ScreenPoint(10, 10),
                        new ScreenPoint(150, 80),
                        w.CreateStyle(null, OxyColors.Black, 2, LineStyleHelper.GetDashArray(LineStyle.Solid)));
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 33
0
        public void WriteEllipse()
        {
            const string FileName = "SvgWriterTests_WriteEllipse.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WriteEllipse(
                        10,
                        10,
                        100,
                        60,
                        w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2, LineStyle.Solid.GetDashArray()));
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 34
0
        public void WriteImage()
        {
            const string FileName = "SvgWriterTests_WriteImage.svg";
            var image = CreateImage();
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 500, 300))
                {
                    for (int y = 0; y <= 200; y += 20)
                    {
                        w.WriteLine(new ScreenPoint(0, y), new ScreenPoint(400, y), w.CreateStyle(OxyColors.Undefined, OxyColors.Black, 1));
                    }

                    w.WriteImage(0, 0, 400, 200, image);
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 35
0
        public void WriteClippedEllipse()
        {
            const string FileName = "SvgWriterTests_WriteClippedEllipse.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WriteRectangle(5, 5, 95, 45, w.CreateStyle(OxyColors.LightGreen, OxyColors.Undefined, 0));
                    w.BeginClip(5, 5, 95, 45);
                    w.WriteEllipse(10, 10, 100, 60, w.CreateStyle(OxyColors.Blue, OxyColors.Black, 2));
                    w.EndClip();
                    w.Flush();
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 36
0
        public void WriteClippedImage()
        {
            const string FileName = "SvgWriterTests_WriteClippedImage.svg";
            var image = CreateImage();
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 400, 400))
                {
                    w.WriteImage(0, 0, 400, 200, image);
                    w.WriteRectangle(100, 50, 200, 100, w.CreateStyle(OxyColors.Undefined, OxyColors.Black, 1));
                    w.WriteImage(1, 0.5, 2, 1, 100, 250, 200, 100, image);
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 37
0
        public void WriteRectangle()
        {
            const string FileName = "SvgWriterTests_WriteRectangle.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WriteRectangle(
                        10,
                        20,
                        150,
                        80,
                        w.CreateStyle(
                            OxyColors.Green, OxyColors.Black, 2, LineStyleHelper.GetDashArray(LineStyle.Solid)));
                }
            }

            SvgAssert.IsValidFile(FileName);
        }
Exemplo n.º 38
0
        public void WriteText()
        {
            const string FileName = "SvgWriterTests_WriteText.svg";
            using (var s = File.Create(FileName))
            {
                using (var w = new SvgWriter(s, 200, 200))
                {
                    w.WriteText(new ScreenPoint(10, 10), "Hello world!", OxyColors.Black);
                }
            }

            SvgAssert.IsValidFile(FileName);
        }