29 lines
836 B
C++
29 lines
836 B
C++
#pragma once
|
|
#include <QDomDocument>
|
|
#include <QSvgRenderer>
|
|
#include <QWidget>
|
|
struct SVG_Image_Render {
|
|
SVG_Image_Render& set_path(const QString& path) {
|
|
this->_path = path;
|
|
return *this;
|
|
}
|
|
SVG_Image_Render& set_color(const QColor& color) {
|
|
this->_color = color;
|
|
return *this;
|
|
}
|
|
SVG_Image_Render& create();
|
|
void render(QPainter* painter);
|
|
void render(QPainter* painter, const QRectF& rect);
|
|
void render(QPainter* painter, const QRectF& rect, const QColor& color);
|
|
QImage to_image(QSize size, const QColor& c);
|
|
QPixmap to_pixmap(QSize size, const QColor& c);
|
|
const QColor& get_color() {
|
|
return _color;
|
|
};
|
|
protected:
|
|
QString _path;
|
|
QColor _color = QColor(Qt::red);
|
|
QDomDocument doc;
|
|
QByteArray change_color(const QColor& color);
|
|
};
|