8 #ifndef __VRV_RENDERER_H__
9 #define __VRV_RENDERER_H__
13 #include "devicecontextbase.h"
15 #include "textelement.h"
38 class EditorialElement;
44 class FloatingCurvePositioner;
70 class PitchInflection;
87 class TextDrawingParams;
89 class TextLayoutElement;
100 enum class SlurHandling { Ignore, Initialize, Drawing };
135 int ToDeviceContextX(
int i);
136 int ToLogicalX(
int i);
137 int ToDeviceContextY(
int i);
138 int ToLogicalY(
int i);
171 int CalculatePitchCode(
Layer *layer,
int y_n,
int x_pos,
int *octave);
179 void SetSlurHandling(SlurHandling slurHandling) {
m_slurHandling = slurHandling; }
189 void DrawPageElement(DeviceContext *dc, PageElement *element);
190 void DrawSystem(DeviceContext *dc, System *system);
191 void DrawSystemList(DeviceContext *dc, System *system,
const ClassId classId);
192 void DrawScoreDef(DeviceContext *dc, ScoreDef *scoreDef, Measure *measure,
int x, BarLine *barLine = NULL,
193 bool isLastMeasure =
false,
bool isLastSystem =
false,
bool noLabels =
false);
194 void DrawStaffGrp(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp,
int x,
bool topStaffGrp =
false,
195 ScoreDefDrawingLabels drawingLabels = DRAWING_LABEL_ABBR);
196 void DrawStaffDef(DeviceContext *dc, Staff *staff, Measure *measure);
197 void DrawStaffDefCautionary(DeviceContext *dc, Staff *staff, Measure *measure);
198 void DrawStaffDefLabels(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp,
int x,
bool abbreviations =
false);
199 void DrawGrpSym(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp,
int &x);
200 void DrawLabels(DeviceContext *dc, ScoreDef *scoreDef, Object *
object,
int x,
int y,
bool abbreviations,
201 int staffSize,
int space);
202 void DrawBracket(DeviceContext *dc,
int x,
int y1,
int y2,
int staffSize);
203 void DrawBracketSq(DeviceContext *dc,
int x,
int y1,
int y2,
int staffSize);
204 void DrawBrace(DeviceContext *dc,
int x,
int y1,
int y2,
int staffSize,
bool forceGlyph =
false);
205 void DrawBarLines(DeviceContext *dc, Measure *measure, StaffGrp *staffGrp, BarLine *barLine,
bool isLastMeasure,
206 bool isLastSystem,
int &yBottomPrevious);
207 void DrawBarLine(DeviceContext *dc,
int yTop,
int yBottom, BarLine *barLine, data_BARRENDITION form,
208 bool inStaffSpace =
false,
bool eraseIntersections =
false);
209 void DrawBarLineDots(DeviceContext *dc, Staff *staff, BarLine *barLine);
210 void DrawLedgerLines(DeviceContext *dc, Staff *staff,
const ArrayOfLedgerLines &lines,
bool below,
bool cueSize);
211 void DrawMeasure(DeviceContext *dc, Measure *measure, System *system);
212 void DrawMeterSigGrp(DeviceContext *dc, Layer *layer, Staff *staff);
213 void DrawMNum(DeviceContext *dc, MNum *mnum, Measure *measure, System *system,
int yOffset);
214 void DrawOssia(DeviceContext *dc, Ossia *ossia, Measure *measure, System *system);
215 void DrawStaff(DeviceContext *dc, Staff *staff, Measure *measure, System *system);
216 void DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, Measure *measure, System *system);
217 void DrawLayer(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure);
218 void DrawCursor(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
219 void DrawLayerList(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure,
const ClassId classId);
220 void DrawLayerDefLabels(
221 DeviceContext *dc, ScoreDef *scoreDef, Staff *staff, StaffDef *staffDef,
int x,
bool abbreviations =
false);
222 void DrawSystemDivider(DeviceContext *dc, System *system, Measure *firstMeasure);
230 void DrawDiv(DeviceContext *dc, Div *div, System *system);
231 void DrawRunningElements(DeviceContext *dc, Page *page);
232 void DrawTextLayoutElement(DeviceContext *dc, TextLayoutElement *textLayoutElement);
244 void DrawSystemChildren(DeviceContext *dc, Object *parent, System *system);
245 void DrawMeasureChildren(DeviceContext *dc, Object *parent, Measure *measure, System *system);
246 void DrawStaffChildren(DeviceContext *dc, Object *parent, Staff *staff, Measure *measure);
247 void DrawLayerChildren(DeviceContext *dc, Object *parent, Layer *layer, Staff *staff, Measure *measure);
248 void DrawTextChildren(DeviceContext *dc, Object *parent, TextDrawingParams ¶ms);
249 void DrawFbChildren(DeviceContext *dc, Object *parent, TextDrawingParams ¶ms);
250 void DrawRunningChildren(DeviceContext *dc, Object *parent, TextDrawingParams ¶ms);
258 void DrawSystemEditorialElement(DeviceContext *dc, EditorialElement *element, System *system);
259 void DrawMeasureEditorialElement(DeviceContext *dc, EditorialElement *element, Measure *measure, System *system);
260 void DrawStaffEditorialElement(DeviceContext *dc, EditorialElement *element, Staff *staff, Measure *measure);
261 void DrawLayerEditorialElement(
262 DeviceContext *dc, EditorialElement *element, Layer *layer, Staff *staff, Measure *measure);
263 void DrawTextEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams ¶ms);
264 void DrawFbEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams ¶ms);
265 void DrawRunningEditorialElement(DeviceContext *dc, EditorialElement *element, TextDrawingParams ¶ms);
273 void DrawAnnot(DeviceContext *dc, EditorialElement *element,
bool isTextElement =
false);
283 void DrawLayerElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
294 void DrawAccid(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
295 void DrawArtic(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
296 void DrawBarLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
297 void DrawBeatRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
298 void DrawBTrem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
299 void DrawChord(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
300 void DrawClef(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
301 void DrawCustos(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
302 void DrawDot(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
303 void DrawDots(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
304 void DrawDurationElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
305 void DrawFlag(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
306 void DrawGenericLayerElement(
307 DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
308 void DrawGraceGrp(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
309 void DrawHalfmRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
310 void DrawKeySig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
311 void DrawLigature(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
312 void DrawMeterSig(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
313 void DrawMRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
314 void DrawMRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
315 void DrawMRpt2(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
316 void DrawMSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
317 void DrawMultiRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
318 void DrawMultiRpt(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
319 void DrawNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
320 void DrawRest(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
321 void DrawSpace(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
322 void DrawStem(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
323 void DrawStemMod(DeviceContext *dc, LayerElement *element, Staff *staff);
324 void DrawSyl(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
325 void DrawTuplet(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
326 void DrawVolta(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
327 void DrawLyricElement(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
337 void DrawAcciaccaturaSlash(DeviceContext *dc, Stem *stem, Staff *staff);
338 void DrawChordCluster(DeviceContext *dc, Chord *chord, Layer *layer, Staff *staff, Measure *measure);
339 void DrawClefEnclosing(DeviceContext *dc, Clef *clef, Staff *staff, char32_t glyph,
int x,
int y);
340 void DrawDotsPart(DeviceContext *dc,
int x,
int y,
unsigned char dots,
const Staff *staff,
bool dimin =
false);
341 void DrawKeySigCancellation(
342 DeviceContext *dc, KeySig *keySig, Staff *staff, Clef *clef,
int clefLocOffset,
int beginCancel,
int &x);
343 void DrawKeyAccid(DeviceContext *dc, KeyAccid *keyAccid, Staff *staff, Clef *clef,
int clefLocOffset,
int &x);
344 void DrawMeterSig(DeviceContext *dc, MeterSig *meterSig, Staff *staff,
int horizOffset);
347 void DrawMRptPart(
DeviceContext *dc,
int xCentered,
int y, char32_t smulfCode,
int num,
bool line,
Staff *staff);
432 void DrawArpegEnclosing(
DeviceContext *dc,
Arpeg *arpeg,
Staff *staff, char32_t startGlyph, char32_t fillGlyph,
433 char32_t endGlyph,
int x,
int y,
int height,
bool cueSize);
458 char spanningType,
Object *graphic = NULL);
474 char spanningType,
Object *graphic = NULL);
478 void DrawTrillExtension(
480 void DrawSylConnector(
521 void DrawMensuralStem(
DeviceContext *dc,
Note *note,
Staff *staff, data_STEMDIRECTION dir,
int xn,
int originY);
523 void DrawProportFigures(
DeviceContext *dc,
int x,
int y,
int num,
int numBase,
Staff *staff);
554 void DrawVerticalLine(
DeviceContext *dc,
int y1,
int y2,
int x1,
int width,
int dashLength = 0,
int gapLength = 0);
555 void DrawHorizontalLine(
556 DeviceContext *dc,
int x1,
int x2,
int y1,
int width,
int dashLength = 0,
int gapLength = 0);
557 void DrawObliqueLine(
558 DeviceContext *dc,
int x1,
int x2,
int y1,
int y2,
int width,
int dashLength = 0,
int gapLength = 0);
559 void DrawVerticalSegmentedLine(
561 void DrawHorizontalSegmentedLine(
564 DeviceContext *dc,
int x,
int y, char32_t code,
int staffSize,
bool dimin,
bool setBBGlyph =
false);
568 void DrawThickBezierCurve(
569 DeviceContext *dc,
Point bezier[4],
int thickness,
int staffSize,
int penWidth, PenStyle penStyle = PEN_SOLID);
574 void DrawSmuflLine(
DeviceContext *dc,
Point orig,
int length,
int staffSize,
bool dimin, char32_t fill,
575 char32_t start = 0, char32_t end = 0);
576 void DrawSmuflString(
DeviceContext *dc,
int x,
int y, std::u32string s, data_HORIZONTALALIGNMENT alignment,
577 int staffSize = 100,
bool dimin =
false,
bool setBBGlyph =
false);
578 void DrawLyricString(
DeviceContext *dc,
const std::u32string &str,
int staffSize = 100,
579 std::optional<TextDrawingParams> params = std::nullopt);
580 void DrawNotFilledEllipse(
DeviceContext *dc,
int x1,
int y1,
int x2,
int y2,
int lineThinkness);
581 void DrawFilledRectangle(
DeviceContext *dc,
int x1,
int y1,
int x2,
int y2);
582 void DrawNotFilledRectangle(
DeviceContext *dc,
int x1,
int y1,
int x2,
int y2,
int lineThinkness,
int radius);
583 void DrawFilledRoundedRectangle(
DeviceContext *dc,
int x1,
int y1,
int x2,
int y2,
int radius);
584 void DrawObliquePolygon(
DeviceContext *dc,
int x1,
int y1,
int x2,
int y2,
int height);
585 void DrawDiamond(
DeviceContext *dc,
int x1,
int y1,
int height,
int width,
bool fill,
int linewidth);
586 void DrawDot(
DeviceContext *dc,
int x,
int y,
int staffSize,
bool dimin =
false);
587 void DrawSquareBracket(
DeviceContext *dc,
bool leftBracket,
int x,
int y,
int height,
int width,
588 int horizontalThickness,
int verticalThickness);
589 void DrawEnclosingBrackets(
DeviceContext *dc,
int x,
int y,
int height,
int width,
int offset,
int bracketWidth,
590 int horizontalThickness,
int verticalThickness);
593 data_HORIZONTALALIGNMENT alignement = HORIZONTALALIGNMENT_left);
609 std::u32string IntToTupletFigures(
unsigned short number);
610 std::u32string IntToTimeSigFigures(
unsigned short number);
611 std::u32string IntToSmuflFigures(
unsigned short number,
int offset);
612 int NestedTuplets(
Object *
object);
613 int GetSylYRel(
int verseN,
Staff *staff, data_STAFFREL place,
int voltaN = 1);
614 int GetFYRel(
F *f,
Staff *staff);
628 void CalcBrevisPoints(
629 Note *note,
Staff *staff,
Point *topLeft,
Point *bottomRight,
int sides[4],
int shape,
bool isMensuralBlack);
630 void CalcObliquePoints(
Note *note1,
Note *note2,
Staff *staff,
Point points[4],
int sides[4],
int shape,
631 bool isMensuralBlack,
bool firstHalf,
bool straight);
637 void DrawBeamSegment(
650 data_STEMDIRECTION GetMensuralStemDir(
Layer *layer,
Note *note,
int verticalCenter);
660 void SetOffsetStaffSize(
const Object *
object,
int staffSize);
671 void CalcOffsetSpanningStartX(
DeviceContext *dc,
int &x,
char spanningType,
double factor = 1.0);
672 void CalcOffsetSpanningEndX(
DeviceContext *dc,
int &x,
char spanningType,
double factor = 1.0);
673 void CalcOffsetSpanningStartY(
DeviceContext *dc,
int &y,
char spanningType,
double factor = 1.0);
674 void CalcOffsetSpanningEndY(
DeviceContext *dc,
int &y,
char spanningType,
double factor = 1.0);
689 const Object *m_object = NULL;
690 int m_staffSize = 100;
729 int ConvertFontSizeNumeric(
const data_FONTSIZE &fontSize,
int staffSize)
const;
736 static int ConvertFontPointSize(
double pointSize);
740 static thread_local
int s_drawingLigX[2], s_drawingLigY[2];
741 static thread_local
bool s_drawingLigObliqua;
745 std::list<Offset> m_currentOffsets;
This class models the MEI <annot> element where @type is score.
Definition: annotscore.h:24
This class models the MEI <arpeg> element.
Definition: arpeg.h:31
This class is an interface for MEI beam elements (beam, beamSpan).
Definition: drawinginterface.h:98
Class for storing drawing parameters when calculating beams.
Definition: beam.h:36
This class models the MEI <beamSpan> element.
Definition: beamspan.h:36
This class models the MEI <bracketSpan> element.
Definition: bracketspan.h:28
This class models the MEI <breath> element.
Definition: breath.h:24
This class models the MEI <caesura> element.
Definition: caesura.h:29
This class represents elements appearing within a measure.
Definition: controlelement.h:35
This class is an abstract device context.
Definition: devicecontext.h:57
This class is a hold the data and corresponds to the model of a MVC design pattern.
Definition: doc.h:41
This class represents a MEI ending.
Definition: ending.h:33
This class models the MEI <f> element.
Definition: f.h:24
This class models the MEI <fTrem> element.
Definition: ftrem.h:25
This class models the MEI <fb> element.
Definition: fb.h:23
This class models the MEI <fermata> element.
Definition: fermata.h:32
This class models the MEI <fig> element.
Definition: fig.h:23
This class models the MEI <fing> element.
Definition: fing.h:25
This class represents a basic object for a curve (slur, tie) in the layout domain.
Definition: floatingobject.h:329
This class models the MEI <gliss> element.
Definition: gliss.h:28
Implements the graphic element in MEI.
Definition: graphic.h:30
This class models the MEI <hairpin> element.
Definition: hairpin.h:32
This class models the MEI <harm> element.
Definition: harm.h:32
This class is a base class for the Layer (<layer>) content.
Definition: layerelement.h:51
This class represents a layer in a laid-out score (Doc).
Definition: layer.h:40
This class models the MEI <lb>
Definition: lb.h:23
This class represents a measure in a page-based score (Doc).
Definition: measure.h:46
This class models the MEI <meterSig> element.
Definition: metersig.h:34
This class models the MEI <mordent> element.
Definition: mordent.h:33
This class models the MEI <nc> element.
Definition: nc.h:43
This class models the MEI <note> element.
Definition: note.h:69
This class models the MEI <num> element.
Definition: num.h:24
This class represents a basic object.
Definition: object.h:66
This class models the MEI <octave> element.
Definition: octave.h:31
This class contains the document styling parameters.
Definition: options.h:580
This class represents a page in a laid-out score (Doc).
Definition: page.h:31
This class models the MEI <pedal> element.
Definition: pedal.h:34
This class models the MEI <dir> element.
Definition: pitchinflection.h:23
Simple class for representing points.
Definition: devicecontextbase.h:203
This class models the MEI <reh> element.
Definition: reh.h:30
This class models the MEI <rend> element.
Definition: rend.h:33
This class models the MEI <ornam> element.
Definition: repeatmark.h:32
This class represents a MEI scoreDef.
Definition: scoredef.h:136
Definition: boundingbox.h:340
This class represents a staff in a laid-out score (Doc).
Definition: staff.h:110
Syl is a TimeSpanningInterface for managing syllable connectors.
Definition: syl.h:38
Definition: symboldef.h:20
This class models the MEI <symbol> element.
Definition: symbol.h:25
This class represents elements appearing within a measure.
Definition: systemelement.h:26
This class represents a system in a laid-out score (Doc).
Definition: system.h:36
This class is an interface for <tempo> elements at the measure level.
Definition: tempo.h:33
This class stores current drawing parameters for text.
Definition: textelement.h:90
Definition: textelement.h:22
This class models CDATA (text)
Definition: text.h:23
This class models the MEI <tie> element.
Definition: tie.h:32
This class models the MEI <trill> element.
Definition: trill.h:35
This class models the MEI <turn> element.
Definition: turn.h:33
This class is a drawing context and corresponds to the view of a MVC design pattern.
Definition: view.h:109
void DrawCurrentPage(DeviceContext *dc, bool background=true)
Method that actually draw the current page.
void SetPage(Page *page, bool doLayout)
Set the current page.
void SetScoreDefDrawingWidth(DeviceContext *dc, ScoreDef *scoreDef)
Calculate the ScoreDef width by taking into account its widest key signature.
int m_currentColor
The color currently being used when drawing.
Definition: view.h:713
Options * m_options
Options of the document.
Definition: view.h:697
View()
Constructors and destructors.
void SetDoc(Doc *doc)
Set the document the view is pointing to (mandatory).
Doc * m_doc
Document.
Definition: view.h:695
ScoreDef m_drawingScoreDef
The current drawing score def.
Definition: view.h:725
SlurHandling GetSlurHandling() const
Control how slurs are handled.
Definition: view.h:178
int DrawMeterSigFigures(DeviceContext *dc, int x, int y, MeterSig *meterSig, int den, Staff *staff)
Returns the width of the drawn figures.
double GetPPUFactor() const
Return the pixel per unit factor of the current page (if any, 1.0 otherwise)
SlurHandling m_slurHandling
Control the handling of slurs.
Definition: view.h:718
bool GetNotationMode()
Simply returns the value of the last note-type element (mensural or neume)