GraphicElement改为使用QImage

dev-VirtualTexture
wuyize 2023-02-08 18:33:26 +08:00
parent 16bfba76e4
commit e004809164
3 changed files with 29 additions and 31 deletions

View File

@ -1033,8 +1033,9 @@ void main()
if (lineType == 2 || intTest % 2 == int(lineType)) if (lineType == 2 || intTest % 2 == int(lineType))
{ {
hitElement = true; hitElement = true;
elementColor = vec4(1, 1, 0, 1); //elementColor = vec4(1, 1, 0, 1);
// drawLine(minDistance / strokeWidth, styleIndex, elementColor, metallicRoughness); vec2 metallicRoughness;
drawLine(minDistance / strokeWidth, styleIndex, elementColor, metallicRoughness);
} }
else if (p3Last == p[0]) else if (p3Last == p[0])
hitElement = false; hitElement = false;

View File

@ -14,7 +14,7 @@ void SimpleElement::loadSvgFile(const QString& filePath)
// TODO 样式问题 // TODO 样式问题
SvgFileLoader loader; SvgFileLoader loader;
loader.loadSvgFile(filePath, painterPath); loader.loadSvgFile(filePath, painterPath);
qDebug() << "load svg file success "<<painterPath.elementCount(); qDebug() << "load svg file success " << painterPath.elementCount();
} }
SimpleElement::SimpleElement(QJsonObject jsonSource) : jsonSource(jsonSource) SimpleElement::SimpleElement(QJsonObject jsonSource) : jsonSource(jsonSource)
@ -24,11 +24,11 @@ SimpleElement::SimpleElement(QJsonObject jsonSource) : jsonSource(jsonSource)
loadSvgFile("../"/*TODO: 改成json文件所在文件夹路径*/ + jsonSource.value("data").toObject().value("include").toString()); loadSvgFile("../"/*TODO: 改成json文件所在文件夹路径*/ + jsonSource.value("data").toObject().value("include").toString());
} }
GroupElement::GroupElement(FolderLayerWrapper *sourceLayer) GroupElement::GroupElement(FolderLayerWrapper* sourceLayer)
{ {
this->sourceLayer = sourceLayer; this->sourceLayer = sourceLayer;
} }
void GroupElement::setSourceLayer(FolderLayerWrapper *sourceLayer) void GroupElement::setSourceLayer(FolderLayerWrapper* sourceLayer)
{ {
this->sourceLayer = sourceLayer; this->sourceLayer = sourceLayer;
} }
@ -45,12 +45,12 @@ PixelPath GroupElement::getPaintObject() const
//TODO: apply styles and send back //TODO: apply styles and send back
PixelPath SimpleElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const { PixelPath SimpleElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const {
PixelPath result; PixelPath result;
Renderer::ElementStyleStrokeDemo demo; Renderer::ElementStyleStrokeDemo demo(2);
qDebug() << (renderer==nullptr)<<"------------"; qDebug() << (renderer == nullptr) << "------------";
//auto [img, mov] = renderer->drawElement(painterPath,demo,1.0,false); auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0, false);
//qDebug() << img << " ------"; //qDebug() << img << " ------";
//result.addImage(img, mov); result.addImage(img, mov);
result.addPath(painterPath); //result.addPath(painterPath);
// QImage img(80,80,QImage::Format_ARGB32); // QImage img(80,80,QImage::Format_ARGB32);
// QPainter pt(&img); // QPainter pt(&img);
//pt.setPen(QPen(Qt::red, 2)); //pt.setPen(QPen(Qt::red, 2));

View File

@ -1,11 +1,8 @@
#include "MainWindow.h" #include "MainWindow.h"
#include "Renderer/Painting/CubicBezier.h"
#include <QGuiApplication> #include <QGuiApplication>
#include <QtWidgets/QApplication> #include <QtWidgets/QApplication>
#include <FramelessHelper/Core/private/framelessconfig_p.h> #include <FramelessHelper/Core/private/framelessconfig_p.h>
using Renderer::CubicBezier;
extern "C" extern "C"
{ {
_declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001; _declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
@ -20,7 +17,7 @@ int main(int argc, char* argv[])
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication a(argc, argv); QApplication a(argc, argv);
FramelessHelper::Core::setApplicationOSThemeAware(); //FramelessHelper::Core::setApplicationOSThemeAware();
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur); FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow); FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow); FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);