IntelliPhoto  0.5
PaintingArea.h
Go to the documentation of this file.
1 
2 #ifndef PaintingArea_H
3 #define PaintingArea_H
4 
5 #include <QColor>
6 #include <QImage>
7 #include <QPoint>
8 #include <QWidget>
9 #include <QList>
10 #include "GUI/IntelliPhotoGui.h"
11 #include "Image/IntelliImage.h"
14 #include "Tool/IntelliTool.h"
16 
25 struct LayerObject {
27  int width;
28  int height;
31  int alpha = 255;
32 };
33 
37 class PaintingArea : public QWidget
38 {
39 Q_OBJECT
40 friend IntelliTool;
41 friend IntelliPhotoGui;
42 public:
49 PaintingArea(int maxWidth = 600, int maxHeight = 600, QWidget*parent = nullptr);
50 
54 ~PaintingArea() override;
55 
60 void setRenderSettings(bool isFastRenderingOn);
61 
67 bool open(const QString &filePath);
74 bool save(const QString &filePath, const char*fileFormat);
75 
85 int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
96 int addLayerAt(int idx, int width, int height, int widthOffset = 0, int heightOffset = 0, IntelliImage::ImageType type = IntelliImage::ImageType::RASTERIMAGE);
102 void deleteLayer(int idx, bool isTool = false);
107 void setLayerActive(int idx);
113 void setLayerAlpha(int idx, int alpha);
118 void setPolygon(int idx);
124 void movePositionActive(int x, int y);
129 void moveActiveLayer(int idx);
130 
142 void colorPickerSwapColors();
143 
144 void createPenTool();
145 void createPlainTool();
146 void createLineTool();
147 void createRectangleTool();
148 void createCircleTool();
149 void createPolygonTool();
150 void createFloodFillTool();
151 
156 int getWidthOfActive();
161 int getHeightOfActive();
162 
163 int getMaxWidth();
164 
165 int getMaxHeight();
166 
168 
169 std::vector<QPoint> getPolygonDataOfRealLayer();
170 
172 
174 
180 
183 
184 public slots:
189 void slotActivateLayer(int a);
193 void slotDeleteActiveLayer();
194 
195 protected:
196 void mousePressEvent(QMouseEvent*event) override;
197 void mouseMoveEvent(QMouseEvent*event) override;
198 void mouseReleaseEvent(QMouseEvent*event) override;
199 
200 void wheelEvent(QWheelEvent*event) override;
201 
202 void paintEvent(QPaintEvent*event) override;
203 
204 void resizeEvent(QResizeEvent*event) override;
205 
206 private:
207 void setLayerDimensions(int maxWidth, int maxHeight);
208 void selectLayerUp();
209 void selectLayerDown();
210 IntelliTool* copyActiveTool();
211 
212 QImage* Canvas;
213 int maxWidth;
214 int maxHeight;
215 
216 bool isSettingPolygon = false;
217 
218 IntelliRenderSettings renderSettings;
219 IntelliTool* Tool;
220 IntelliPhotoGui* DummyGui;
221 
222 std::vector<LayerObject> layerBundle;
223 int activeLayer = -1;
224 
225 void drawLayers(bool forSaving = false);
226 
227 void resizeLayer(QImage*image_res, const QSize &newSize);
228 
229 bool createTempTopLayer(int idx);
230 
231 void updateTools();
232 };
233 
234 #endif
PaintingArea::getWidthOfActive
int getWidthOfActive()
The getWidthOfActive gets the horizontal dimensions of the active layer.
Definition: PaintingArea.cpp:225
PaintingArea::createCircleTool
void createCircleTool()
Definition: PaintingArea.cpp:211
PaintingArea::setRenderSettings
void setRenderSettings(bool isFastRenderingOn)
setRenderSettings updates all Images to the new Rendersetting.
Definition: PaintingArea.cpp:34
PaintingArea::getImageOfActiveLayer
IntelliImage * getImageOfActiveLayer()
Definition: PaintingArea.cpp:417
PaintingArea::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition: PaintingArea.cpp:284
PaintingArea::createRectangleTool
void createRectangleTool()
Definition: PaintingArea.cpp:206
IntelliTool.h
PaintingArea::getMaxWidth
int getMaxWidth()
Definition: PaintingArea.cpp:233
IntelliShapedImage.h
IntelliImage.h
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:131
PaintingArea::setLayerAlpha
void setLayerAlpha(int idx, int alpha)
The setAlphaOfLayer method sets the alpha value of a specific layer.
Definition: PaintingArea.cpp:102
IntelliRenderSettings
Definition: IntelliRenderSettings.h:5
PaintingArea::setLayerActive
void setLayerActive(int idx)
The setLayerToActive method marks a specific layer as active.
Definition: PaintingArea.cpp:95
LayerObject::widthOffset
int widthOffset
Definition: PaintingArea.h:29
PaintingArea::getMaxHeight
int getMaxHeight()
Definition: PaintingArea.cpp:237
PaintingArea::deleteLayer
void deleteLayer(int idx, bool isTool=false)
The deleteLayer method removes a layer at a given idx.
Definition: PaintingArea.cpp:73
IntelliPhotoGui
The IntelliPhotoGui base class handles the graphical user interface and events for the intelliPhoto p...
Definition: IntelliPhotoGui.h:27
LayerObject::heightOffset
int heightOffset
Definition: PaintingArea.h:30
PaintingArea::getHeightOfActive
int getHeightOfActive()
The getHeightOfActive gets the vertical dimensions of the active layer.
Definition: PaintingArea.cpp:229
PaintingArea::createPlainTool
void createPlainTool()
Definition: PaintingArea.cpp:196
PaintingArea::wheelEvent
void wheelEvent(QWheelEvent *event) override
Definition: PaintingArea.cpp:299
PaintingArea
The PaintingArea class manages the methods and stores information about the current painting area,...
Definition: PaintingArea.h:37
LayerObject
The LayerObject struct holds all the information needed to construct a layer.
Definition: PaintingArea.h:25
PaintingArea::createPenTool
void createPenTool()
Definition: PaintingArea.cpp:191
PaintingArea::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
Definition: PaintingArea.cpp:252
IntelliRasterImage.h
LayerObject::alpha
int alpha
Definition: PaintingArea.h:31
PaintingArea::createLineTool
void createLineTool()
Definition: PaintingArea.cpp:201
PaintingArea::colorPickerSetSecondColor
void colorPickerSetSecondColor()
The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color.
Definition: PaintingArea.cpp:182
PaintingArea::colorPickerSetFirstColor
void colorPickerSetFirstColor()
The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color.
Definition: PaintingArea.cpp:177
PaintingArea::addLayerAt
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type=IntelliImage::ImageType::RASTERIMAGE)
The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer...
IntelliColorPicker.h
PaintingArea::getTypeOfImageRealLayer
IntelliImage::ImageType getTypeOfImageRealLayer()
Definition: PaintingArea.cpp:241
LayerObject::width
int width
Definition: PaintingArea.h:27
PaintingArea::~PaintingArea
~PaintingArea() override
This deconstructor is used to clear up the memory and remove the currently active window.
Definition: PaintingArea.cpp:30
PaintingArea::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override
Definition: PaintingArea.cpp:271
IntelliPhotoGui.h
PaintingArea::getNumberOfActiveLayer
int getNumberOfActiveLayer()
Definition: PaintingArea.cpp:413
IntelliTool
An abstract class that manages the basic events, like mouse clicks or scrolls events.
Definition: IntelliTool.h:14
PaintingArea::slotDeleteActiveLayer
void slotDeleteActiveLayer()
The slotDeleteActiveLayer method handles the deletion of the active layer.
Definition: PaintingArea.cpp:88
PaintingArea::open
bool open(const QString &filePath)
The open method is used for loading a picture into the current layer.
Definition: PaintingArea.cpp:119
PaintingArea::createPolygonTool
void createPolygonTool()
Definition: PaintingArea.cpp:215
PaintingArea::moveActiveLayer
void moveActiveLayer(int idx)
The moveActiveLayer moves the active layer to a specific position in the layer stack.
Definition: PaintingArea.cpp:160
PaintingArea::colorPicker
IntelliColorPicker colorPicker
Definition: PaintingArea.h:182
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:22
LayerObject::height
int height
Definition: PaintingArea.h:28
PaintingArea::getImageDataOfActiveLayer
QImage getImageDataOfActiveLayer()
getImageDataOfActiveLayer used to get the currents active imageData (if there isn't any active layer ...
Definition: PaintingArea.cpp:424
PaintingArea::createFloodFillTool
void createFloodFillTool()
Definition: PaintingArea.cpp:220
PaintingArea::slotActivateLayer
void slotActivateLayer(int a)
The slotActivateLayer method handles the event of selecting one layer as active.
Definition: PaintingArea.cpp:170
IntelliColorPicker
The IntelliColorPicker manages the selected colors for one whole project.
Definition: IntelliColorPicker.h:11
PaintingArea::paintEvent
void paintEvent(QPaintEvent *event) override
Definition: PaintingArea.cpp:314
IntelliImage::ImageType::RASTERIMAGE
@ RASTERIMAGE
LayerObject::image
IntelliImage * image
Definition: PaintingArea.h:26
PaintingArea::getPolygonDataOfRealLayer
std::vector< QPoint > getPolygonDataOfRealLayer()
Definition: PaintingArea.cpp:245
PaintingArea::Toolsettings
IntelliToolsettings Toolsettings
Definition: PaintingArea.h:181
PaintingArea::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition: PaintingArea.cpp:325
PaintingArea::setPolygon
void setPolygon(int idx)
setPolygon is used for setting polygondata, it only works on RASTER images
Definition: PaintingArea.cpp:107
PaintingArea::colorPickerSwapColors
void colorPickerSwapColors()
The colorPickerSwitchColor swaps the primary color with the secondary drawing color.
Definition: PaintingArea.cpp:187
PaintingArea::movePositionActive
void movePositionActive(int x, int y)
The movePositionActive method moves the active layer to certain position.
Definition: PaintingArea.cpp:154
IntelliImage
An abstract class which manages the basic IntelliImage operations.
Definition: IntelliImage.h:19
IntelliToolsettings
Definition: IntelliToolsettings.h:4
PaintingArea::addLayer
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, IntelliImage::ImageType type=IntelliImage::ImageType::RASTERIMAGE)
The addLayer adds a layer to the current project/ painting area.
Definition: PaintingArea.cpp:54
IntelliImage::ImageType
ImageType
The Types, which an Image can be.
Definition: IntelliImage.h:26