PaintingArea.cpp
Go to the documentation of this file.
// ---------- PaintingArea.cpp ----------
#include "string.h"
#include <vector>
#include <QtWidgets>
#include <QPoint>
#include <QRect>
#include "PaintingArea.h"
#include "Image/IntelliRasterImage.h"
#include "Image/IntelliShapedImage.h"
#include "Tool/IntelliToolPen.h"
#include "Tool/IntelliToolPlain.h"
#include "Tool/IntelliToolLine.h"
#include "Tool/IntelliToolCircle.h"
#include "Tool/IntelliToolRectangle.h"
#include "Tool/IntelliToolFloodFill.h"
#include "Tool/IntelliToolPolygon.h"
#include "Tool/IntelliToolGradient.h"
#include "GUI/IntelliPhotoGui.h"
LayerObject::LayerObject(){
}
LayerObject::LayerObject(const LayerObject& layer){
if(layer.image->getTypeOfImage()==ImageType::RASTERIMAGE) {
this->image = new IntelliRasterImage(*dynamic_cast< IntelliRasterImage*>(layer.image));
}else if(layer.image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
this->image = new IntelliShapedImage(*dynamic_cast< IntelliShapedImage*>(layer.image));
}
this->width = layer.width;
this->height = layer.height;
this->widthOffset = layer.widthOffset;
this->heightOffset = layer.heightOffset;
this->alpha = layer.alpha;
}
PaintingArea::PaintingArea(int newMaxWidth, int newMaxHeight, QWidget*parent)
: QLabel(parent){
this->Tool = nullptr;
this->setCanvasDimensions(newMaxWidth, newMaxHeight);
activeLayer = -1;
}
PaintingArea::~PaintingArea(){
delete Tool;
}
void PaintingArea::setRenderSettings(bool isFastRenderingOn){
bool ToolIsActive;
if(Tool!=nullptr) {
ToolIsActive = Tool->getIsDrawing();
}
else{
ToolIsActive = false;
}
if(isFastRenderingOn != renderSettings.isFastRenderering() && !ToolIsActive) {
renderSettings.setFastRendering(isFastRenderingOn);
for(auto& layer : layerBundle) {
layer.image->updateRendererSetting(isFastRenderingOn);
}
}
}
bool PaintingArea::getRenderSettings(){
return this->renderSettings.isFastRenderering();
}
void PaintingArea::setCanvasDimensions(int newMaxWidth, int newMaxHeight){
//set standart parameter
this->maxWidth = newMaxWidth;
this->maxHeight = newMaxHeight;
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
this->offsetXDimension = maxWidth / 2;
this->offsetYDimension = maxHeight / 2;
// Roots the widget to the top left even if resized
setAttribute(Qt::WA_StaticContents);
}
void PaintingArea::drawPixelOntoActive(QColor color, QPoint point){
layerBundle[static_cast<size_t>(activeLayer)].image->drawPixel(point, color);
}
void PaintingArea::setPolygonDataToActive(std::vector<QPoint> points){
layerBundle[static_cast<size_t>(activeLayer)].image->setPolygon(points);
}
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset,int alpha, ImageType type){
LayerObject newLayer;
updateTools();
newLayer.width = width;
newLayer.height = height;
newLayer.widthOffset = widthOffset;
newLayer.heightOffset = heightOffset;
newLayer.alpha = alpha;
if(type==ImageType::RASTERIMAGE) {
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
}else if(type==ImageType::SHAPEDIMAGE) {
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
}
this->layerBundle.push_back(newLayer);
activeLayer = static_cast<int>(layerBundle.size()) - 1;
return activeLayer;
}
void PaintingArea::deleteLayer(int idx, bool isTool){
if(!isTool) {
updateTools();
}
if(idx<static_cast<int>(layerBundle.size())&&idx>=0) {
this->layerBundle.erase(layerBundle.begin() + idx);
if(activeLayer>=idx) {
activeLayer--;
}
if(activeLayer < 0 && layerBundle.size()) {
activeLayer = 0;
}
}
}
void PaintingArea::slotDeleteActiveLayer(){
if(activeLayer>=0 && activeLayer < static_cast<int>(layerBundle.size())) {
this->layerBundle.erase(layerBundle.begin() + activeLayer);
activeLayer--;
}
historyadd();
}
void PaintingArea::setLayerActive(int idx){
updateTools();
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
this->activeLayer = idx;
}
}
void PaintingArea::setLayerAlpha(int idx, int alpha){
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
if(alpha>=0 && alpha<=255) {
layerBundle[static_cast<size_t>(idx)].alpha = alpha;
}
}
}
void PaintingArea::setPolygon(int idx){
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
delete this->Tool;
this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
isSettingPolygon = true;
this->guiReference->setToolWidth(5);
}
}
}
// Used to load the image and place it in the widget
bool PaintingArea::open(const QString &filePath){
if(this->activeLayer==-1) {
return false;
}
IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
bool open = active->loadImage(filePath);
active->calculateVisiblity();
update();
return open;
}
void PaintingArea::deleteAllLayers(){
for(auto layer: layerBundle) {
delete layer.image;
}
layerBundle.clear();
}
// Save the current image
bool PaintingArea::save(const QString &filePath, const char*fileFormat){
if(layerBundle.size()==0) {
return false;
}
this->drawLayers(true);
if(!strcmp(fileFormat,"PNG")) {
QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8);
fileFormat = "png";
if (visibleImage.save(filePath, fileFormat)) {
return true;
} else {
return false;
}
}
if (Canvas->save(filePath, fileFormat)) {
return true;
} else {
return false;
}
}
void PaintingArea::movePositionActive(int x, int y){
updateTools();
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
historyadd();
}
void PaintingArea::moveActiveLayer(int idx){
updateTools();
if(idx==1) {
this->selectLayerUp();
}else if(idx==-1) {
this->selectLayerDown();
}
guiReference->UpdateGui();
historyadd();
}
void PaintingArea::slotActivateLayer(int a){
updateTools();
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
this->setLayerActive(a);
}
}
void PaintingArea::colorPickerSetFirstColor(){
QColor clr = QColorDialog::getColor(colorPicker.getFirstColor(), nullptr, "Main Color", QColorDialog::DontUseNativeDialog);
this->colorPicker.setFirstColor(clr);
}
void PaintingArea::colorPickerSetSecondColor(){
QColor clr = QColorDialog::getColor(colorPicker.getSecondColor(), nullptr, "Secondary Color", QColorDialog::DontUseNativeDialog);
this->colorPicker.setSecondColor(clr);
}
void PaintingArea::colorPickerSwapColors(){
this->colorPicker.swapColors();
}
void PaintingArea::createPenTool(){
delete this->Tool;
Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createPlainTool(){
delete this->Tool;
Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createLineTool(){
delete this->Tool;
Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createRectangleTool(){
delete this->Tool;
Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createCircleTool(){
delete this->Tool;
Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createPolygonTool(){
delete this->Tool;
Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createFloodFillTool(){
delete this->Tool;
Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings);
}
void PaintingArea::createGradientTool(){
delete this->Tool;
Tool = new IntelliToolGradient(this, &colorPicker, &Toolsettings);
}
int PaintingArea::getWidthOfActive(){
return this->layerBundle[static_cast<size_t>(activeLayer)].width;
}
int PaintingArea::getHeightOfActive(){
return this->layerBundle[static_cast<size_t>(activeLayer)].height;
}
int PaintingArea::getMaxWidth(){
return this->maxWidth;
}
int PaintingArea::getMaxHeight(){
return this->maxHeight;
}
ImageType PaintingArea::getTypeOfImageActiveLayer(){
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getTypeOfImage();
}
std::vector<QPoint> PaintingArea::getPolygonDataOfActiveLayer(){
return this->layerBundle[static_cast<size_t>(activeLayer)].image->getPolygonData();
}
// If a mouse button is pressed check if it was the
// left button and if so store the current position
// Set that we are currently drawing
void PaintingArea::mousePressEvent(QMouseEvent*event){
if(this->activeLayer < 0) {
return;
}
if(Tool == nullptr)
return;
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
if(event->button() == Qt::LeftButton) {
Tool->onMouseLeftPressed(x, y);
}else if(event->button() == Qt::RightButton) {
Tool->onMouseRightPressed(x, y);
}
update();
}
// When the mouse moves if the left button is clicked
// we call the drawline function which draws a line
// from the last position to the current
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
if(this->activeLayer < 0) {
return;
}
if(Tool == nullptr)
return;
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
Tool->onMouseMoved(x, y);
update();
}
// If the button is released we set variables to stop drawing
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
if(this->activeLayer < 0)
return;
if(Tool == nullptr)
return;
int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
if(event->button() == Qt::LeftButton) {
Tool->onMouseLeftReleased(x, y);
}else if(event->button() == Qt::RightButton) {
Tool->onMouseRightReleased(x, y);
}
update();
}
void PaintingArea::wheelEvent(QWheelEvent*event){
if(this->activeLayer < 0)
return;
if(this->Tool != nullptr) {
QPoint numDegrees = event->angleDelta() / 8;
if(!numDegrees.isNull()) {
QPoint numSteps = numDegrees / 15;
Tool->onWheelScrolled(numSteps.y() * -1);
}
}
}
// QPainter provides functions to draw on the widget
// The QPaintEvent is sent to widgets that need to
// update themselves
void PaintingArea::paintEvent(QPaintEvent*event){
this->setFixedSize(QSize(maxWidth * 2,maxHeight * 2));
this->drawLayers();
QPainter painter(this);
//insert zoom factor here
painter.scale(1,1);
//calulate image here for scroll
//Todo set offset in first to parameters and calulate them into mouse position
painter.drawImage(0, 0, *Canvas, -offsetXDimension, -offsetYDimension);
update();
}
void PaintingArea::selectLayerUp(){
updateTools();
if(activeLayer != -1 && static_cast<size_t>(activeLayer)<layerBundle.size() - 1) {
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer + 1)]);
activeLayer++;
}
}
void PaintingArea::selectLayerDown(){
updateTools();
if(activeLayer>0) {
std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer - 1)]);
activeLayer--;
}
}
void PaintingArea::drawLayers(bool forSaving){
if(forSaving) {
Canvas->fill(Qt::GlobalColor::transparent);
}else{
Canvas->fill(Qt::GlobalColor::black);
}
for(size_t i = 0; i<layerBundle.size(); i++) {
LayerObject layer = layerBundle[i];
QImage cpy = layer.image->getDisplayable(layer.alpha);
QColor clr_0;
QColor clr_1;
for(int y = 0; y<layer.height; y++) {
if(layer.heightOffset + y<0) continue;
if(layer.heightOffset + y>=maxHeight) break;
for(int x = 0; x<layer.width; x++) {
if(layer.widthOffset + x<0) continue;
if(layer.widthOffset + x>=maxWidth) break;
clr_0 = Canvas->pixelColor(layer.widthOffset + x, layer.heightOffset + y);
clr_1 = cpy.pixelColor(x,y);
float t = static_cast<float>(clr_1.alpha()) / 255.f;
int r = static_cast<int>(static_cast<float>(clr_1.red()) * (t) + static_cast<float>(clr_0.red()) * (1.f - t) + 0.5f);
int g = static_cast<int>(static_cast<float>(clr_1.green()) * (t) + static_cast<float>(clr_0.green()) * (1.f - t) + 0.5f);
int b = static_cast<int>(static_cast<float>(clr_1.blue()) * (t) + static_cast<float>(clr_0.blue() * (1.f - t)) + 0.5f);
int a = std::min(clr_0.alpha() + clr_1.alpha(), 255);
clr_0.setRed(r);
clr_0.setGreen(g);
clr_0.setBlue(b);
clr_0.setAlpha(a);
Canvas->setPixelColor(layer.widthOffset + x, layer.heightOffset + y, clr_0);
}
}
}
}
bool PaintingArea::createTempTopLayer(int idx){
if(idx>=0) {
LayerObject newLayer;
newLayer.alpha = 255;
newLayer.height = layerBundle[static_cast<size_t>(idx)].height;
newLayer.width = layerBundle[static_cast<size_t>(idx)].width;
newLayer.heightOffset = layerBundle[static_cast<size_t>(idx)].heightOffset;
newLayer.widthOffset = layerBundle[static_cast<size_t>(idx)].widthOffset;
newLayer.image = layerBundle[static_cast<size_t>(idx)].image->getDeepCopy();
layerBundle.insert(layerBundle.begin() + idx + 1,newLayer);
return true;
}
return false;
}
IntelliTool* PaintingArea::copyActiveTool(){
switch(Tool->getTooltype()) {
case IntelliTool::Tooltype::CIRCLE: return new IntelliToolCircle(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::FLOODFILL: return new IntelliToolFloodFill(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::GRADIENT: return new IntelliToolGradient(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::LINE: return new IntelliToolLine(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::PEN: return new IntelliToolPen(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::PLAIN: return new IntelliToolPlainTool(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::POLYGON: return new IntelliToolPolygon(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::RECTANGLE: return new IntelliToolRectangle(this,&colorPicker, &Toolsettings);
case IntelliTool::Tooltype::NONE: return nullptr;
default: return nullptr;
}
}
int PaintingArea::getIndexOfActiveLayer(){
return activeLayer;
}
IntelliImage* PaintingArea::getImageOfActiveLayer(){
if(activeLayer<0) {
return nullptr;
}
return layerBundle[static_cast<size_t>(activeLayer)].image;
}
QImage PaintingArea::getImageDataOfActiveLayer(){
QImage returnImage;
if(activeLayer<0) {
returnImage = QImage(QSize(10,10),QImage::Format_ARGB32);
returnImage.fill(QColor(255,255,255,255));
}
else{
returnImage = layerBundle[static_cast<size_t>(activeLayer)].image->getImageData();
if(renderSettings.isFastRenderering()) {
returnImage = returnImage.convertToFormat(QImage::Format_ARGB32);
}
}
return returnImage;
}
std::vector<LayerObject>* PaintingArea::getLayerBundle(){
return &layerBundle;
}
void PaintingArea::updateTools(){
if(Tool!=nullptr) {
if(Tool->getIsDrawing()) {
IntelliTool* temp = copyActiveTool();
delete this->Tool;
this->Tool = temp;
}
if(isSettingPolygon) {
delete this->Tool;
this->Tool = nullptr;
isSettingPolygon = false;
}
}
}
void PaintingArea::historyadd(){
history.erase(history.begin() + historyPresent + 1,history.end());
historyPresent++;
history.push_back(layerBundle);
}
void PaintingArea::historyGoBack(){
historyPresent--;
if( historyPresent<0) {
historyPresent = 0;
}
layerBundle = history[static_cast<size_t>(historyPresent)];
this->guiReference->UpdateGui();
}
void PaintingArea::historyGoForward(){
historyPresent++;
if(historyPresent>=static_cast<int>(history.size())) {
historyPresent = static_cast<int>(history.size() - 1);
}
layerBundle = history[static_cast<size_t>(historyPresent)];
this->guiReference->UpdateGui();
}
PaintingArea::getWidthOfActive
int getWidthOfActive()
The getWidthOfActive gets the horizontal dimensions of the active layer.
Definition: PaintingArea.cpp:282
IntelliTool::Tooltype::PEN
@ PEN
PaintingArea::createCircleTool
void createCircleTool()
createCircleTool creates a Circle Tool.
Definition: PaintingArea.cpp:263
IntelliTool::onMouseRightPressed
virtual void onMouseRightPressed(int x, int y)
A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on....
Definition: IntelliTool.cpp:19
IntelliColorPicker::getFirstColor
QColor getFirstColor() const
A function to read the primary selected color.
Definition: IntelliColorPicker.cpp:15
ImageType::RASTERIMAGE
@ RASTERIMAGE
IntelliTool::onMouseLeftReleased
virtual void onMouseLeftReleased(int x, int y)
A function managing the left click Released of a Mouse. Call this in child classes!
Definition: IntelliTool.cpp:37
ImageType
ImageType
The Types, which an Image can be.
Definition: IntelliImage.h:22
PaintingArea::setRenderSettings
void setRenderSettings(bool isFastRenderingOn)
setRenderSettings updates all Images to the new Rendersetting.
Definition: PaintingArea.cpp:51
PaintingArea::getImageOfActiveLayer
IntelliImage * getImageOfActiveLayer()
getImageOfActiveLayer returns the image of the active Layer.
Definition: PaintingArea.cpp:471
PaintingArea::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
mouseReleaseEvent handles a mouse released event
Definition: PaintingArea.cpp:341
PaintingArea::createRectangleTool
void createRectangleTool()
createRectangleTool creates a Rectangle Tool.
Definition: PaintingArea.cpp:258
IntelliToolPolygon.h
IntelliTool::onMouseLeftPressed
virtual void onMouseLeftPressed(int x, int y)
A function managing the left click Pressed of a Mouse. Resetting the current draw....
Definition: IntelliTool.cpp:30
IntelliTool::getIsDrawing
bool getIsDrawing() const
getIsDrawing returns if the tool is currently drawing
Definition: IntelliTool.cpp:105
PaintingArea::getMaxWidth
int getMaxWidth()
getMaxWidth gets the max width of the Canvas.
Definition: PaintingArea.cpp:290
IntelliShapedImage.h
PaintingArea::PaintingArea
PaintingArea(int newMaxWidth=600, int newMaxHeight=600, QWidget *parent=nullptr)
PaintingArea is the constructor of the PaintingArea class, which initiates the working environment.
Definition: PaintingArea.cpp:40
IntelliRenderSettings::isFastRenderering
bool isFastRenderering() const
The getfastRenderer gets the value of the flag for the fastRenderer setting.
Definition: IntelliRenderSettings.cpp:12
PaintingArea::save
bool save(const QString &filePath, const char *fileFormat)
The save method is used for exporting the current project as one picture.
Definition: PaintingArea.cpp:181
IntelliTool::getTooltype
Tooltype getTooltype() const
getTooltype returns the tools type
Definition: IntelliTool.cpp:101
PaintingArea::setLayerAlpha
void setLayerAlpha(int idx, int alpha)
The setAlphaOfLayer method sets the alpha value of a specific layer.
Definition: PaintingArea.cpp:143
IntelliTool::Tooltype::FLOODFILL
@ FLOODFILL
PaintingArea::getPolygonDataOfActiveLayer
std::vector< QPoint > getPolygonDataOfActiveLayer()
getPolygonDataOfActiveLayer get the polygon data of the active Layer.
Definition: PaintingArea.cpp:302
PaintingArea::setLayerActive
void setLayerActive(int idx)
The setLayerToActive method marks a specific layer as active.
Definition: PaintingArea.cpp:136
LayerObject::widthOffset
int widthOffset
widthOffset - Stores the number of pixles from the left side of the painting area.
Definition: PaintingArea.h:39
PaintingArea::getMaxHeight
int getMaxHeight()
getMaxHeight gets the max height of the Canvas.
Definition: PaintingArea.cpp:294
IntelliTool::Tooltype::NONE
@ NONE
PaintingArea::deleteLayer
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
Definition: PaintingArea.cpp:113
IntelliToolPlainTool
The IntelliToolPlainTool class represents a tool to fill the whole canvas with one color.
Definition: IntelliToolPlain.h:13
IntelliColorPicker::setSecondColor
void setSecondColor(QColor Color)
A function to set the secondary color.
Definition: IntelliColorPicker.cpp:27
IntelliShapedImage
The IntelliShapedImage manages a Shapedimage.
Definition: IntelliShapedImage.h:13
LayerObject::heightOffset
int heightOffset
heightOffset - Stores the number of pixles from the top of the painting area.
Definition: PaintingArea.h:43
PaintingArea::getHeightOfActive
int getHeightOfActive()
The getHeightOfActive gets the vertical dimensions of the active layer.
Definition: PaintingArea.cpp:286
IntelliToolFloodFill.h
IntelliImage::getDisplayable
virtual QImage getDisplayable(const QSize &displaySize, int alpha)=0
A function returning the displayable ImageData in a requested transparence and size.
PaintingArea::createPlainTool
void createPlainTool()
createPlainTool creates a Plain Tool.
Definition: PaintingArea.cpp:248
PaintingArea::wheelEvent
void wheelEvent(QWheelEvent *event) override
wheelEvent handles a mouse wheel event
Definition: PaintingArea.cpp:356
IntelliImage::getTypeOfImage
virtual ImageType getTypeOfImage()
Definition: IntelliImage.h:139
LayerObject
The LayerObject struct holds all the information needed to construct a layer.
Definition: PaintingArea.h:23
PaintingArea::createPenTool
void createPenTool()
createPenTool creates a Pen Tool.
Definition: PaintingArea.cpp:243
IntelliToolPlain.h
PaintingArea::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
mousePressEvent handles a mouse pressed event.
Definition: PaintingArea.cpp:309
IntelliRasterImage.h
LayerObject::alpha
int alpha
alpha - Stores the alpha value of the layer (default=255).
Definition: PaintingArea.h:47
IntelliColorPicker::getSecondColor
QColor getSecondColor() const
A function to read the secondary selected color.
Definition: IntelliColorPicker.cpp:19
PaintingArea::getIndexOfActiveLayer
int getIndexOfActiveLayer()
getIndexOfActiveLayer returns the index of athe active Layer.
Definition: PaintingArea.cpp:467
PaintingArea::drawPixelOntoActive
void drawPixelOntoActive(QColor color, QPoint point)
drawPixelOntoActive draws a pixel onto the image data of the active Layer.
Definition: PaintingArea.cpp:86
PaintingArea::historyGoBack
void historyGoBack()
historyGoBack go back in hisotry
Definition: PaintingArea.cpp:519
IntelliToolRectangle
The IntelliToolRectangle class represents a tool to draw a rectangle.
Definition: IntelliToolRectangle.h:15
PaintingArea::createLineTool
void createLineTool()
createLineTool creates a Line Tool.
Definition: PaintingArea.cpp:253
IntelliToolLine.h
IntelliToolPen
The IntelliToolPen class represents a tool to draw a line.
Definition: IntelliToolPen.h:14
PaintingArea::colorPickerSetSecondColor
void colorPickerSetSecondColor()
The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color.
Definition: PaintingArea.cpp:234
IntelliTool::onMouseRightReleased
virtual void onMouseRightReleased(int x, int y)
A function managing the right click Released of a Mouse. Merging the Canvas to Active....
Definition: IntelliTool.cpp:26
PaintingArea::colorPickerSetFirstColor
void colorPickerSetFirstColor()
The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color.
Definition: PaintingArea.cpp:229
IntelliTool::Tooltype::PLAIN
@ PLAIN
IntelliTool::Tooltype::POLYGON
@ POLYGON
PaintingArea::getLayerBundle
std::vector< LayerObject > * getLayerBundle()
getLayerBundle returns the real active layerbundle (care!)
Definition: PaintingArea.cpp:493
LayerObject::width
int width
width - Stores the width of a layer in pixels.
Definition: PaintingArea.h:31
IntelliToolRectangle.h
PaintingArea::~PaintingArea
~PaintingArea() override
This deconstructor is used to clear up the memory and remove the currently active window.
Definition: PaintingArea.cpp:47
PaintingArea::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override
mouseMoveEvent handles a mouse moved event
Definition: PaintingArea.cpp:328
IntelliPhotoGui.h
IntelliColorPicker::setFirstColor
void setFirstColor(QColor Color)
A function to set the primary color.
Definition: IntelliColorPicker.cpp:23
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:17
PaintingArea::slotDeleteActiveLayer
void slotDeleteActiveLayer()
The slotDeleteActiveLayer method handles the deletion of the active layer.
Definition: PaintingArea.cpp:128
ImageType::SHAPEDIMAGE
@ SHAPEDIMAGE
PaintingArea::getTypeOfImageActiveLayer
ImageType getTypeOfImageActiveLayer()
getTypeOfImageActiveLayer get the type of the active Layer.
Definition: PaintingArea.cpp:298
IntelliPhotoGui::setToolWidth
void setToolWidth(int value)
setToolWidth stes a width to the tool
Definition: IntelliPhotoGui.cpp:923
PaintingArea::open
bool open(const QString &filePath)
The open method is used for loading a picture into the current layer.
Definition: PaintingArea.cpp:162
PaintingArea::createPolygonTool
void createPolygonTool()
createPolygonTool creates a Polygon Tool.
Definition: PaintingArea.cpp:267
PaintingArea::moveActiveLayer
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
Definition: PaintingArea.cpp:211
PaintingArea::colorPicker
IntelliColorPicker colorPicker
colorPicker a class to manage Tool color.
Definition: PaintingArea.h:286
PaintingArea.h
LayerObject::height
int height
height - Stores the height of a layer in pixels.
Definition: PaintingArea.h:35
PaintingArea::deleteAllLayers
void deleteAllLayers()
deleteAllLayers deletes all layers
Definition: PaintingArea.cpp:173
PaintingArea::getImageDataOfActiveLayer
QImage getImageDataOfActiveLayer()
getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer ...
Definition: PaintingArea.cpp:478
PaintingArea::createFloodFillTool
void createFloodFillTool()
createFloodFillTool creates a Floodfill Tool.
Definition: PaintingArea.cpp:272
PaintingArea::slotActivateLayer
void slotActivateLayer(int a)
The slotActivateLayer method handles the event of selecting one layer as active.
Definition: PaintingArea.cpp:222
PaintingArea::setCanvasDimensions
void setCanvasDimensions(int newMaxWidth, int newMaxHeight)
setCanvasDimensions sets the dimension of the Canvas
Definition: PaintingArea.cpp:72
PaintingArea::paintEvent
void paintEvent(QPaintEvent *event) override
paintEvent handles a painting event
Definition: PaintingArea.cpp:371
IntelliRenderSettings::setFastRendering
void setFastRendering(bool Updatedsetting)
setFastRendering sets fastRendering to Updatedsetting.
Definition: IntelliRenderSettings.cpp:8
IntelliPhotoGui::UpdateGui
void UpdateGui()
UpdateGui a function to update all gui elements.
Definition: IntelliPhotoGui.cpp:932
IntelliTool::Tooltype::RECTANGLE
@ RECTANGLE
PaintingArea::getRenderSettings
bool getRenderSettings()
getRenderSettings updates all Images to the new Rendersetting.
Definition: PaintingArea.cpp:68
LayerObject::image
IntelliImage * image
image - Stores the imageData of the current LayerObject.
Definition: PaintingArea.h:27
IntelliImage::loadImage
virtual bool loadImage(const QString &filePath)
A function that loads and sclaes an image to the fitting dimensions.
Definition: IntelliImage.cpp:23
PaintingArea::Toolsettings
IntelliToolsettings Toolsettings
Toolsettings - a class to manage Tool settings.
Definition: PaintingArea.h:281
PaintingArea::setPolygon
void setPolygon(int idx)
setPolygon is used for setting polygondata, it only works on RASTER images
Definition: PaintingArea.cpp:150
IntelliTool::Tooltype::LINE
@ LINE
IntelliColorPicker::swapColors
void swapColors()
A function switching primary and secondary color.
Definition: IntelliColorPicker.cpp:11
IntelliToolFloodFill
The IntelliToolFloodFill class represents a tool to flood FIll a certian area.
Definition: IntelliToolFloodFill.h:14
PaintingArea::colorPickerSwapColors
void colorPickerSwapColors()
The colorPickerSwitchColor swaps the primary color with the secondary drawing color.
Definition: PaintingArea.cpp:239
IntelliToolPen.h
IntelliToolCircle
The IntelliToolCircle class represents a tool to draw a circle.
Definition: IntelliToolCircle.h:14
PaintingArea::movePositionActive
void movePositionActive(int x, int y)
The movePositionActive method moves the active layer to certain position.
Definition: PaintingArea.cpp:204
IntelliTool::Tooltype::GRADIENT
@ GRADIENT
IntelliImage
An abstract class which manages the basic IntelliImage operations.
Definition: IntelliImage.h:30
IntelliTool::onMouseMoved
virtual void onMouseMoved(int x, int y)
A function managing the mouse moved event. Call this in child classes!
Definition: IntelliTool.cpp:48
PaintingArea::addLayer
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, int alpha=255, ImageType type=ImageType::RASTERIMAGE)
The addLayer adds a layer to the current project/ painting area.
Definition: PaintingArea.cpp:94
IntelliToolPolygon
The IntelliToolPolygon managed the Drawing of Polygonforms.
Definition: IntelliToolPolygon.h:15
PaintingArea::historyGoForward
void historyGoForward()
historyGoForward a function to undo the return of the previous state of the project.
Definition: PaintingArea.cpp:528
IntelliImage::calculateVisiblity
virtual void calculateVisiblity()=0
An abstract function that calculates the visiblity of the Image data if needed.
PaintingArea::historyadd
void historyadd()
historyadd adds an hisotry step
Definition: PaintingArea.cpp:512
LayerObject::LayerObject
LayerObject()
Definition: PaintingArea.cpp:23
IntelliTool::onWheelScrolled
virtual void onWheelScrolled(int value)
A function managing the scroll event. A positive value means scrolling outwards. Call this in child c...
Definition: IntelliTool.cpp:53
IntelliRasterImage
The IntelliRasterImage manages a RASTERIMAGE.
Definition: IntelliRasterImage.h:12
PaintingArea::setPolygonDataToActive
void setPolygonDataToActive(std::vector< QPoint > points)
setPolygonDataToActive sets polygondata to the active Layer.
Definition: PaintingArea.cpp:90
IntelliToolCircle.h
PaintingArea::createGradientTool
void createGradientTool()
createGradientTool creates a Gradient Tool.
Definition: PaintingArea.cpp:277
IntelliToolGradient
The IntelliToolGradient class that represents a gradient call.
Definition: IntelliToolGradient.h:7
IntelliToolGradient.h
IntelliTool::Tooltype::CIRCLE
@ CIRCLE
IntelliToolLine
The IntelliToolFloodFill class represents a tool to draw a line.
Definition: IntelliToolLine.h:13