GraphicElement改为使用QImage
parent
16bfba76e4
commit
e004809164
|
@ -1033,8 +1033,9 @@ void main()
|
|||
if (lineType == 2 || intTest % 2 == int(lineType))
|
||||
{
|
||||
hitElement = true;
|
||||
elementColor = vec4(1, 1, 0, 1);
|
||||
// drawLine(minDistance / strokeWidth, styleIndex, elementColor, metallicRoughness);
|
||||
//elementColor = vec4(1, 1, 0, 1);
|
||||
vec2 metallicRoughness;
|
||||
drawLine(minDistance / strokeWidth, styleIndex, elementColor, metallicRoughness);
|
||||
}
|
||||
else if (p3Last == p[0])
|
||||
hitElement = false;
|
||||
|
|
|
@ -6,62 +6,62 @@ PixelPath SimpleElement::getPaintObject() const
|
|||
{
|
||||
PixelPath result;
|
||||
result.addPath(painterPath);
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
void SimpleElement::loadSvgFile(const QString& filePath)
|
||||
{
|
||||
// TODO ÑùʽÎÊÌâ
|
||||
SvgFileLoader loader;
|
||||
loader.loadSvgFile(filePath, painterPath);
|
||||
qDebug() << "load svg file success "<<painterPath.elementCount();
|
||||
SvgFileLoader loader;
|
||||
loader.loadSvgFile(filePath, painterPath);
|
||||
qDebug() << "load svg file success " << painterPath.elementCount();
|
||||
}
|
||||
|
||||
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());
|
||||
painterPath.clear();
|
||||
//loadSvgFile("D:\\Projects\\BigC\\svg\\3.svg");
|
||||
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;
|
||||
}
|
||||
PixelPath GroupElement::getPaintObject() const
|
||||
{
|
||||
if (sourceLayer != nullptr) {
|
||||
sourceLayer->refresh();
|
||||
return sourceLayer->getCache();
|
||||
}
|
||||
else
|
||||
return PixelPath();
|
||||
if (sourceLayer != nullptr) {
|
||||
sourceLayer->refresh();
|
||||
return sourceLayer->getCache();
|
||||
}
|
||||
else
|
||||
return PixelPath();
|
||||
}
|
||||
|
||||
//TODO: apply styles and send back
|
||||
PixelPath SimpleElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const {
|
||||
PixelPath result;
|
||||
Renderer::ElementStyleStrokeDemo demo;
|
||||
qDebug() << (renderer==nullptr)<<"------------";
|
||||
//auto [img, mov] = renderer->drawElement(painterPath,demo,1.0,false);
|
||||
//qDebug() << img << " ------";
|
||||
//result.addImage(img, mov);
|
||||
result.addPath(painterPath);
|
||||
Renderer::ElementStyleStrokeDemo demo(2);
|
||||
qDebug() << (renderer == nullptr) << "------------";
|
||||
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0, false);
|
||||
//qDebug() << img << " ------";
|
||||
result.addImage(img, mov);
|
||||
//result.addPath(painterPath);
|
||||
// QImage img(80,80,QImage::Format_ARGB32);
|
||||
// QPainter pt(&img);
|
||||
//pt.setPen(QPen(Qt::red, 2));
|
||||
//pt.drawLine(0, 0, 80, 80);
|
||||
//pt.end();
|
||||
//result.addImage(img, QPoint(0, 0));
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
PixelPath GroupElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const {
|
||||
return getPaintObject();
|
||||
return getPaintObject();
|
||||
}
|
||||
|
||||
//BitmapPath::BitmapPath() {
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
#include "MainWindow.h"
|
||||
#include "Renderer/Painting/CubicBezier.h"
|
||||
#include <QGuiApplication>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
||||
using Renderer::CubicBezier;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
_declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
|
||||
|
@ -20,7 +17,7 @@ int main(int argc, char* argv[])
|
|||
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
QApplication a(argc, argv);
|
||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
//FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
|
|
Loading…
Reference in New Issue