Break out material handling into dedicated class.
This commit is contained in:
parent
fc44c4c623
commit
73051a5f27
17 changed files with 221 additions and 153 deletions
|
@ -74,7 +74,7 @@ void SvgPainter::paintMesh(SvgDocument* document, SceneModel* model, bool showOu
|
|||
count++;
|
||||
}
|
||||
svg_tri->setPoints(points);
|
||||
svg_tri->setFill(model->getFillColor());
|
||||
svg_tri->setFill(model->getSolidMaterial().getFillColor());
|
||||
document->getRoot()->addChild(std::move(svg_tri));
|
||||
|
||||
if (showOutline)
|
||||
|
@ -92,12 +92,13 @@ void SvgPainter::paintMesh(SvgDocument* document, SceneModel* model, bool showOu
|
|||
|
||||
void SvgPainter::setStyle(SceneModel* model, SvgShapeElement* element) const
|
||||
{
|
||||
auto transform = model->getTransform();
|
||||
const auto transform = model->getTransform();
|
||||
const auto material = model->getSolidMaterial();
|
||||
|
||||
if (model->hasFillColor())
|
||||
if (material.hasFillColor())
|
||||
{
|
||||
element->setFill(model->getFillColor());
|
||||
auto opacity = static_cast<float>(model->getFillColor().getAlpha());
|
||||
element->setFill(material.getFillColor());
|
||||
auto opacity = static_cast<float>(material.getFillColor().getAlpha());
|
||||
if (opacity != 1.0)
|
||||
{
|
||||
element->setFillOpacity(opacity);
|
||||
|
@ -108,10 +109,10 @@ void SvgPainter::setStyle(SceneModel* model, SvgShapeElement* element) const
|
|||
element->setNoFill();
|
||||
}
|
||||
|
||||
if (model->hasOutlineColor())
|
||||
if (material.hasStrokeColor())
|
||||
{
|
||||
element->setStrokeColor(model->getOutlineColor());
|
||||
element->setStrokeWidth(model->getOutlineThickness());
|
||||
element->setStrokeColor(material.getStrokeColor());
|
||||
element->setStrokeWidth(material.getStrokeThickness());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -195,8 +196,9 @@ void SvgPainter::paintText(SvgDocument* document, SceneText* text) const
|
|||
svg_text->setLocation(loc);
|
||||
|
||||
svg_text->setFontFamily(text->getTextData().mFont.getFaceName());
|
||||
svg_text->setFill(text->getFillColor());
|
||||
auto opacity = static_cast<float>(text->getFillColor().getAlpha());
|
||||
|
||||
svg_text->setFill(text->getSolidMaterial().getFillColor());
|
||||
auto opacity = static_cast<float>(text->getSolidMaterial().getFillColor().getAlpha());
|
||||
if (opacity != 1.0)
|
||||
{
|
||||
svg_text->setFillOpacity(opacity);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue