internal void WriteSvg(SvgWriter w) { w.WriteStartElement("trkOn"); w.WriteAttributeString("midiChannel", _trkMidiChannel.ToString()); w.WriteAttributeString("msPosition", _trkMsPosition.ToString()); w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString()); if(_inputControls != null) { _inputControls.WriteSvg(w); } w.WriteEndElement(); // trkOn }
internal void WriteSvg(SvgWriter w) { w.WriteStartElement("trkRef"); w.WriteAttributeString("midiChannel", MidiChannel.ToString()); w.WriteAttributeString("msPosition", _trkMsPosition.ToString()); w.WriteAttributeString("nMidiObjects", _trkNumMidiObjects.ToString()); if(TrkOptions != null) { TrkOptions.WriteSvg(w, false); } w.WriteEndElement(); // trk }
public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber) { w.SvgStartGroup("outputVoice"); if(MasterVolume != null) // is non-null only in the first system { w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString()); w.WriteAttributeString("score", "masterVolume", null, MasterVolume.ToString()); } base.WriteSVG(w, staffIsVisible); w.SvgEndGroup(); // outputVoice }
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(); }
/// <summary> /// Writes out the (invisible) voices /// </summary> public override void WriteSVG(SvgWriter w, int systemNumber, int staffNumber) { w.SvgStartGroup("outputStaff"); w.WriteAttributeString("score", "invisible", null, "1"); int voiceNumber = 1; foreach(Voice voice in Voices) { voice.WriteSVG(w, false, systemNumber, staffNumber, voiceNumber++); } w.SvgEndGroup(); // outputStaff }
/// <summary> /// Writes out the noteObjects, and possibly the performanceOptions for an InputVoice. /// </summary> public override void WriteSVG(SvgWriter w, bool staffIsVisible, int systemNumber, int staffNumber, int voiceNumber) { w.SvgStartGroup("inputVoice", "sys" + systemNumber.ToString() + "staff" + staffNumber.ToString() + "voice" + voiceNumber.ToString()); if(_midiChannel < byte.MaxValue) { // This can only happen on the first system in the score. See SetMidiChannel(...) below. w.WriteAttributeString("score", "midiChannel", null, MidiChannel.ToString()); } base.WriteSVG(w, true); // input voices are always visible w.SvgEndGroup(); // inputVoice }
public override void WriteSVG(SvgWriter w, bool staffIsVisible) { if(LocalCautionaryChordDef == null) { w.SvgStartGroup("rest", "rest" + SvgScore.UniqueID_Number); Debug.Assert(_msDuration > 0); if(staffIsVisible) { w.WriteAttributeString("score", "alignmentX", null, ((Metrics.Left + Metrics.Right) / 2).ToString(M.En_USNumberFormat)); } w.WriteAttributeString("score", "msDuration", null, _msDuration.ToString()); if(this.Metrics != null && staffIsVisible) this.Metrics.WriteSVG(w); w.SvgEndGroup(); } }
internal void WriteSvg(SvgWriter w) { w.WriteStartElement("inputNote"); w.WriteAttributeString("notatedKey", _notatedMidiPitch.ToString()); if(TrkOptions != null) { TrkOptions.WriteSvg(w, false); } if(NoteOn != null) { NoteOn.WriteSvg(w); } if(NoteOff != null) { NoteOff.WriteSvg(w); } w.WriteEndElement(); // score:inputNote N.B. This element can be empty! }
public override void WriteSVG(SvgWriter w, bool staffIsVisible) { if(staffIsVisible && ChordMetrics.BeamBlock != null) ChordMetrics.BeamBlock.WriteSVG(w); w.SvgStartGroup("outputChord", "outputChord" + SvgScore.UniqueID_Number); if(staffIsVisible) { w.WriteAttributeString("score", "alignmentX", null, ChordMetrics.OriginX.ToString(M.En_USNumberFormat)); } _midiChordDef.WriteSvg(w); if(staffIsVisible) { w.SvgStartGroup(null, "graphics" + SvgScore.UniqueID_Number); ChordMetrics.WriteSVG(w); w.SvgEndGroup(); } w.SvgEndGroup(); }
public void WriteSvg(SvgWriter w, string elementName) { Debug.Assert((_pressureOption != CControllerType.undefined || _pressureVolumeOption == true) || (_modWheelOption != CControllerType.undefined || _modWheelVolumeOption == true) || (_pitchWheelOption != PitchWheelOption.undefined), "Attempt to write an empty TrackCCSettings element."); w.WriteStartElement(elementName); if(_midiChannel != null) { w.WriteAttributeString("midiChannel", _midiChannel.ToString()); } bool isControllingVolume = false; if(_pressureOption != CControllerType.undefined) { w.WriteAttributeString("pressure", _pressureOption.ToString()); } else if(_pressureVolumeOption == true) { w.WriteAttributeString("pressure", "volume"); WriteMaxMinVolume(w); isControllingVolume = true; } if(_pitchWheelOption != PitchWheelOption.undefined) { w.WriteAttributeString("pitchWheel", _pitchWheelOption.ToString()); switch(_pitchWheelOption) { case PitchWheelOption.pitch: //(range 0..127) Debug.Assert(_pitchWheelDeviationOption != null && _pitchWheelDeviationOption >= 0 && _pitchWheelDeviationOption <= 127); w.WriteAttributeString("pitchWheelDeviation", _pitchWheelDeviationOption.ToString()); break; case PitchWheelOption.pan: //(range 0..127, centre is 64) Debug.Assert(_panOriginOption != null && _panOriginOption >= 0 && _panOriginOption <= 127); w.WriteAttributeString("panOrigin", _panOriginOption.ToString()); break; case PitchWheelOption.speed: // maximum speed is when durations = durations / speedDeviation // minimum speed is when durations = durations * speedDeviation Debug.Assert(_speedDeviationOption != null && _speedDeviationOption >= 1); w.WriteAttributeString("speedDeviation", ((float)_speedDeviationOption).ToString(M.En_USNumberFormat)); break; } } if(_modWheelOption != CControllerType.undefined) { w.WriteAttributeString("modWheel", _modWheelOption.ToString()); } else if(_modWheelVolumeOption == true) { Debug.Assert(isControllingVolume == false, "Can't control volume with both pressure and modWheel."); w.WriteAttributeString("modWheel", "volume"); WriteMaxMinVolume(w); isControllingVolume = true; } w.WriteEndElement(); // "default" or "track" }
/// <summary> /// Only writes the Barline's barnumber to the SVG file. /// The barline itself is drawn when the system is complete. /// </summary> public override void WriteSVG(SvgWriter w) { if(_staffNameMetrics != null) { _staffNameMetrics.WriteSVG(w, "staffName"); } if(_barnumberMetrics != null) { w.WriteStartElement("g"); w.WriteAttributeString("class", "barNumber"); _barnumberMetrics.WriteSVG(w); // writes the number and the frame w.WriteEndElement(); // barnumber group } }
public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, int nOutputVoices) { string pageTitle; if (pageNumber == 0) { pageTitle = base.Title + " (scroll)"; } else { pageTitle = base.Title + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString(); } w.WriteStartElement("title"); w.WriteAttributeString("class", "pageTitle"); w.WriteString(pageTitle); w.WriteEndElement(); w.WriteStartElement(CSSObjectClass.metadata.ToString()); // Inkscape compatible w.WriteAttributeString("class", CSSObjectClass.metadata.ToString()); w.WriteStartElement("rdf", "RDF", null); w.WriteStartElement("cc", "Work", null); w.WriteAttributeString("rdf", "about", null, ""); w.WriteStartElement("dc", "format", null); w.WriteString("image/svg+xml"); w.WriteEndElement(); // ends the dc:format element w.WriteStartElement("dc", "type", null); w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage"); w.WriteEndElement(); // ends the dc:type element w.WriteStartElement("dc", "title", null); w.WriteString(pageTitle); w.WriteEndElement(); // ends the dc:title element w.WriteStartElement("dc", "date", null); w.WriteString(M.NowString); w.WriteEndElement(); // ends the dc:date element w.WriteStartElement("dc", "creator", null); w.WriteStartElement("cc", "Agent", null); w.WriteStartElement("dc", "title", null); w.WriteString("James Ingram"); w.WriteEndElement(); // ends the dc:title element w.WriteEndElement(); // ends the cc:Agent element w.WriteEndElement(); // ends the dc:creator element w.WriteStartElement("dc", "source", null); w.WriteString("Website: https://www.james-ingram-act-two.de"); w.WriteEndElement(); // ends the dc:source element if (!string.IsNullOrEmpty(Keywords)) { w.WriteStartElement("dc", "subject", null); w.WriteStartElement("rdf", "Bag", null); w.WriteStartElement("rdf", "li", null); w.WriteString(Keywords); w.WriteEndElement(); // ends the rdf:li element w.WriteEndElement(); // ends the rdf:Bag element w.WriteEndElement(); // ends the dc:subject element } StringBuilder desc = new StringBuilder(); if (pageNumber == 0) { desc.Append("\nNumber of pages in the score: 1"); } else { desc.Append("\nNumber of pages in the score: " + nScorePages.ToString()); } desc.Append("\nNumber of output voices: " + nOutputVoices.ToString()); if (!String.IsNullOrEmpty(Comment)) { desc.Append("\nComments: " + Comment); } w.WriteStartElement("dc", "description", null); w.WriteString(desc.ToString()); w.WriteEndElement(); // ends the dc:description element string contributor = "Originally created using Assistant Composer software:" + "\nhttps://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" + "\nAnnotations, if there are any, have been made using Inkscape."; w.WriteStartElement("dc", "contributor", null); w.WriteStartElement("cc", "Agent", null); w.WriteStartElement("dc", "title", null); w.WriteString(contributor); w.WriteEndElement(); // ends the dc:title element w.WriteEndElement(); // ends the cc:Agent element w.WriteEndElement(); // ends the dc:creator element w.WriteEndElement(); // ends the cc:Work element w.WriteEndElement(); // ends the rdf:RDF element w.WriteEndElement(); // ends the metadata element }
public void WriteSvg(SvgWriter w, bool writeScoreNamespace) { if(writeScoreNamespace) { w.WriteStartElement("score", "trkOptions", null); } else { w.WriteStartElement("trkOptions"); } if(_velocityOption != VelocityOption.inherit) { w.WriteAttributeString("velocity", _velocityOption.ToString()); if(_velocityOption != VelocityOption.undefined) { if(_minimumVelocity == null || _minimumVelocity < 1 || _minimumVelocity > 127) { Debug.Assert(false, "If the VelocityOption is being used, then\n" + "MinimumVelocity must be set to a value in range [1..127]"); } w.WriteAttributeString("minVelocity", _minimumVelocity.ToString()); } } if(PedalOption != PedalOption.inherit) { w.WriteAttributeString("pedal", PedalOption.ToString()); } if(SpeedOption > 0) { w.WriteAttributeString("speed", SpeedOption.ToString(M.En_USNumberFormat)); } if(TrkOffOption != TrkOffOption.inherit) { w.WriteAttributeString("trkOff", TrkOffOption.ToString()); } w.WriteEndElement(); // score:trkOptions }
public override void WriteSVG(SvgWriter w, bool staffIsVisible) { if(ChordMetrics.BeamBlock != null) ChordMetrics.BeamBlock.WriteSVG(w); w.SvgStartGroup("inputChord"); 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("graphics"); ChordMetrics.WriteSVG(w); w.SvgEndGroup(); w.SvgEndGroup(); }
private void WriteFontDefs(SvgWriter w) { string fontDefs = @" @font-face { font-family: 'CLicht'; src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot'); src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot?#iefix') format('embedded-opentype'), url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.woff') format('woff'), url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.ttf') format('truetype'), url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.svg#webfontl9D2oOyX') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'Arial'; src: url('http://james-ingram-act-two.de/fonts/arial.ttf') format('truetype'); font-weight:400; font-style: normal; } @font-face { font-family: 'Open Sans'; src: url('http://james-ingram-act-two.de/fonts/OpenSans-Regular.ttf') format('truetype'); font-weight:400; font-style: normal; } @font-face { font-family: 'Open Sans Condensed'; src: url('http://james-ingram-act-two.de/fonts/OpenSans-CondBold.ttf') format('truetype'); font-weight:600; font-style: normal; } "; w.WriteStartElement("style"); w.WriteAttributeString("type", "text/css"); w.WriteString(fontDefs); w.WriteEndElement(); }
public override void WriteSVG(SvgWriter w) { w.WriteStartElement("text"); w.WriteAttributeString("x", _originX.ToString(M.En_USNumberFormat)); w.WriteAttributeString("y", _originY.ToString(M.En_USNumberFormat)); w.WriteAttributeString("font-size", _fontHeight.ToString(M.En_USNumberFormat)); w.WriteAttributeString("font-family", "CLicht"); if(! string.IsNullOrEmpty(_colorAttribute)) { w.WriteAttributeString("fill", _colorAttribute); } switch(_textHorizAlign) { case TextHorizAlign.left: break; case TextHorizAlign.center: w.WriteAttributeString("text-anchor", "middle"); break; case TextHorizAlign.right: w.WriteAttributeString("text-anchor", "end"); break; } w.WriteString(_objectType); // e.g. Unicode character w.WriteEndElement(); }
private void WriteSvgHeader(SvgWriter w) { w.WriteAttributeString("xmlns", "http://www.w3.org/2000/svg"); w.WriteAttributeString("xmlns", "score", null, "http://www.james-ingram-act-two.de/open-source/svgScoreExtensions.html"); w.WriteAttributeString("xmlns", "dc", null, "http://purl.org/dc/elements/1.1/"); w.WriteAttributeString("xmlns", "cc", null, "http://creativecommons.org/ns#"); w.WriteAttributeString("xmlns", "rdf", null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); w.WriteAttributeString("xmlns", "svg", null, "http://www.w3.org/2000/svg"); w.WriteAttributeString("xmlns", "xlink", null, "http://www.w3.org/1999/xlink"); w.WriteAttributeString("xmlns", "sodipodi", null, "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"); w.WriteAttributeString("xmlns", "inkscape", null, "http://www.inkscape.org/namespaces/inkscape"); w.WriteAttributeString("version", "1.1"); // The following data-scoreType attribute has been included because I think that all files that could be used as // input for client applications should document their structure with this (standardized) svg attribute. // The value happens here to be the same as for the "score" namespace above, but that is not necessarily so. // The value is not checked by the Assistant Performer, because I know that the AP only plays scores that I give it. // However, theoretically, anyone could write an app that uses this file, and they would need to be told the format // in this standardized attribute. w.WriteAttributeString("data-scoreType", null, "http://www.james-ingram-act-two.de/open-source/svgScoreExtensions.html"); w.WriteAttributeString("width", _pageFormat.ScreenRight.ToString()); // the intended screen display size (100%) w.WriteAttributeString("height", _pageFormat.ScreenBottom.ToString()); // the intended screen display size (100%) string viewBox = "0 0 " + _pageFormat.RightVBPX.ToString() + " " + _pageFormat.BottomVBPX.ToString(); w.WriteAttributeString("viewBox", viewBox); // the size of SVG's internal drawing surface (800%) }
/// <summary> /// The presence of this element means that Inkscape opens the file at full screen size /// with level2, the annotations, selected. /// </summary> /// <param name="w"></param> private void WriteSodipodiNamedview(SvgWriter w) { string scoreLayerID = "layer2"; w.WriteStartElement("sodipodi", "namedview", null); w.WriteAttributeString("inkscape", "window-maximized", null, "1"); w.WriteAttributeString("inkscape", "current-layer", null, scoreLayerID); w.WriteEndElement(); // ends the sodipodi:namedview element }
private void WritePageSizedLayer(SvgWriter w, int layerNumber, string layerName, float width, float height, string style) { w.WriteStartElement("g"); // start layer (for Inkscape) WriteInkscapeLayerAttributes(w, layerNumber, layerName, true); w.WriteStartElement("rect"); w.WriteAttributeString("x", "0"); w.WriteAttributeString("y", "0"); w.WriteAttributeString("width", width.ToString(M.En_USNumberFormat)); w.WriteAttributeString("height", height.ToString(M.En_USNumberFormat)); w.WriteAttributeString("style", style); w.WriteEndElement(); // rect w.WriteEndElement(); // end layer2 (for Inkscape) }
/// <summary> /// writes the following attributes: /// inkscape:groupmode="layer" /// id="layer1" /// inkscape:label="moritz" /// style="display:inline" /// sodipodi:insensitive="true" /// </summary> /// <param name="w"></param> private void WriteInkscapeLayerAttributes(SvgWriter w, int layerNumber, String layerName, bool insensitive ) { //w.WriteAttributeString("score", "staffName", null, this.Staffname); w.WriteAttributeString("inkscape", "groupmode", null, "layer"); w.WriteAttributeString("id", "layer" + layerNumber.ToString()); w.WriteAttributeString("inkscape", "label", null, layerName); w.WriteAttributeString("style", "display:inline"); if(insensitive == true) w.WriteAttributeString("sodipodi", "insensitive", null, "true"); }
/// <summary> /// Adds the link, main title and the author to the first page. /// </summary> protected void WritePage1TitleAndAuthor(SvgWriter w, Metadata metadata) { string titlesFontFamily = "Open Sans"; TextInfo titleInfo = new TextInfo(metadata.MainTitle, titlesFontFamily, _pageFormat.Page1TitleHeight, null, TextHorizAlign.center); TextInfo authorInfo = new TextInfo(metadata.Author, titlesFontFamily, _pageFormat.Page1AuthorHeight, null, TextHorizAlign.right); w.WriteStartElement("g"); w.WriteAttributeString("id", "titles"); w.SvgText("mainTitle", titleInfo, _pageFormat.Right / 2F, _pageFormat.Page1TitleY); w.SvgText("author", authorInfo, _pageFormat.RightMarginPos, _pageFormat.Page1TitleY); w.WriteEndElement(); // group }
private void WriteMaxMinVolume(SvgWriter w) { if(_maximumVolume == null || _minimumVolume == null) { Debug.Assert(false, "If any of the continuous controllers is set to control the *volume*,\n" + "then both MaximumVolume and MinimumVolume must also be set.\n\n" + "Use either the PressureVolume(...) or ModWheelVolume(...) constructor."); } if(_maximumVolume <= _minimumVolume) { Debug.Assert(false, "MaximumVolume must be greater than MinimumVolume."); } w.WriteAttributeString("maxVolume", _maximumVolume.ToString()); w.WriteAttributeString("minVolume", _minimumVolume.ToString()); }
/// <summary> /// Note that, unlike Rests, MidiChordDefs do not have a msDuration attribute. /// Their msDuration is deduced from the contained BasicMidiChords. /// Patch indices already set in the BasicMidiChordDefs take priority over those set in the main MidiChordDef. /// However, if BasicMidiChordDefs[0].PatchIndex is null, and this.Patch is set, BasicMidiChordDefs[0].PatchIndex is set to Patch. /// The same is true for Bank settings. /// The AssistantPerformer therefore only needs to look at BasicMidiChordDefs to find Bank and Patch changes. /// While constructing Tracks, the AssistantPerformer should monitor the current Bank and/or Patch, so that it can decide /// whether or not to actually construct and send bank and/or patch change messages. /// </summary> public void WriteSvg(SvgWriter w) { w.WriteStartElement("score", "midiChord", null); Debug.Assert(BasicMidiChordDefs != null && BasicMidiChordDefs.Count > 0); if(BasicMidiChordDefs[0].BankIndex == null && Bank != null) { BasicMidiChordDefs[0].BankIndex = Bank; } if(BasicMidiChordDefs[0].PatchIndex == null && Patch != null) { BasicMidiChordDefs[0].PatchIndex = Patch; } if(HasChordOff == false) w.WriteAttributeString("hasChordOff", "0"); if(PitchWheelDeviation != null && PitchWheelDeviation != M.DefaultPitchWheelDeviation) w.WriteAttributeString("pitchWheelDeviation", PitchWheelDeviation.ToString()); if(MinimumBasicMidiChordMsDuration != M.DefaultMinimumBasicMidiChordMsDuration) w.WriteAttributeString("minBasicChordMsDuration", MinimumBasicMidiChordMsDuration.ToString()); w.WriteStartElement("basicChords"); foreach(BasicMidiChordDef basicMidiChord in BasicMidiChordDefs) // containing basic <midiChord> elements basicMidiChord.WriteSVG(w); w.WriteEndElement(); if(MidiChordSliderDefs != null) MidiChordSliderDefs.WriteSVG(w); // writes sliders element w.WriteEndElement(); // score:midiChord }
/// <summary> /// [g id="bassClef8"] /// [text x="0" y="0" font-size="1px" font-family="CLicht"]?[/text] /// [text x="0.16" y="1.1" font-size="0.67px" font-family="CLicht"]•[/text] /// [/g] /// </summary> private void WriteBassClef8SymbolDef(SvgWriter svgw) { svgw.WriteStartElement("g"); svgw.WriteAttributeString("id", "bassClef8"); svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0"); svgw.WriteAttributeString("y", "0"); svgw.WriteAttributeString("font-size", "1px"); svgw.WriteAttributeString("font-family", "CLicht"); svgw.WriteString("?"); svgw.WriteEndElement(); // text svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0.16"); svgw.WriteAttributeString("y", "1.1"); svgw.WriteAttributeString("font-size", "0.67px"); svgw.WriteAttributeString("font-family", "CLicht"); svgw.WriteString("•"); svgw.WriteEndElement(); // text svgw.WriteEndElement(); // g }
/// <summary> /// Writes a metadata element compatible with Inkscape's /// </summary> /// <param name="w"></param> /// <param name="pageNumber"></param> /// <param name="nScorePages"></param> public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, string aboutThePieceLinkURL, int nOutputVoices, int nInputVoices) { Debug.Assert(!String.IsNullOrEmpty(MainTitle)); string pageTitle; if(pageNumber == 0) { pageTitle = MainTitle + " (scroll)"; } else { pageTitle = MainTitle + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString(); } w.WriteStartElement("title"); w.WriteAttributeString("id", "pageTitle"); w.WriteString(pageTitle); w.WriteEndElement(); w.WriteStartElement("metadata"); // Inkscape compatible w.WriteAttributeString("id", "metadata"); w.WriteStartElement("rdf", "RDF", null); w.WriteStartElement("cc", "Work", null); w.WriteAttributeString("rdf", "about", null, ""); w.WriteStartElement("dc", "format", null); w.WriteString("image/svg+xml"); w.WriteEndElement(); // ends the dc:format element w.WriteStartElement("dc", "type", null); w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage"); w.WriteEndElement(); // ends the dc:type element w.WriteStartElement("dc", "title", null); w.WriteString(pageTitle); w.WriteEndElement(); // ends the dc:title element w.WriteStartElement("dc", "date", null); w.WriteString(M.NowString); w.WriteEndElement(); // ends the dc:date element w.WriteStartElement("dc", "creator", null); w.WriteStartElement("cc", "Agent", null); w.WriteStartElement("dc", "title", null); w.WriteString("James Ingram"); w.WriteEndElement(); // ends the dc:title element w.WriteEndElement(); // ends the cc:Agent element w.WriteEndElement(); // ends the dc:creator element w.WriteStartElement("dc", "source", null); w.WriteString("Website: http://www.james-ingram-act-two.de"); w.WriteEndElement(); // ends the dc:source element if(!string.IsNullOrEmpty(Keywords)) { w.WriteStartElement("dc", "subject", null); w.WriteStartElement("rdf", "Bag", null); w.WriteStartElement("rdf", "li", null); w.WriteString(Keywords); w.WriteEndElement(); // ends the rdf:li element w.WriteEndElement(); // ends the rdf:Bag element w.WriteEndElement(); // ends the dc:subject element } StringBuilder desc = new StringBuilder("About: " + aboutThePieceLinkURL ); if(pageNumber == 0) { desc.Append("\nNumber of pages in the score: 1"); } else { desc.Append("\nNumber of pages in the score: " + nScorePages.ToString()); } desc.Append("\nNumber of output voices: " + nOutputVoices.ToString()); desc.Append("\nNumber of input voices: " + nInputVoices.ToString()); if(!String.IsNullOrEmpty(Comment)) desc.Append("\nComments: " + Comment); w.WriteStartElement("dc", "description", null); w.WriteString(desc.ToString()); w.WriteEndElement(); // ends the dc:description element string contributor = "Originally created using Assistant Composer software:" + "\nhttp://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" + "\nAnnotations, if there are any, have been made using Inkscape."; w.WriteStartElement("dc", "contributor", null); w.WriteStartElement("cc", "Agent", null); w.WriteStartElement("dc", "title", null); w.WriteString(contributor); w.WriteEndElement(); // ends the dc:title element w.WriteEndElement(); // ends the cc:Agent element w.WriteEndElement(); // ends the dc:creator element w.WriteEndElement(); // ends the cc:Work element w.WriteEndElement(); // ends the rdf:RDF element w.WriteEndElement(); // ends the metadata element }
/// <summary> /// (the actual numbers have changed -- see function below) /// [g id="trebleClef2x8"] /// [text x="0" y="0" font-size="1px" font-family="CLicht"]&[/text] /// [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]™[/text] /// [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text] /// [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text] /// [/g] /// and /// [g id="trebleClef3x8"] /// [text x="0" y="0" font-size="1px" font-family="CLicht"]&[/text] /// [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]£[/text] /// [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text] /// [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text] /// [/g] /// </summary> private void WriteTrebleClefMulti8SymbolDef(SvgWriter svgw, int octaveShift) { svgw.WriteStartElement("g"); svgw.WriteAttributeString("id", "trebleClef" + octaveShift.ToString() + "x8"); svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0"); svgw.WriteAttributeString("y", "0"); svgw.WriteAttributeString("font-size", "1px"); svgw.WriteAttributeString("font-family", "CLicht"); svgw.WriteString("&"); svgw.WriteEndElement(); // text svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0.036"); svgw.WriteAttributeString("y", "-1.17"); svgw.WriteAttributeString("font-size", "0.67px"); svgw.WriteAttributeString("font-family", "CLicht"); switch(octaveShift) { case 2: svgw.WriteString("™"); break; case 3: svgw.WriteString("£"); break; } svgw.WriteEndElement(); // text svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0.252"); svgw.WriteAttributeString("y", "-1.17"); svgw.WriteAttributeString("font-size", "0.4px"); svgw.WriteAttributeString("font-family", "Arial"); svgw.WriteString("x"); svgw.WriteEndElement(); // text svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0.48"); svgw.WriteAttributeString("y", "-1.17"); svgw.WriteAttributeString("font-size", "0.67px"); svgw.WriteAttributeString("font-family", "CLicht"); svgw.WriteString("•"); svgw.WriteEndElement(); // text svgw.WriteEndElement(); // g }
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! }
/// <summary> /// [g id="trebleClef"] /// [text x="0" y="0" font-size="1px" font-family="CLicht"] & [/text] /// [/g] /// </summary> private void WriteTrebleClefSymbolDef(SvgWriter svgw) { svgw.WriteStartElement("g"); svgw.WriteAttributeString("id", "trebleClef"); svgw.WriteStartElement("text"); svgw.WriteAttributeString("x", "0"); svgw.WriteAttributeString("y", "0"); svgw.WriteAttributeString("font-size", "1px"); svgw.WriteAttributeString("font-family", "CLicht"); svgw.WriteString("&"); svgw.WriteEndElement(); // text svgw.WriteEndElement(); // g }
protected void WriteSvg(SvgWriter w, string elementName) { w.WriteStartElement(elementName); // "noteOn" or "noteOff" if(_trkOptions != null) { _trkOptions.WriteSvg(w, false); } if(_seqRef != null) { _seqRef.WriteSvg(w); } if(_trkOffs != null && _trkOffs.Count > 0) { StringBuilder sb = new StringBuilder(); foreach(int midiChannel in _trkOffs) { sb.Append(midiChannel); sb.Append(' '); } sb.Remove(sb.Length - 1, 1); w.WriteStartElement("trkOffs"); w.WriteAttributeString("midiChannels", sb.ToString()); w.WriteEndElement(); // trkOffs } w.WriteEndElement(); // noteOn or noteOff }
private void WriteSvgHeader(SvgWriter w) { w.WriteAttributeString("xmlns", "http://www.w3.org/2000/svg"); w.WriteAttributeString("xmlns", "score", null, "http://www.james-ingram-act-two.de/open-source/svgScoreExtensions.html"); w.WriteAttributeString("xmlns", "dc", null, "http://purl.org/dc/elements/1.1/"); w.WriteAttributeString("xmlns", "cc", null, "http://creativecommons.org/ns#"); w.WriteAttributeString("xmlns", "rdf", null, "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); w.WriteAttributeString("xmlns", "svg", null, "http://www.w3.org/2000/svg"); w.WriteAttributeString("xmlns", "xlink", null, "http://www.w3.org/1999/xlink"); w.WriteAttributeString("xmlns", "sodipodi", null, "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"); w.WriteAttributeString("xmlns", "inkscape", null, "http://www.inkscape.org/namespaces/inkscape"); w.WriteAttributeString("version", "1.1"); //w.WriteAttributeString("baseProfile", "full"); w.WriteAttributeString("width", _pageFormat.ScreenRight.ToString()); // the intended screen display size (100%) w.WriteAttributeString("height", _pageFormat.ScreenBottom.ToString()); // the intended screen display size (100%) string viewBox = "0 0 " + _pageFormat.RightVBPX.ToString() + " " + _pageFormat.BottomVBPX.ToString(); w.WriteAttributeString("viewBox", viewBox); // the size of SVG's internal drawing surface (800%) }