Skip to content

Commit

Permalink
Add support for [email protected].
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Nov 15, 2023
1 parent 7d48f31 commit 50fcdab
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/vrv/devicecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ class DeviceContext {
virtual void EndCustomGraphic(){};
///@}

/**
* Method for changing the color of a custom graphic
*/
virtual void SetCustomGraphicColor(const std::string &color){};

/**
* @name Methods for re-starting and ending a graphic for objects drawn in separate steps
* The methods can be used to the output together, for example for a Beam
Expand Down
5 changes: 5 additions & 0 deletions include/vrv/svgdevicecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ class SvgDeviceContext : public DeviceContext {
void EndCustomGraphic() override;
///@}

/**
* Method for changing the color of a custom graphic
*/
virtual void SetCustomGraphicColor(const std::string &color) override;

/**
* @name Methods for re-starting and ending a graphic for objects drawn in separate steps
*/
Expand Down
6 changes: 6 additions & 0 deletions src/svgdevicecontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,12 @@ void SvgDeviceContext::EndCustomGraphic()
m_currentNode = m_svgNodeStack.back();
}

void SvgDeviceContext::SetCustomGraphicColor(const std::string &color)
{
m_currentNode.append_attribute("color") = color.c_str();
m_currentNode.append_attribute("fill") = color.c_str();
}

void SvgDeviceContext::EndResumedGraphic(Object *object, View *view)
{
m_svgNodeStack.pop_back();
Expand Down
4 changes: 4 additions & 0 deletions src/view_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,10 @@ void View::DrawNote(DeviceContext *dc, LayerElement *element, Layer *layer, Staf

dc->StartCustomGraphic("notehead");

if (note->HasHeadColor()) {
dc->SetCustomGraphicColor(note->GetHeadColor());
}

this->DrawSmuflCode(dc, noteX, noteY, fontNo, staff->m_drawingStaffSize, drawingCueSize, true);

// handle notehead enclosure
Expand Down

0 comments on commit 50fcdab

Please sign in to comment.