IntelliPhoto  0.5
PaintingArea Class Reference

The PaintingArea class manages the methods and stores information about the current painting area, which is the currently opened project. More...

#include <PaintingArea.h>

Inheritance diagram for PaintingArea:

Public Slots

void slotActivateLayer (int a)
 The slotActivateLayer method handles the event of selecting one layer as active. More...
 
void slotDeleteActiveLayer ()
 The slotDeleteActiveLayer method handles the deletion of the active layer. More...
 

Public Member Functions

 PaintingArea (int maxWidth=600, int maxHeight=600, QWidget *parent=nullptr)
 PaintingArea is the constructor of the PaintingArea class, which initiates the working environment. More...
 
 ~PaintingArea () override
 This deconstructor is used to clear up the memory and remove the currently active window. More...
 
bool open (const QString &filePath)
 The open method is used for loading a picture into the current layer. More...
 
bool save (const QString &filePath, const char *fileFormat)
 The save method is used for exporting the current project as one picture. More...
 
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. More...
 
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 stack. More...
 
void deleteLayer (int idx)
 The deleteLayer method removes a layer at a given idx. More...
 
void setLayerActive (int idx)
 The setLayerToActive method marks a specific layer as active. More...
 
void setLayerAlpha (int idx, int alpha)
 The setAlphaOfLayer method sets the alpha value of a specific layer. More...
 
void floodFill (int r, int g, int b, int a)
 The floodFill method fills a the active layer with a given color. More...
 
void movePositionActive (int x, int y)
 The movePositionActive method moves the active layer to certain position. More...
 
void moveActiveLayer (int idx)
 The moveActiveLayer moves the active layer to a specific position in the layer stack. More...
 
void colorPickerSetFirstColor ()
 The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color. More...
 
void colorPickerSetSecondColor ()
 The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color. More...
 
void colorPickerSwapColors ()
 The colorPickerSwitchColor swaps the primary color with the secondary drawing color. More...
 
void createPenTool ()
 
void createPlainTool ()
 
void createLineTool ()
 
void createRectangleTool ()
 
void createCircleTool ()
 
void createPolygonTool ()
 
void createFloodFillTool ()
 
int getWidthOfActive ()
 The getWidthOfActive gets the horizontal dimensions of the active layer. More...
 
int getHeightOfActive ()
 The getHeightOfActive gets the vertical dimensions of the active layer. More...
 
IntelliImage::ImageType getTypeOfImageRealLayer ()
 
std::vector< QPoint > getPolygonDataOfRealLayer ()
 
int getNumberOfActiveLayer ()
 
IntelliImagegetImageOfActiveLayer ()
 

Public Attributes

IntelliToolsettings Toolsettings
 
IntelliColorPicker colorPicker
 

Protected Member Functions

void mousePressEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void wheelEvent (QWheelEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 

Detailed Description

The PaintingArea class manages the methods and stores information about the current painting area, which is the currently opened project.

Definition at line 37 of file PaintingArea.h.

Constructor & Destructor Documentation

◆ 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.

Parameters
maxWidth- The maximum amount of pixles that are inside painting area from left to right (default=600px)
maxHeight- The maximum amount of pixles that are inside painting area from top to bottom (default=600px)
parent- The parent window of the main window (default=nullptr)

Definition at line 21 of file PaintingArea.cpp.

◆ ~PaintingArea()

PaintingArea::~PaintingArea ( )
override

This deconstructor is used to clear up the memory and remove the currently active window.

Definition at line 41 of file PaintingArea.cpp.

Member Function Documentation

◆ addLayer()

int PaintingArea::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.

Parameters
width- Width of the layer in pixles
height- Height of the layer in pixles
widthOffset- Offset of the layer measured to the left border of the painting area in pixles
heightOffset- Offset of the layer measured to the top border of the painting area in pixles
type- Defining the ImageType of the new layer
Returns
Returns the number of layers in the project

Definition at line 56 of file PaintingArea.cpp.

◆ addLayerAt()

int PaintingArea::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 stack.

Parameters
idx- Index of the position the new layer should be added
width- Width of the layer in pixles
height- Height of the layer in pixles
widthOffset- Offset of the layer measured to the left border of the painting area in pixles
heightOffset- Offset of the layer measured to the top border of the painting area in pixles
type- Defining the ImageType of the new layer
Returns
Returns the id of the layer position

◆ colorPickerSetFirstColor()

void PaintingArea::colorPickerSetFirstColor ( )

The colorPickerSetFirstColor calls the QTColorPicker to determine the primary drawing color.

Definition at line 188 of file PaintingArea.cpp.

◆ colorPickerSetSecondColor()

void PaintingArea::colorPickerSetSecondColor ( )

The colorPickerSetSecondColor calls the QTColorPicker to determine the secondary drawing color.

Definition at line 193 of file PaintingArea.cpp.

◆ colorPickerSwapColors()

void PaintingArea::colorPickerSwapColors ( )

The colorPickerSwitchColor swaps the primary color with the secondary drawing color.

Definition at line 198 of file PaintingArea.cpp.

◆ createCircleTool()

void PaintingArea::createCircleTool ( )

Definition at line 222 of file PaintingArea.cpp.

◆ createFloodFillTool()

void PaintingArea::createFloodFillTool ( )

Definition at line 231 of file PaintingArea.cpp.

◆ createLineTool()

void PaintingArea::createLineTool ( )

Definition at line 212 of file PaintingArea.cpp.

◆ createPenTool()

void PaintingArea::createPenTool ( )

Definition at line 202 of file PaintingArea.cpp.

◆ createPlainTool()

void PaintingArea::createPlainTool ( )

Definition at line 207 of file PaintingArea.cpp.

◆ createPolygonTool()

void PaintingArea::createPolygonTool ( )

Definition at line 226 of file PaintingArea.cpp.

◆ createRectangleTool()

void PaintingArea::createRectangleTool ( )

Definition at line 217 of file PaintingArea.cpp.

◆ deleteLayer()

void PaintingArea::deleteLayer ( int  idx)

The deleteLayer method removes a layer at a given idx.

Parameters
idx- The index of the layer to be removed

Definition at line 74 of file PaintingArea.cpp.

◆ floodFill()

void PaintingArea::floodFill ( int  r,
int  g,
int  b,
int  a 
)

The floodFill method fills a the active layer with a given color.

Parameters
r- Red value of the color the layer should be filled with
g- Green value of the color the layer should be filled with
b- Blue value of the color the layer should be filled with
a- Alpha value of the color the layer should be filled with

Definition at line 139 of file PaintingArea.cpp.

◆ getHeightOfActive()

int PaintingArea::getHeightOfActive ( )

The getHeightOfActive gets the vertical dimensions of the active layer.

Returns
Returns the vertical pixle count of the active layer

Definition at line 240 of file PaintingArea.cpp.

◆ getImageOfActiveLayer()

IntelliImage * PaintingArea::getImageOfActiveLayer ( )

Definition at line 406 of file PaintingArea.cpp.

◆ getNumberOfActiveLayer()

int PaintingArea::getNumberOfActiveLayer ( )

Definition at line 402 of file PaintingArea.cpp.

◆ getPolygonDataOfRealLayer()

std::vector< QPoint > PaintingArea::getPolygonDataOfRealLayer ( )

Definition at line 248 of file PaintingArea.cpp.

◆ getTypeOfImageRealLayer()

IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer ( )

Definition at line 244 of file PaintingArea.cpp.

◆ getWidthOfActive()

int PaintingArea::getWidthOfActive ( )

The getWidthOfActive gets the horizontal dimensions of the active layer.

Returns
Returns the horizontal pixle count of the active layer

Definition at line 236 of file PaintingArea.cpp.

◆ mouseMoveEvent()

void PaintingArea::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 271 of file PaintingArea.cpp.

◆ mousePressEvent()

void PaintingArea::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 255 of file PaintingArea.cpp.

◆ mouseReleaseEvent()

void PaintingArea::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 281 of file PaintingArea.cpp.

◆ moveActiveLayer()

void PaintingArea::moveActiveLayer ( int  idx)

The moveActiveLayer moves the active layer to a specific position in the layer stack.

Parameters
idx- The index of the new position the layer should be in

Definition at line 160 of file PaintingArea.cpp.

◆ movePositionActive()

void PaintingArea::movePositionActive ( int  x,
int  y 
)

The movePositionActive method moves the active layer to certain position.

Parameters
x- The x value the new center of the layer should be at
y- The y value the new center of the layer should be at

Definition at line 148 of file PaintingArea.cpp.

◆ open()

bool PaintingArea::open ( const QString &  filePath)

The open method is used for loading a picture into the current layer.

Parameters
fileName- Path and filename which are used to determine where the to-be-opened file is stored
Returns
Returns a boolean variable whether the file was successfully opened or not

Definition at line 103 of file PaintingArea.cpp.

◆ paintEvent()

void PaintingArea::paintEvent ( QPaintEvent *  event)
overrideprotected

Definition at line 307 of file PaintingArea.cpp.

◆ resizeEvent()

void PaintingArea::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 318 of file PaintingArea.cpp.

◆ save()

bool PaintingArea::save ( const QString &  filePath,
const char *  fileFormat 
)

The save method is used for exporting the current project as one picture.

Parameters
fileName
fileFormat
Returns
Returns a boolean variable, true if the file was saved successfully, false if not

Definition at line 115 of file PaintingArea.cpp.

◆ setLayerActive()

void PaintingArea::setLayerActive ( int  idx)

The setLayerToActive method marks a specific layer as active.

Parameters
idx- The index of the layer to be active

Definition at line 90 of file PaintingArea.cpp.

◆ setLayerAlpha()

void PaintingArea::setLayerAlpha ( int  idx,
int  alpha 
)

The setAlphaOfLayer method sets the alpha value of a specific layer.

Parameters
idx- The index of the layer where the change should be applied
alpha- New alpha value of the layer

Definition at line 96 of file PaintingArea.cpp.

◆ slotActivateLayer

void PaintingArea::slotActivateLayer ( int  a)
slot

The slotActivateLayer method handles the event of selecting one layer as active.

Parameters
a- idx of the layer to be active

Definition at line 175 of file PaintingArea.cpp.

◆ slotDeleteActiveLayer

void PaintingArea::slotDeleteActiveLayer ( )
slot

The slotDeleteActiveLayer method handles the deletion of the active layer.

Definition at line 83 of file PaintingArea.cpp.

◆ wheelEvent()

void PaintingArea::wheelEvent ( QWheelEvent *  event)
overrideprotected

Definition at line 294 of file PaintingArea.cpp.

Member Data Documentation

◆ colorPicker

IntelliColorPicker PaintingArea::colorPicker

Definition at line 175 of file PaintingArea.h.

◆ Toolsettings

IntelliToolsettings PaintingArea::Toolsettings

Definition at line 174 of file PaintingArea.h.


The documentation for this class was generated from the following files: