Files
Renderive/YSGraphic_Core/component/SVG.h
T
2026-06-16 13:33:27 +08:00

25 lines
779 B
C++

#pragma once
#include <QDomDocument>
#include <QSvgRenderer>
#include <QWidget>
struct SVGImage_Render {
SVGImage_Render& set_path(const QString& path) { this->_path = path; return *this;}
SVGImage_Render& set_color(const QColor& color) {this->_color = color; return *this;}
SVGImage_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);
};