Compare commits
2 Commits
7ff8fd90c0
...
e97e6d5281
Author | SHA1 | Date |
---|---|---|
ArgonarioD | e97e6d5281 | |
ArgonarioD | b429761d81 |
|
@ -11,7 +11,7 @@ PixelPath SimpleElement::getPaintObject() const
|
|||
|
||||
void SimpleElement::loadSvgFile(const QString& filePath)
|
||||
{
|
||||
// TODO <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO 样式问题
|
||||
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: <EFBFBD>ij<EFBFBD>json<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>*/ + jsonSource.value("data").toObject().value("include").toString());
|
||||
loadSvgFile("../"/*TODO: 改成json文件所在文件夹路径*/ + jsonSource.value("data").toObject().value("include").toString());
|
||||
}
|
||||
|
||||
GroupElement::GroupElement(FolderLayerWrapper* sourceLayer)
|
||||
|
@ -45,7 +45,6 @@ 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())
|
||||
{
|
||||
|
@ -91,7 +90,7 @@ PixelPath GroupElement::getPaintObject(std::vector<std::shared_ptr<LayerStyle>>*
|
|||
// rawPath.addPath(path);
|
||||
// }
|
||||
//}
|
||||
//TODO : <EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD><EFBFBD>
|
||||
//TODO : 添加细节
|
||||
QJsonObject GraphicElement::toJson() const
|
||||
{
|
||||
QJsonObject result;
|
||||
|
@ -99,7 +98,7 @@ QJsonObject GraphicElement::toJson() const
|
|||
return result;
|
||||
}
|
||||
|
||||
void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
|
||||
void SimpleElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
|
||||
{
|
||||
painter->save();
|
||||
painter->setTransform(transform);
|
||||
|
@ -109,16 +108,30 @@ void SimpleElement::paint(QPainter* painter, QTransform transform, vector<std::s
|
|||
}
|
||||
else
|
||||
{
|
||||
// TODO:Ӧ<><D3A6>style
|
||||
Renderer::ElementStyleStrokeDemo demo(2);
|
||||
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0);
|
||||
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);
|
||||
painter->drawImage(mov, img);
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void GroupElement::paint(QPainter* painter, QTransform transform, vector<std::shared_ptr<LayerStyle>> styles)
|
||||
void GroupElement::paint(QPainter* painter, QTransform transform, const vector<std::shared_ptr<LayerStyle>> &styles)
|
||||
{
|
||||
sourceLayer->paint(painter, transform);
|
||||
}
|
|
@ -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, std::vector<std::shared_ptr<LayerStyle>> styles) = 0;
|
||||
virtual void paint(QPainter* painter, QTransform transform, const 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, std::vector<std::shared_ptr<LayerStyle>> styles) override;
|
||||
void paint(QPainter* painter, QTransform transform, const 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, std::vector<std::shared_ptr<LayerStyle>> styles) override;
|
||||
void paint(QPainter* painter, QTransform transform, const std::vector<std::shared_ptr<LayerStyle>> &styles) override;
|
||||
};
|
||||
|
||||
//******************************** BitmapPath ********************************//
|
||||
|
|
Loading…
Reference in New Issue