Compare commits

..

1 Commits

Author SHA1 Message Date
ArgonarioD 7ff8fd90c0 Merge branch 'main' into dev-LayerStyle
# Conflicts:
#	ArchitectureColoredPainting/src/Editor/GraphicElement.cpp
2023-03-14 18:01:22 +08:00
2 changed files with 11 additions and 24 deletions

View File

@ -11,7 +11,7 @@ PixelPath SimpleElement::getPaintObject() const
void SimpleElement::loadSvgFile(const QString& filePath)
{
// TODO 样式问题
// TODO <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SvgFileLoader loader;
loader.loadSvgFile(filePath, painterPath);
qDebug() << "load svg file success " << painterPath.elementCount();
@ -21,7 +21,7 @@ SimpleElement::SimpleElement(QJsonObject jsonSource) : jsonSource(jsonSource)
{
painterPath.clear();
//loadSvgFile("D:\\Projects\\BigC\\svg\\3.svg");
loadSvgFile("../"/*TODO: 改成json文件所在文件夹路径*/ + jsonSource.value("data").toObject().value("include").toString());
loadSvgFile("../"/*TODO: <EFBFBD>ij<EFBFBD>json<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>*/ + jsonSource.value("data").toObject().value("include").toString());
}
GroupElement::GroupElement(FolderLayerWrapper* sourceLayer)
@ -45,6 +45,7 @@ PixelPath GroupElement::getPaintObject() const
//TODO: apply styles and send back
PixelPath SimpleElement::getPaintObject(std::vector<std::shared_ptr<LayerStyle>>* styles) const {
PixelPath result;
//Renderer::ElementStyleStrokeDemo demo(2);
std::shared_ptr<Renderer::ElementStyle> style;
if ((*styles).empty())
{
@ -90,7 +91,7 @@ PixelPath GroupElement::getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*
// rawPath.addPath(path);
// }
//}
//TODO : 添加细节
//TODO : <EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>
QJsonObject GraphicElement::toJson() const
{
QJsonObject result;
@ -98,7 +99,7 @@ QJsonObject GraphicElement::toJson() const
return result;
}
void SimpleElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
{
painter->save();
painter->setTransform(transform);
@ -108,30 +109,16 @@ void SimpleElement::paint(QPainter* painter, QTransform transform, const vector<
}
else
{
// TODO:Ӧ<><D3A6>style
Renderer::ElementStyleStrokeDemo demo(2);
std::shared_ptr<Renderer::ElementStyle> style;
if (styles.empty())
{
style = std::make_shared<Renderer::ElementStyleStrokeDemo>(2);
}
else
{
style = styles[0];
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokePlain>(
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
)->material.color.name();*/
/*qDebug() << std::dynamic_pointer_cast<Renderer::StrokeRadialGradient>(
std::dynamic_pointer_cast<StrokeElementLayerStyle>(style)->materialStyles[0]->materialStroke
)->materialMap[1.0].color;*/
}
auto [img, mov] = renderer->drawElement(painterPath, *style, 1.0);
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
painter->drawImage(mov, img);
}
painter->restore();
}
void GroupElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
void GroupElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
{
sourceLayer->paint(painter, transform);
}

View File

@ -28,7 +28,7 @@ public:
virtual QJsonObject toJson() const;
virtual PixelPath getPaintObject() const = 0;
virtual PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const = 0;
virtual void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) = 0;
virtual void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) = 0;
};
class SimpleElement : public GraphicElement
@ -45,7 +45,7 @@ public:
~SimpleElement() = default;
PixelPath getPaintObject() const override;
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) override;
void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) override;
};
class GroupElement : public GraphicElement
@ -60,7 +60,7 @@ public:
PixelPath getPaintObject() const override;
PixelPath getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*) const override;
void setSourceLayer(FolderLayerWrapper* sourceLayer);
void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) override;
void paint(QPainter* painter, QTransform transform, std::vector<std::shared_ptr<LayerStyle>> styles) override;
};
//******************************** BitmapPath ********************************//