mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-17 05:40:31 +02:00
[W.I.P.] Added a FasterRenderOption
Still completly buggy. and it crashes imediatly after input
This commit is contained in:
@@ -2,9 +2,10 @@
|
|||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
IntelliImage::IntelliImage(int weight, int height)
|
IntelliImage::IntelliImage(int width, int height, bool fastRendererOn)
|
||||||
: imageData(QSize(weight, height), QImage::Format_ARGB32){
|
: imageData(QSize(width, height), fastRendererOn ? QImage::Format_Indexed8 : QImage::Format_ARGB32){
|
||||||
imageData.fill(QColor(255,255,255,255));
|
imageData.fill(QColor(255,255,255,255));
|
||||||
|
this->fastRenderer = fastRendererOn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ bool IntelliImage::loadImage(const QString &filePath){
|
|||||||
// scaled Image to size of Layer
|
// scaled Image to size of Layer
|
||||||
loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
|
loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
|
||||||
|
|
||||||
imageData = loadedImage.convertToFormat(QImage::Format_ARGB32);
|
imageData = loadedImage.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,17 +34,21 @@ void IntelliImage::resizeImage(QImage*image, const QSize &newSize){
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Create a new image to display and fill it with white
|
// Create a new image to display and fill it with white
|
||||||
QImage newImage(newSize, QImage::Format_ARGB32);
|
QImage newImage(newSize, QImage::Format_ARGB32);
|
||||||
newImage.fill(qRgb(255, 255, 255));
|
newImage.fill(qRgb(255, 255, 255));
|
||||||
|
|
||||||
// Draw the image
|
// Draw the image
|
||||||
QPainter painter(&newImage);
|
QPainter painter(&newImage);
|
||||||
painter.drawImage(QPoint(0, 0), *image);
|
painter.drawImage(QPoint(0, 0), *image);
|
||||||
*image = newImage;
|
*image = newImage;
|
||||||
|
updateRendererSetting(fastRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
||||||
// Used to draw on the widget
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
@@ -51,20 +56,28 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
|
|||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter.drawPoint(p1);
|
||||||
|
updateRendererSetting(fastRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
void IntelliImage::drawPoint(const QPoint &p1, const QColor& color, const int& penWidth){
|
||||||
// Used to draw on the widget
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawPoint(p1);
|
painter.drawPoint(p1);
|
||||||
|
updateRendererSetting(fastRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
|
||||||
// Used to draw on the widget
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
// Used to draw on the widget
|
||||||
QPainter painter(&imageData);
|
QPainter painter(&imageData);
|
||||||
|
|
||||||
// Set the current settings for the pen
|
// Set the current settings for the pen
|
||||||
@@ -72,12 +85,22 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
|||||||
|
|
||||||
// Draw a line from the last registered point to the current
|
// Draw a line from the last registered point to the current
|
||||||
painter.drawLine(p1, p2);
|
painter.drawLine(p1, p2);
|
||||||
|
updateRendererSetting(fastRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliImage::drawPlain(const QColor& color){
|
void IntelliImage::drawPlain(const QColor& color){
|
||||||
imageData.fill(color);
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
imageData.fill(color);
|
||||||
|
updateRendererSetting(fastRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
QColor IntelliImage::getPixelColor(QPoint& point){
|
||||||
return imageData.pixelColor(point);
|
return imageData.pixelColor(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntelliImage::updateRendererSetting(bool fastRendererOn){
|
||||||
|
this->fastRenderer = fastRendererOn;
|
||||||
|
this->imageData = this->imageData.convertToFormat(fastRenderer ? QImage::Format_Indexed8 : QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "IntelliHelper/IntelliHelper.h"
|
#include "IntelliHelper/IntelliHelper.h"
|
||||||
|
#include "IntelliHelper/IntelliRenderSettings.h"
|
||||||
|
|
||||||
class IntelliTool;
|
class IntelliTool;
|
||||||
|
|
||||||
@@ -39,13 +40,20 @@ QImage imageData;
|
|||||||
* \brief The Type, an Image is.
|
* \brief The Type, an Image is.
|
||||||
*/
|
*/
|
||||||
ImageType TypeOfImage;
|
ImageType TypeOfImage;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief fastRenderer is the flag that represents the usage of 8bit pictures.
|
||||||
|
*/
|
||||||
|
bool fastRenderer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief The Construcor of the IntelliImage. Given the Image dimensions.
|
* \brief The Construcor of the IntelliImage. Given the Image dimensions.
|
||||||
* \param width - The width of the Image.
|
* \param width - The width of the Image.
|
||||||
* \param height - The height of the Image.
|
* \param height - The height of the Image.
|
||||||
|
* \param fastRendererOn - Represents the flag for 8bit picture handelling.
|
||||||
*/
|
*/
|
||||||
IntelliImage(int width, int height);
|
IntelliImage(int width, int height, bool fastRendererOn);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief An Abstract Destructor.
|
* \brief An Abstract Destructor.
|
||||||
@@ -140,6 +148,13 @@ virtual bool loadImage(const QString &filePath);
|
|||||||
* \return The color of the Pixel as QColor.
|
* \return The color of the Pixel as QColor.
|
||||||
*/
|
*/
|
||||||
virtual QColor getPixelColor(QPoint& point);
|
virtual QColor getPixelColor(QPoint& point);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief updateRendererSetting updates the existing image format to the new format.
|
||||||
|
* \param fastRendererOn flag for the 8bit image handeling.
|
||||||
|
*/
|
||||||
|
virtual void updateRendererSetting(bool fastRendererOn);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3,9 +3,10 @@
|
|||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
IntelliRasterImage::IntelliRasterImage(int weight, int height)
|
IntelliRasterImage::IntelliRasterImage(int width, int height, bool fastRendererOn)
|
||||||
: IntelliImage(weight, height){
|
: IntelliImage(width, height, fastRendererOn){
|
||||||
TypeOfImage = IntelliImage::ImageType::Raster_Image;
|
TypeOfImage = IntelliImage::ImageType::Raster_Image;
|
||||||
|
this->fastRenderer = fastRendererOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliRasterImage::~IntelliRasterImage(){
|
IntelliRasterImage::~IntelliRasterImage(){
|
||||||
@@ -13,7 +14,7 @@ IntelliRasterImage::~IntelliRasterImage(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
||||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
|
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false);
|
||||||
raster->imageData.fill(Qt::transparent);
|
raster->imageData.fill(Qt::transparent);
|
||||||
raster->TypeOfImage = IntelliImage::ImageType::Raster_Image;
|
raster->TypeOfImage = IntelliImage::ImageType::Raster_Image;
|
||||||
return raster;
|
return raster;
|
||||||
@@ -29,6 +30,9 @@ QImage IntelliRasterImage::getDisplayable(int alpha){
|
|||||||
|
|
||||||
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||||
QImage copy = imageData;
|
QImage copy = imageData;
|
||||||
|
if(fastRenderer){
|
||||||
|
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
for(int y = 0; y<copy.height(); y++) {
|
for(int y = 0; y<copy.height(); y++) {
|
||||||
for(int x = 0; x<copy.width(); x++) {
|
for(int x = 0; x<copy.width(); x++) {
|
||||||
QColor clr = copy.pixelColor(x,y);
|
QColor clr = copy.pixelColor(x,y);
|
||||||
@@ -36,6 +40,9 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
copy.setPixelColor(x,y, clr);
|
copy.setPixelColor(x,y, clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(fastRenderer){
|
||||||
|
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,9 @@ public:
|
|||||||
* \brief The Construcor of the IntelliRasterImage. Given the Image dimensions.
|
* \brief The Construcor of the IntelliRasterImage. Given the Image dimensions.
|
||||||
* \param width - The width of the Image.
|
* \param width - The width of the Image.
|
||||||
* \param height - The height of the Image.
|
* \param height - The height of the Image.
|
||||||
|
* \param fastRendererOn - Represents the flag for 8bit picture handelling.
|
||||||
*/
|
*/
|
||||||
IntelliRasterImage(int width, int height);
|
IntelliRasterImage(int width, int height, bool fastRendererOn);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief An Destructor.
|
* \brief An Destructor.
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
#include <QRect>
|
#include <QRect>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
IntelliShapedImage::IntelliShapedImage(int weight, int height)
|
IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererOn)
|
||||||
: IntelliRasterImage(weight, height){
|
: IntelliRasterImage(width, height, fastRendererOn){
|
||||||
TypeOfImage = IntelliImage::ImageType::Shaped_Image;
|
TypeOfImage = IntelliImage::ImageType::Shaped_Image;
|
||||||
|
this->fastRenderer = fastRendererOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliShapedImage::~IntelliShapedImage(){
|
IntelliShapedImage::~IntelliShapedImage(){
|
||||||
@@ -18,7 +19,7 @@ QImage IntelliShapedImage::getDisplayable(int alpha){
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntelliImage* IntelliShapedImage::getDeepCopy(){
|
IntelliImage* IntelliShapedImage::getDeepCopy(){
|
||||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height());
|
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false);
|
||||||
shaped->setPolygon(this->polygonData);
|
shaped->setPolygon(this->polygonData);
|
||||||
shaped->imageData.fill(Qt::transparent);
|
shaped->imageData.fill(Qt::transparent);
|
||||||
shaped->TypeOfImage = IntelliImage::ImageType::Shaped_Image;
|
shaped->TypeOfImage = IntelliImage::ImageType::Shaped_Image;
|
||||||
@@ -26,7 +27,11 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliShapedImage::calculateVisiblity(){
|
void IntelliShapedImage::calculateVisiblity(){
|
||||||
if(polygonData.size()<=2) {
|
if(fastRenderer){
|
||||||
|
this->imageData = imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(polygonData.size()<=2) {
|
||||||
QColor clr;
|
QColor clr;
|
||||||
for(int y=0; y<imageData.height(); y++) {
|
for(int y=0; y<imageData.height(); y++) {
|
||||||
for(int x=0; x<imageData.width(); x++) {
|
for(int x=0; x<imageData.width(); x++) {
|
||||||
@@ -35,6 +40,9 @@ void IntelliShapedImage::calculateVisiblity(){
|
|||||||
imageData.setPixelColor(x,y,clr);
|
imageData.setPixelColor(x,y,clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QColor clr;
|
QColor clr;
|
||||||
@@ -51,10 +59,16 @@ void IntelliShapedImage::calculateVisiblity(){
|
|||||||
imageData.setPixelColor(x,y,clr);
|
imageData.setPixelColor(x,y,clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(fastRenderer){
|
||||||
|
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
||||||
QImage copy = imageData;
|
QImage copy = imageData;
|
||||||
|
if(fastRenderer){
|
||||||
|
copy = copy.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
for(int y = 0; y<copy.height(); y++) {
|
for(int y = 0; y<copy.height(); y++) {
|
||||||
for(int x = 0; x<copy.width(); x++) {
|
for(int x = 0; x<copy.width(); x++) {
|
||||||
QColor clr = copy.pixelColor(x,y);
|
QColor clr = copy.pixelColor(x,y);
|
||||||
@@ -62,6 +76,9 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
copy.setPixelColor(x,y, clr);
|
copy.setPixelColor(x,y, clr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(fastRenderer){
|
||||||
|
copy = copy.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,9 @@ public:
|
|||||||
* \brief The Construcor of the IntelliShapedImage. Given the Image dimensions.
|
* \brief The Construcor of the IntelliShapedImage. Given the Image dimensions.
|
||||||
* \param width - The width of the Image.
|
* \param width - The width of the Image.
|
||||||
* \param height - The height of the Image.
|
* \param height - The height of the Image.
|
||||||
|
* \param fastRendererOn - Represents the flag for 8bit picture handelling.
|
||||||
*/
|
*/
|
||||||
IntelliShapedImage(int width, int height);
|
IntelliShapedImage(int width, int height, bool fastRendererOn);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief An Destructor.
|
* \brief An Destructor.
|
||||||
|
|||||||
10
src/IntelliHelper/IntelliRenderSettings.cpp
Normal file
10
src/IntelliHelper/IntelliRenderSettings.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "IntelliRenderSettings.h"
|
||||||
|
|
||||||
|
IntelliRenderSettings::IntelliRenderSettings()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IntelliRenderSettings::getFastRenderer(){
|
||||||
|
return fastRenderer;
|
||||||
|
}
|
||||||
20
src/IntelliHelper/IntelliRenderSettings.h
Normal file
20
src/IntelliHelper/IntelliRenderSettings.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#ifndef INTELLIRENDERSETTINGS_H
|
||||||
|
#define INTELLIRENDERSETTINGS_H
|
||||||
|
|
||||||
|
|
||||||
|
class IntelliRenderSettings
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IntelliRenderSettings();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief The getfastRenderer gets the value of the flag for the fastRenderer setting.
|
||||||
|
* \return Returns true if fastRenderer is active else false
|
||||||
|
*/
|
||||||
|
bool getFastRenderer();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool fastRenderer = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INTELLIRENDERSETTINGS_H
|
||||||
@@ -22,6 +22,7 @@ SOURCES += \
|
|||||||
Image/IntelliShapedImage.cpp \
|
Image/IntelliShapedImage.cpp \
|
||||||
IntelliHelper/IntelliColorPicker.cpp \
|
IntelliHelper/IntelliColorPicker.cpp \
|
||||||
IntelliHelper/IntelliHelper.cpp \
|
IntelliHelper/IntelliHelper.cpp \
|
||||||
|
IntelliHelper/IntelliRenderSettings.cpp \
|
||||||
Layer/PaintingArea.cpp \
|
Layer/PaintingArea.cpp \
|
||||||
Tool/IntelliTool.cpp \
|
Tool/IntelliTool.cpp \
|
||||||
Tool/IntelliToolCircle.cpp \
|
Tool/IntelliToolCircle.cpp \
|
||||||
@@ -40,6 +41,7 @@ HEADERS += \
|
|||||||
Image/IntelliShapedImage.h \
|
Image/IntelliShapedImage.h \
|
||||||
IntelliHelper/IntelliColorPicker.h \
|
IntelliHelper/IntelliColorPicker.h \
|
||||||
IntelliHelper/IntelliHelper.h \
|
IntelliHelper/IntelliHelper.h \
|
||||||
|
IntelliHelper/IntelliRenderSettings.h \
|
||||||
Layer/PaintingArea.h \
|
Layer/PaintingArea.h \
|
||||||
Tool/IntelliTool.h \
|
Tool/IntelliTool.h \
|
||||||
Tool/IntelliToolCircle.h \
|
Tool/IntelliToolCircle.h \
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
||||||
: QWidget(parent){
|
: QWidget(parent){
|
||||||
this->Tool = nullptr;
|
this->Tool = nullptr;
|
||||||
|
this->renderSettings = IntelliRenderSettings();
|
||||||
this->setLayerDimensions(maxWidth, maxHeight);
|
this->setLayerDimensions(maxWidth, maxHeight);
|
||||||
this->addLayer(200,200,0,0,IntelliImage::ImageType::Shaped_Image);
|
this->addLayer(200,200,0,0,IntelliImage::ImageType::Shaped_Image);
|
||||||
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
|
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
|
||||||
@@ -36,6 +37,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
|||||||
layerBundle[1].alpha=200;
|
layerBundle[1].alpha=200;
|
||||||
|
|
||||||
activeLayer=0;
|
activeLayer=0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PaintingArea::~PaintingArea(){
|
PaintingArea::~PaintingArea(){
|
||||||
@@ -46,7 +48,7 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
|||||||
//set standart parameter
|
//set standart parameter
|
||||||
this->maxWidth = maxWidth;
|
this->maxWidth = maxWidth;
|
||||||
this->maxHeight = maxHeight;
|
this->maxHeight = maxHeight;
|
||||||
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
|
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
|
||||||
|
|
||||||
// Roots the widget to the top left even if resized
|
// Roots the widget to the top left even if resized
|
||||||
setAttribute(Qt::WA_StaticContents);
|
setAttribute(Qt::WA_StaticContents);
|
||||||
@@ -60,9 +62,9 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
|
|||||||
newLayer.widthOffset = widthOffset;
|
newLayer.widthOffset = widthOffset;
|
||||||
newLayer.heightOffset = heightOffset;
|
newLayer.heightOffset = heightOffset;
|
||||||
if(type==IntelliImage::ImageType::Raster_Image) {
|
if(type==IntelliImage::ImageType::Raster_Image) {
|
||||||
newLayer.image = new IntelliRasterImage(width,height);
|
newLayer.image = new IntelliRasterImage(width,height,renderSettings.getFastRenderer());
|
||||||
}else if(type==IntelliImage::ImageType::Shaped_Image) {
|
}else if(type==IntelliImage::ImageType::Shaped_Image) {
|
||||||
newLayer.image = new IntelliShapedImage(width, height);
|
newLayer.image = new IntelliShapedImage(width, height, renderSettings.getFastRenderer());
|
||||||
}
|
}
|
||||||
newLayer.alpha = 255;
|
newLayer.alpha = 255;
|
||||||
this->layerBundle.push_back(newLayer);
|
this->layerBundle.push_back(newLayer);
|
||||||
@@ -340,6 +342,9 @@ void PaintingArea::drawLayers(bool forSaving){
|
|||||||
for(size_t i=0; i<layerBundle.size(); i++) {
|
for(size_t i=0; i<layerBundle.size(); i++) {
|
||||||
LayerObject layer = layerBundle[i];
|
LayerObject layer = layerBundle[i];
|
||||||
QImage cpy = layer.image->getDisplayable(layer.alpha);
|
QImage cpy = layer.image->getDisplayable(layer.alpha);
|
||||||
|
if(renderSettings.getFastRenderer()){
|
||||||
|
cpy = cpy.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
QColor clr_0;
|
QColor clr_0;
|
||||||
QColor clr_1;
|
QColor clr_1;
|
||||||
for(int y=0; y<layer.height; y++) {
|
for(int y=0; y<layer.height; y++) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "Image/IntelliShapedImage.h"
|
#include "Image/IntelliShapedImage.h"
|
||||||
#include "Tool/IntelliTool.h"
|
#include "Tool/IntelliTool.h"
|
||||||
#include "IntelliHelper/IntelliColorPicker.h"
|
#include "IntelliHelper/IntelliColorPicker.h"
|
||||||
|
#include "IntelliHelper/IntelliRenderSettings.h"
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The LayerObject struct holds all the information needed to construct a layer
|
* \brief The LayerObject struct holds all the information needed to construct a layer
|
||||||
@@ -200,8 +201,9 @@ private:
|
|||||||
int maxWidth;
|
int maxWidth;
|
||||||
int maxHeight;
|
int maxHeight;
|
||||||
|
|
||||||
IntelliTool* Tool;
|
IntelliRenderSettings renderSettings;
|
||||||
IntelliColorPicker colorPicker;
|
IntelliColorPicker colorPicker;
|
||||||
|
IntelliTool* Tool;
|
||||||
|
|
||||||
std::vector<LayerObject> layerBundle;
|
std::vector<LayerObject> layerBundle;
|
||||||
int activeLayer=-1;
|
int activeLayer=-1;
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ void IntelliTool::createToolLayer(){
|
|||||||
void IntelliTool::mergeToolLayer(){
|
void IntelliTool::mergeToolLayer(){
|
||||||
QColor clr_0;
|
QColor clr_0;
|
||||||
QColor clr_1;
|
QColor clr_1;
|
||||||
|
if(Area->renderSettings.getFastRenderer()){
|
||||||
|
activeLayer->image->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||||
|
}
|
||||||
for(int y=0; y<activeLayer->height; y++) {
|
for(int y=0; y<activeLayer->height; y++) {
|
||||||
for(int x=0; x<activeLayer->width; x++) {
|
for(int x=0; x<activeLayer->width; x++) {
|
||||||
clr_0=activeLayer->image->imageData.pixelColor(x,y);
|
clr_0=activeLayer->image->imageData.pixelColor(x,y);
|
||||||
@@ -73,6 +76,9 @@ void IntelliTool::mergeToolLayer(){
|
|||||||
activeLayer->image->imageData.setPixelColor(x, y, clr_0);
|
activeLayer->image->imageData.setPixelColor(x, y, clr_0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(Area->renderSettings.getFastRenderer()){
|
||||||
|
activeLayer->image->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::deleteToolLayer(){
|
void IntelliTool::deleteToolLayer(){
|
||||||
|
|||||||
Reference in New Issue
Block a user