IntelliPhoto  0.6
PaintingArea.cpp
Go to the documentation of this file.
1 // ---------- PaintingArea.cpp ----------
2 #include "string.h"
3 
4 #include <vector>
5 
6 #include <QtWidgets>
7 #include <QPoint>
8 #include <QRect>
9 
10 #include "PaintingArea.h"
13 #include "Tool/IntelliToolPen.h"
14 #include "Tool/IntelliToolPlain.h"
15 #include "Tool/IntelliToolLine.h"
16 #include "Tool/IntelliToolCircle.h"
20 #include "GUI/IntelliPhotoGui.h"
21 
23 
24 }
25 
28  this->image = new IntelliRasterImage(*dynamic_cast<IntelliRasterImage*>(layer.image));
29  }else if(layer.image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
30  this->image = new IntelliShapedImage(*dynamic_cast<IntelliShapedImage*>(layer.image));
31  }
32  this->width = layer.width;
33  this->height = layer.height;
34  this->widthOffset = layer.widthOffset;
35  this->heightOffset = layer.heightOffset;
36  this->alpha = layer.alpha;
37 }
38 
39 PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
40  : QLabel(parent){
41  this->Tool = nullptr;
42  this->setLayerDimensions(maxWidth, maxHeight);
43 
44  activeLayer = -1;
45 }
46 
48  delete Tool;
49 }
50 
51 void PaintingArea::setRenderSettings(bool isFastRenderingOn){
52  bool ToolIsActive;
53 
54  if(Tool!=nullptr) {
55  ToolIsActive = Tool->getIsDrawing();
56  }
57  else{
58  ToolIsActive = false;
59  }
60  if(isFastRenderingOn != renderSettings.isFastRenderering() && !ToolIsActive) {
61  renderSettings.setFastRendering(isFastRenderingOn);
62  for(auto& layer : layerBundle) {
63  layer.image->updateRendererSetting(isFastRenderingOn);
64  }
65  }
66 }
67 
69  return this->renderSettings.isFastRenderering();
70 }
71 
72 void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
73  //set standart parameter
74  this->maxWidth = maxWidth;
75  this->maxHeight = maxHeight;
76  Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
77 
78  this->offsetXDimension = maxWidth / 2;
79  this->offsetYDimension = maxHeight / 2;
80 
81  // Roots the widget to the top left even if resized
82  setAttribute(Qt::WA_StaticContents);
83 
84 }
85 
86 void PaintingArea::setPixelToActive(QColor color, QPoint point){
87  layerBundle[static_cast<size_t>(activeLayer)].image->drawPixel(point, color);
88 }
89 
90 void PaintingArea::setPolygonDataToActive(std::vector<QPoint> points){
91  layerBundle[static_cast<size_t>(activeLayer)].image->setPolygon(points);
92 }
93 
94 int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset,int alpha, ImageType type){
95  LayerObject newLayer;
96  updateTools();
97  newLayer.width = width;
98  newLayer.height = height;
99  newLayer.widthOffset = widthOffset;
100  newLayer.heightOffset = heightOffset;
101  newLayer.alpha = alpha;
102  if(type==ImageType::RASTERIMAGE) {
103  newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
104  }else if(type==ImageType::SHAPEDIMAGE) {
105  newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
106  }
107  this->layerBundle.push_back(newLayer);
108  activeLayer = static_cast<int>(layerBundle.size()) - 1;
109  historyadd();
110  return activeLayer;
111 }
112 
113 
114 void PaintingArea::deleteLayer(int idx, bool isTool){
115  if(!isTool) {
116  updateTools();
117  }
118  if(idx<static_cast<int>(layerBundle.size())&&idx>=0) {
119  this->layerBundle.erase(layerBundle.begin() + idx);
120  if(activeLayer>=idx) {
121  activeLayer--;
122  }
123  if(activeLayer < 0 && layerBundle.size()) {
124  activeLayer = 0;
125  }
126  }
127 }
128 
130  if(activeLayer>=0 && activeLayer < static_cast<int>(layerBundle.size())) {
131  this->layerBundle.erase(layerBundle.begin() + activeLayer);
132  activeLayer--;
133  }
134  historyadd();
135 }
136 
138  updateTools();
139  if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
140  this->activeLayer = idx;
141  }
142 }
143 
144 void PaintingArea::setLayerAlpha(int idx, int alpha){
145  if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
146  if(alpha>=0 && alpha<=255) {
147  layerBundle[static_cast<size_t>(idx)].alpha = alpha;
148  }
149  }
150 }
152  if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
153  if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==ImageType::SHAPEDIMAGE) {
154  delete this->Tool;
155  this->Tool = new IntelliToolPolygon(this,&colorPicker,&Toolsettings, true);
156  isSettingPolygon = true;
157  this->guiReference->setToolWidth(5);
158  }
159  }
160 }
161 
162 // Used to load the image and place it in the widget
163 bool PaintingArea::open(const QString &filePath){
164  if(this->activeLayer==-1) {
165  return false;
166  }
167  IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
168  bool open = active->loadImage(filePath);
169  active->calculateVisiblity();
170  update();
171  return open;
172 }
173 
175  for(auto layer: layerBundle) {
176  delete layer.image;
177  }
178  layerBundle.clear();
179 }
180 
181 // Save the current image
182 bool PaintingArea::save(const QString &filePath, const char*fileFormat){
183  if(layerBundle.size()==0) {
184  return false;
185  }
186  this->drawLayers(true);
187 
188  if(!strcmp(fileFormat,"PNG")) {
189  QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8);
190  fileFormat = "png";
191  if (visibleImage.save(filePath, fileFormat)) {
192  return true;
193  } else {
194  return false;
195  }
196  }
197 
198  if (Canvas->save(filePath, fileFormat)) {
199  return true;
200  } else {
201  return false;
202  }
203 }
204 
206  updateTools();
207  layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
208  layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
209  historyadd();
210 }
211 
213  updateTools();
214  if(idx==1) {
215  this->selectLayerUp();
216  }else if(idx==-1) {
217  this->selectLayerDown();
218  }
219  guiReference->UpdateGui();
220  historyadd();
221 }
222 
224  updateTools();
225  if(a>=0 && a < static_cast<int>(layerBundle.size())) {
226  this->setLayerActive(a);
227  }
228 }
229 
231  QColor clr = QColorDialog::getColor(colorPicker.getFirstColor(), nullptr, "Main Color", QColorDialog::DontUseNativeDialog);
232  this->colorPicker.setFirstColor(clr);
233 }
234 
236  QColor clr = QColorDialog::getColor(colorPicker.getSecondColor(), nullptr, "Secondary Color", QColorDialog::DontUseNativeDialog);
237  this->colorPicker.setSecondColor(clr);
238 }
239 
241  this->colorPicker.swapColors();
242 }
243 
245  delete this->Tool;
246  Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings);
247 }
248 
250  delete this->Tool;
251  Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings);
252 }
253 
255  delete this->Tool;
256  Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings);
257 }
258 
260  delete this->Tool;
261  Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings);
262 }
263 
265  delete this->Tool;
266  Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings);
267 }
269  delete this->Tool;
270  Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings);
271 }
272 
274  delete this->Tool;
275  Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings);
276 }
277 
279  return this->layerBundle[static_cast<size_t>(activeLayer)].width;
280 }
281 
283  return this->layerBundle[static_cast<size_t>(activeLayer)].height;
284 }
285 
287  return this->maxWidth;
288 }
289 
291  return this->maxHeight;
292 }
293 
295  return this->layerBundle[static_cast<size_t>(activeLayer)].image->getTypeOfImage();
296 }
297 
299  return this->layerBundle[static_cast<size_t>(activeLayer)].image->getPolygonData();
300 }
301 
302 // If a mouse button is pressed check if it was the
303 // left button and if so store the current position
304 // Set that we are currently drawing
305 void PaintingArea::mousePressEvent(QMouseEvent*event){
306  if(this->activeLayer < 0) {
307  return;
308  }
309  if(Tool == nullptr)
310  return;
311  int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
312  int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
313  if(event->button() == Qt::LeftButton) {
314  Tool->onMouseLeftPressed(x, y);
315  }else if(event->button() == Qt::RightButton) {
316  Tool->onMouseRightPressed(x, y);
317  }
318  update();
319 }
320 
321 // When the mouse moves if the left button is clicked
322 // we call the drawline function which draws a line
323 // from the last position to the current
324 void PaintingArea::mouseMoveEvent(QMouseEvent*event){
325  if(this->activeLayer < 0) {
326  return;
327  }
328  if(Tool == nullptr)
329  return;
330  int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
331  int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
332  Tool->onMouseMoved(x, y);
333  update();
334 }
335 
336 // If the button is released we set variables to stop drawing
337 void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
338  if(this->activeLayer < 0)
339  return;
340  if(Tool == nullptr)
341  return;
342  int x = event->x() - layerBundle[static_cast<size_t>(activeLayer)].widthOffset - offsetXDimension;
343  int y = event->y() - layerBundle[static_cast<size_t>(activeLayer)].heightOffset - offsetYDimension;
344  if(event->button() == Qt::LeftButton) {
345  Tool->onMouseLeftReleased(x, y);
346  }else if(event->button() == Qt::RightButton) {
347  Tool->onMouseRightReleased(x, y);
348  }
349  update();
350 }
351 
352 void PaintingArea::wheelEvent(QWheelEvent*event){
353  if(this->activeLayer < 0)
354  return;
355  if(this->Tool != nullptr) {
356  QPoint numDegrees = event->angleDelta() / 8;
357  if(!numDegrees.isNull()) {
358  QPoint numSteps = numDegrees / 15;
359  Tool->onWheelScrolled(numSteps.y() * -1);
360  }
361  }
362 }
363 
364 // QPainter provides functions to draw on the widget
365 // The QPaintEvent is sent to widgets that need to
366 // update themselves
367 void PaintingArea::paintEvent(QPaintEvent*event){
368  this->setFixedSize(QSize(maxWidth * 2,maxHeight * 2));
369  this->drawLayers();
370 
371  QPainter painter(this);
372 
373  //insert zoom factor here
374  painter.scale(1,1);
375 
376  //calulate image here for scroll
377  //Todo set offset in first to parameters and calulate them into mouse position
378  painter.drawImage(0, 0, *Canvas, -offsetXDimension, -offsetYDimension);
379  update();
380 }
381 
382 void PaintingArea::selectLayerUp(){
383  updateTools();
384  if(activeLayer != -1 && static_cast<size_t>(activeLayer)<layerBundle.size() - 1) {
385  std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer + 1)]);
386  activeLayer++;
387  }
388 }
389 
390 void PaintingArea::selectLayerDown(){
391  updateTools();
392  if(activeLayer>0) {
393  std::swap(layerBundle[static_cast<size_t>(activeLayer)], layerBundle[static_cast<size_t>(activeLayer - 1)]);
394  activeLayer--;
395  }
396 }
397 
398 void PaintingArea::drawLayers(bool forSaving){
399  if(forSaving) {
400  Canvas->fill(Qt::GlobalColor::transparent);
401  }else{
402  Canvas->fill(Qt::GlobalColor::black);
403  }
404  for(size_t i = 0; i<layerBundle.size(); i++) {
405  LayerObject layer = layerBundle[i];
406  QImage cpy = layer.image->getDisplayable(layer.alpha);
407  QColor clr_0;
408  QColor clr_1;
409  for(int y = 0; y<layer.height; y++) {
410  if(layer.heightOffset + y<0) continue;
411  if(layer.heightOffset + y>=maxHeight) break;
412  for(int x = 0; x<layer.width; x++) {
413  if(layer.widthOffset + x<0) continue;
414  if(layer.widthOffset + x>=maxWidth) break;
415  clr_0 = Canvas->pixelColor(layer.widthOffset + x, layer.heightOffset + y);
416  clr_1 = cpy.pixelColor(x,y);
417  float t = static_cast<float>(clr_1.alpha()) / 255.f;
418  int r = static_cast<int>(static_cast<float>(clr_1.red()) * (t) + static_cast<float>(clr_0.red()) * (1.f - t) + 0.5f);
419  int g = static_cast<int>(static_cast<float>(clr_1.green()) * (t) + static_cast<float>(clr_0.green()) * (1.f - t) + 0.5f);
420  int b = static_cast<int>(static_cast<float>(clr_1.blue()) * (t) + static_cast<float>(clr_0.blue() * (1.f - t)) + 0.5f);
421  int a = std::min(clr_0.alpha() + clr_1.alpha(), 255);
422  clr_0.setRed(r);
423  clr_0.setGreen(g);
424  clr_0.setBlue(b);
425  clr_0.setAlpha(a);
426 
427  Canvas->setPixelColor(layer.widthOffset + x, layer.heightOffset + y, clr_0);
428  }
429  }
430  }
431 }
432 
433 bool PaintingArea::createTempTopLayer(int idx){
434  if(idx>=0) {
435  LayerObject newLayer;
436  newLayer.alpha = 255;
437  newLayer.height = layerBundle[static_cast<size_t>(idx)].height;
438  newLayer.width = layerBundle[static_cast<size_t>(idx)].width;
439  newLayer.heightOffset = layerBundle[static_cast<size_t>(idx)].heightOffset;
440  newLayer.widthOffset = layerBundle[static_cast<size_t>(idx)].widthOffset;
441  newLayer.image = layerBundle[static_cast<size_t>(idx)].image->getDeepCopy();
442  layerBundle.insert(layerBundle.begin() + idx + 1,newLayer);
443  return true;
444  }
445  return false;
446 }
447 
448 IntelliTool* PaintingArea::copyActiveTool(){
449  switch(Tool->getTooltype()) {
457  default: return nullptr;
458  }
459 }
460 
462  return activeLayer;
463 }
464 
466  if(activeLayer<0) {
467  return nullptr;
468  }
469  return layerBundle[static_cast<size_t>(activeLayer)].image;
470 }
471 
473  QImage returnImage;
474  if(activeLayer<0) {
475  returnImage = QImage(QSize(10,10),QImage::Format_ARGB32);
476  returnImage.fill(QColor(255,255,255,255));
477  }
478  else{
479  returnImage = layerBundle[static_cast<size_t>(activeLayer)].image->getImageData();
480  if(renderSettings.isFastRenderering()) {
481  returnImage = returnImage.convertToFormat(QImage::Format_ARGB32);
482  }
483  }
484  return returnImage;
485 }
486 
487 std::vector<LayerObject>* PaintingArea::getLayerBundle(){
488  return &layerBundle;
489 }
490 
491 void PaintingArea::updateTools(){
492  if(Tool!=nullptr) {
493  if(Tool->getIsDrawing()) {
494  IntelliTool* temp = copyActiveTool();
495  delete this->Tool;
496  this->Tool = temp;
497  }
498  if(isSettingPolygon) {
499  delete this->Tool;
500  this->Tool = nullptr;
501  isSettingPolygon = false;
502  }
503  }
504 }
505 
506 void PaintingArea::historyadd(){
507 
508  if (++historyPresent == 100) {
509  historyPresent = 0;
510  }
511  historyMaxFuture = historyPresent;
512  if (historyPresent == historyMaxPast)
513  if (++historyMaxPast == 100)
514  historyMaxPast = 0;
515  history[static_cast<size_t>(historyPresent)] = layerBundle;
516 }
517 
519  if (historyPresent != historyMaxPast) {
520  if (--historyPresent == -1)
521  historyPresent = 99;
522  layerBundle = history[static_cast<size_t>(historyPresent)];
523  }
524  this->guiReference->UpdateGui();
525 }
526 
528  if (historyPresent != historyMaxFuture) {
529  if (++historyPresent == 100)
530  historyPresent = 0;
531  layerBundle = history[static_cast<size_t>(historyPresent)];
532  }
533  this->guiReference->UpdateGui();
534 }
PaintingArea::getWidthOfActive
int getWidthOfActive()
The getWidthOfActive gets the horizontal dimensions of the active layer.
Definition: PaintingArea.cpp:278
IntelliTool::Tooltype::PEN
@ PEN
PaintingArea::createCircleTool
void createCircleTool()
Definition: PaintingArea.cpp:264
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()
Definition: PaintingArea.cpp:465
PaintingArea::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition: PaintingArea.cpp:337
PaintingArea::createRectangleTool
void createRectangleTool()
Definition: PaintingArea.cpp:259
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
Definition: IntelliTool.cpp:105
PaintingArea::getMaxWidth
int getMaxWidth()
Definition: PaintingArea.cpp:286
IntelliShapedImage.h
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:182
IntelliTool::getTooltype
Tooltype getTooltype() const
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:144
IntelliTool::Tooltype::FLOODFILL
@ FLOODFILL
PaintingArea::setLayerActive
void setLayerActive(int idx)
The setLayerToActive method marks a specific layer as active.
Definition: PaintingArea.cpp:137
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()
Definition: PaintingArea.cpp:290
PaintingArea::deleteLayer
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
Definition: PaintingArea.cpp:114
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:282
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()
Definition: PaintingArea.cpp:249
PaintingArea::wheelEvent
void wheelEvent(QWheelEvent *event) override
Definition: PaintingArea.cpp:352
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()
Definition: PaintingArea.cpp:244
IntelliToolPlain.h
PaintingArea::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
Definition: PaintingArea.cpp:305
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::historyGoBack
void historyGoBack()
Definition: PaintingArea.cpp:518
IntelliToolRectangle
The IntelliToolRectangle class represents a tool to draw a rectangle.
Definition: IntelliToolRectangle.h:15
PaintingArea::createLineTool
void createLineTool()
Definition: PaintingArea.cpp:254
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:235
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:230
IntelliTool::Tooltype::PLAIN
@ PLAIN
IntelliTool::Tooltype::POLYGON
@ POLYGON
PaintingArea::getLayerBundle
std::vector< LayerObject > * getLayerBundle()
getLayerBundle returns the real active layerbundle (care!)
Definition: PaintingArea.cpp:487
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
Definition: PaintingArea.cpp:324
IntelliPhotoGui.h
PaintingArea::getNumberOfActiveLayer
int getNumberOfActiveLayer()
Definition: PaintingArea.cpp:461
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:129
ImageType::SHAPEDIMAGE
@ SHAPEDIMAGE
PaintingArea::getTypeOfImageRealLayer
ImageType getTypeOfImageRealLayer()
Definition: PaintingArea.cpp:294
IntelliPhotoGui::setToolWidth
void setToolWidth(int value)
Definition: IntelliPhotoGui.cpp:886
PaintingArea::open
bool open(const QString &filePath)
The open method is used for loading a picture into the current layer.
Definition: PaintingArea.cpp:163
PaintingArea::createPolygonTool
void createPolygonTool()
Definition: PaintingArea.cpp:268
PaintingArea::moveActiveLayer
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
Definition: PaintingArea.cpp:212
PaintingArea::colorPicker
IntelliColorPicker colorPicker
Definition: PaintingArea.h:223
PaintingArea::PaintingArea
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent=nullptr)
PaintingArea is the constructor of the PaintingArea class, which initiates the working environment.
Definition: PaintingArea.cpp:39
PaintingArea::setPixelToActive
void setPixelToActive(QColor color, QPoint point)
Definition: PaintingArea.cpp:86
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:174
PaintingArea::getImageDataOfActiveLayer
QImage getImageDataOfActiveLayer()
getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer ...
Definition: PaintingArea.cpp:472
PaintingArea::setLayerDimensions
void setLayerDimensions(int maxWidth, int maxHeight)
Definition: PaintingArea.cpp:72
PaintingArea::createFloodFillTool
void createFloodFillTool()
Definition: PaintingArea.cpp:273
PaintingArea::slotActivateLayer
void slotActivateLayer(int a)
The slotActivateLayer method handles the event of selecting one layer as active.
Definition: PaintingArea.cpp:223
PaintingArea::paintEvent
void paintEvent(QPaintEvent *event) override
Definition: PaintingArea.cpp:367
IntelliRenderSettings::setFastRendering
void setFastRendering(bool Updatedsetting)
setFastRendering sets fastRendering to Updatedsetting.
Definition: IntelliRenderSettings.cpp:8
IntelliPhotoGui::UpdateGui
void UpdateGui()
Definition: IntelliPhotoGui.cpp:895
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::getPolygonDataOfRealLayer
std::vector< QPoint > getPolygonDataOfRealLayer()
Definition: PaintingArea.cpp:298
PaintingArea::Toolsettings
IntelliToolsettings Toolsettings
Definition: PaintingArea.h:222
PaintingArea::setPolygon
void setPolygon(int idx)
setPolygon is used for setting polygondata, it only works on RASTER images
Definition: PaintingArea.cpp:151
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:240
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:205
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:47
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()
Definition: PaintingArea.cpp:527
IntelliImage::calculateVisiblity
virtual void calculateVisiblity()=0
An abstract function that calculates the visiblity of the Image data if needed.
LayerObject::LayerObject
LayerObject()
Definition: PaintingArea.cpp:22
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:52
IntelliRasterImage
The IntelliRasterImage manages a RASTERIMAGE.
Definition: IntelliRasterImage.h:12
PaintingArea::setPolygonDataToActive
void setPolygonDataToActive(std::vector< QPoint > points)
Definition: PaintingArea.cpp:90
IntelliToolCircle.h
IntelliTool::Tooltype::CIRCLE
@ CIRCLE
IntelliToolLine
The IntelliToolFloodFill class represents a tool to draw a line.
Definition: IntelliToolLine.h:13