Merge branch 'dev'

This commit is contained in:
Sonaion
2019-12-12 17:07:05 +01:00
29 changed files with 1035 additions and 1313 deletions

7
.gitignore vendored
View File

@@ -1,6 +1,5 @@
# Build folders
src/*-debug/
src/*-release/
src/build-*/
# QT Creator Files
*.creator.user*
@@ -17,5 +16,9 @@ CMakeLists.txt.user*
app_version.h
phony.c
# Ignore User Files except for the pro file
IntelliPhoto.*
!IntelliPhoto.pro
# macOS Environment Files
.DS_STORE

View File

@@ -19,7 +19,7 @@ IntelliPhotoGui::IntelliPhotoGui()
setIntelliStyle();
// Size the app
resize(500, 500);
showMaximized();
}
@@ -39,7 +39,7 @@ void IntelliPhotoGui::closeEvent(QCloseEvent *event)
// Check if the current image has been changed and then
// open a dialog to open a file
void IntelliPhotoGui::open()
void IntelliPhotoGui::slotOpen()
{
// Check if changes have been made since last save
// maybeSave() returns true if no changes have been made
@@ -54,12 +54,12 @@ void IntelliPhotoGui::open()
// If we have a file name load the image and place
// it in the paintingArea
if (!fileName.isEmpty())
paintingArea->openImage(fileName);
paintingArea->open(fileName);
}
}
// Called when the user clicks Save As in the menu
void IntelliPhotoGui::save()
void IntelliPhotoGui::slotSave()
{
// A QAction represents the action of the user clicking
QAction *action = qobject_cast<QAction *>(sender());
@@ -71,61 +71,31 @@ void IntelliPhotoGui::save()
saveFile(fileFormat);
}
// Opens a dialog to change the pen color
void IntelliPhotoGui::penColor()
{
// Store the chosen color from the dialog
QColor newColor = QColorDialog::getColor(paintingArea->penColor());
// If a valid color set it
if (newColor.isValid())
paintingArea->setPenColor(newColor);
}
// Opens a dialog that allows the user to change the pen width
void IntelliPhotoGui::penWidth()
{
// Stores button value
bool ok;
// tr("Painting") is the title
// the next tr is the text to display
// Get the current pen width
// Define the min, max, step and ok button
int newWidth = QInputDialog::getInt(this, tr("Painting"),
tr("Select pen width:"),
paintingArea->penWidth(),
1, 500, 1, &ok);
// Change the pen width
if (ok)
paintingArea->setPenWidth(newWidth);
}
// Opens a dialog that allows the user to create a New Layer
void IntelliPhotoGui::newLayer()
void IntelliPhotoGui::slotCreateNewLayer()
{
// Stores button value
bool ok;
bool ok1, ok2;
// tr("New Layer") is the title
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int width = QInputDialog::getInt(this, tr("New Layer"),
tr("Width:"),
200,1, 500, 1, &ok);
200,1, 500, 1, &ok1);
int height = QInputDialog::getInt(this, tr("New Layer"),
tr("Height:"),
200,1, 500, 1, &ok);
200,1, 500, 1, &ok2);
// Create New Layer
if (ok)
if (ok1&&ok2)
{
int layer = paintingArea->addLayer(width,height,100,100);
paintingArea->activate(layer);
int layer = paintingArea->addLayer(width,height,0,0);
paintingArea->slotActivateLayer(layer);
}
}
// Opens a dialog that allows the user to delete a Layer
void IntelliPhotoGui::deleteLayer()
void IntelliPhotoGui::slotDeleteLayer()
{
// Stores button value
bool ok;
@@ -135,110 +105,151 @@ void IntelliPhotoGui::deleteLayer()
// Define the standard Value, min, max, step and ok button
int layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
tr("Number:"),
1,1, 500, 1, &ok);
1,0, 500, 1, &ok);
// Create New Layer
if (ok)
paintingArea->deleteLayer(layerNumber-1);
paintingArea->deleteLayer(layerNumber);
}
void slotCreatePenTool(){
}
void slotCreateFloodFillTool(){
}
void IntelliPhotoGui::slotSetActiveAlpha(){
// Stores button value
bool ok1, ok2;
// tr("Layer to set on") is the title
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
tr("Layer:"),
-1,-1,100,1, &ok1);
// tr("New Alpha") is the title
int alpha = QInputDialog::getInt(this, tr("New Alpha"),
tr("Alpha:"),
255,0, 255, 1, &ok2);
if (ok1&&ok2)
{
paintingArea->setAlphaOfLayer(layer,alpha);
}
}
void IntelliPhotoGui::slotPositionMoveUp(){
paintingArea->movePositionActive(0,-20);
update();
}
void IntelliPhotoGui::slotPositionMoveDown(){
paintingArea->movePositionActive(0,20);
update();
}
void IntelliPhotoGui::slotPositionMoveLeft(){
paintingArea->movePositionActive(-20,0);
update();
}
void IntelliPhotoGui::slotPositionMoveRight(){
paintingArea->movePositionActive(20,0);
update();
}
void IntelliPhotoGui::slotMoveLayerUp(){
paintingArea->moveActiveLayer(1);
update();
}
void IntelliPhotoGui::slotMoveLayerDown(){
paintingArea->moveActiveLayer(-1);
update();
}
void IntelliPhotoGui::slotClearActiveLayer(){
// Stores button value
bool ok1, ok2, ok3, ok4;
// tr("Red Input") is the title
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int red = QInputDialog::getInt(this, tr("Red Input"),
tr("Red:"),
255,0, 255,1, &ok1);
// tr("Green Input") is the title
int green = QInputDialog::getInt(this, tr("Green Input"),
tr("Green:"),
255,0, 255, 1, &ok2);
// tr("Blue Input") is the title
int blue = QInputDialog::getInt(this, tr("Blue Input"),
tr("Blue:"),
255,0, 255, 1, &ok3);
// tr("Alpha Input") is the title
int alpha = QInputDialog::getInt(this, tr("Alpha Input"),
tr("Alpha:"),
255,0, 255, 1, &ok4);
if (ok1&&ok2&&ok3&&ok4)
{
paintingArea->floodFill(red, green, blue, alpha);
}
}
void IntelliPhotoGui::slotSetActiveLayer(){
// Stores button value
bool ok1;
// tr("Layer to set on") is the title
// the next tr is the text to display
// Define the standard Value, min, max, step and ok button
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
tr("Layer:"),
-1,0,255,1, &ok1);
if (ok1)
{
paintingArea->setLayerToActive(layer);
}
};
void IntelliPhotoGui::slotSetFirstColor(){
paintingArea->colorPickerSetFirstColor();
}
void IntelliPhotoGui::slotSetSecondColor(){
paintingArea->colorPickerSetSecondColor();
}
void IntelliPhotoGui::slotSwitchColor(){
paintingArea->colorPickerSwitchColor();
}
void IntelliPhotoGui::slotCreatePenTool(){
paintingArea->createPenTool();
}
void IntelliPhotoGui::slotCreatePlainTool(){
paintingArea->createPlainTool();
}
void IntelliPhotoGui::slotCreateLineTool(){
paintingArea->createLineTool();
}
// Open an about dialog
void IntelliPhotoGui::about()
void IntelliPhotoGui::slotAboutDialog()
{
// Window title and text to display
QMessageBox::about(this, tr("About Painting"),
tr("<p><b>IntelliPhoto</b> Some nice ass looking software</p>"));
}
void IntelliPhotoGui::onSetAlpha(){
int a = this->setAlphaEdit->text().toInt();
if (a >= 0 && a < 256)
emit this->sendAlpha(a);
}
void IntelliPhotoGui::onMoveUp(){
int a = 5;
emit this->moveUp(a);
}
void IntelliPhotoGui::onMoveDown(){
int a = 5;
emit this->moveDown(a);
}
void IntelliPhotoGui::onMoveLeft(){
int a = 5;
emit this->moveLeft(a);
}
void IntelliPhotoGui::onMoveRight(){
int a = 5;
emit this->moveRight(a);
}
void IntelliPhotoGui::onMoveLayerUp(){
emit this->moveLayerUp();
}
void IntelliPhotoGui::onMoveLayerDown(){
emit this->moveLayerDown();
}
void IntelliPhotoGui::onClearedPressed(){
int r = this->RedEdit->text().toInt();
int g = this->GreenEdit->text().toInt();
int b = this->BlueEdit->text().toInt();
if(r < 256 && r >= 0 && g < 256 && g >= 0 && b < 256 && b >= 0)
emit this->sendClearColor(r,g,b);
}
void IntelliPhotoGui::onActivePressed(){
int a = this->selectActiveEdit->text().toInt();
emit this->sendActiveLayer(a-1);
};
// Define menu actions that call functions
void IntelliPhotoGui::createActions()
{
//connect signal and slots of gui element
connect(this->clearButton, SIGNAL(clicked()), this, SLOT(onClearedPressed()));
connect(this, SIGNAL(sendClearColor(int,int,int)), paintingArea, SLOT(clearImage(int, int, int)));
connect(this->selectActiveButton, SIGNAL(clicked()), this, SLOT(onActivePressed()));
connect(this, SIGNAL(sendActiveLayer(int)),paintingArea, SLOT(activate(int)));
connect(this->setAlphaButton, SIGNAL(clicked()), this, SLOT(onSetAlpha()));
connect(this, SIGNAL(sendAlpha(int)), paintingArea, SLOT(setAlpha(int)));
connect(this->moveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveUp()));
connect(this, SIGNAL(moveUp(int)), paintingArea, SLOT(getMoveUp(int)));
connect(this->moveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveDown()));
connect(this, SIGNAL(moveDown(int)), paintingArea, SLOT(getMoveDown(int)));
connect(this->moveActiveLeftButton, SIGNAL(clicked()), this, SLOT(onMoveLeft()));
connect(this, SIGNAL(moveLeft(int)), paintingArea, SLOT(getMoveLeft(int)));
connect(this->moveActiveRightButton, SIGNAL(clicked()), this, SLOT(onMoveRight()));
connect(this, SIGNAL(moveRight(int)), paintingArea, SLOT(getMoveRight(int)));
connect(this->layerMoveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveLayerDown()));
connect(this, SIGNAL(moveLayerDown()), paintingArea, SLOT(getMoveLayerDown()));
connect(this->layerMoveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveLayerUp()));
connect(this, SIGNAL(moveLayerUp()), paintingArea, SLOT(getMoveLayerUp()));
// Create the action tied to the menu
openAct = new QAction(tr("&Open..."), this);
// Define the associated shortcut key
openAct->setShortcuts(QKeySequence::Open);
// Tie the action to IntelliPhotoGui::open()
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
// Get a list of the supported file formats
// QImageWriter is used to write images to files
@@ -252,62 +263,97 @@ void IntelliPhotoGui::createActions()
action->setData(format);
// When clicked call IntelliPhotoGui::save()
connect(action, SIGNAL(triggered()), this, SLOT(save()));
connect(action, SIGNAL(triggered()), this, SLOT(slotSave()));
// Attach each file format option menu item to Save As
saveAsActs.append(action);
actionSaveAs.append(action);
}
QAction *action = new QAction("PNG-8", this);
// Set an action for each file format
action->setData("PNG");
//set exporter to actions
QAction *pngSaveAction = new QAction("PNG-8", this);
pngSaveAction->setData("PNG");
// When clicked call IntelliPhotoGui::save()
connect(action, SIGNAL(triggered()), this, SLOT(save()));
connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
// Attach each PNG in save Menu
actionSaveAs.append(pngSaveAction);
// Attach each file format option menu item to Save As
saveAsActs.append(action);
// Create exit action and tie to IntelliPhotoGui::close()
exitAct = new QAction(tr("&Exit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
actionExit = new QAction(tr("&Exit"), this);
actionExit->setShortcuts(QKeySequence::Quit);
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
// Create pen color action and tie to IntelliPhotoGui::penColor()
penColorAct = new QAction(tr("&Pen Color..."), this);
connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor()));
// Create pen width action and tie to IntelliPhotoGui::penWidth()
penWidthAct = new QAction(tr("Pen &Width..."), this);
connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth()));
// Create clear screen action and tie to IntelliPhotoGui::clearImage()
clearScreenAct = new QAction(tr("&Clear Screen"), this);
clearScreenAct->setShortcut(tr("Ctrl+L"));
connect(clearScreenAct, SIGNAL(triggered()),
this, SLOT(onClearedPressed()));
actionOpen = new QAction(tr("&Open"), this);
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
// Create New Layer action and tie to IntelliPhotoGui::newLayer()
newLayerAct = new QAction(tr("&New Layer..."), this);
connect(newLayerAct, SIGNAL(triggered()), this, SLOT(newLayer()));
actionCreateNewLayer = new QAction(tr("&New Layer..."), this);
connect(actionCreateNewLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewLayer()));
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
deleteLayerAct = new QAction(tr("&Delete Layer..."), this);
connect(deleteLayerAct, SIGNAL(triggered()), this, SLOT(deleteLayer()));
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
// Delete Active Layer action and tie to paintingArea::deleteActiveLayerLayer()
deleteActiveLayerAct = new QAction(tr("&Delete active Layer"), this);
connect(deleteActiveLayerAct, SIGNAL(triggered()), paintingArea, SLOT(deleteActiveLayer()));
actionSetActiveLayer = new QAction(tr("&set Active"), this);
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
actionSetActiveAlpha = new QAction(tr("&set Alpha"), this);
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
actionMovePositionUp = new QAction(tr("&move Up"), this);
actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
actionMovePositionDown = new QAction(tr("&move Down"), this);
actionMovePositionDown->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Down));
connect(actionMovePositionDown, SIGNAL(triggered()), this, SLOT(slotPositionMoveDown()));
actionMovePositionLeft = new QAction(tr("&move Left"), this);
actionMovePositionLeft->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Left));
connect(actionMovePositionLeft, SIGNAL(triggered()), this, SLOT(slotPositionMoveLeft()));
actionMovePositionRight = new QAction(tr("&move Right"), this);
actionMovePositionRight->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Right));
connect(actionMovePositionRight, SIGNAL(triggered()), this, SLOT(slotPositionMoveRight()));
actionMoveLayerUp = new QAction(tr("&move Layer Up"), this);
actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up));
connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp()));
actionMoveLayerDown= new QAction(tr("&move Layer Down"), this);
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
//Create Color Actions here
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
actionColorSwitch = new QAction(tr("&Switch"), this);
actionColorSwitch->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
connect(actionColorSwitch, SIGNAL(triggered()), this, SLOT(slotSwitchColor()));
//Create Tool actions down here
actionCreatePlainTool = new QAction(tr("&Plain"), this);
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
actionCreatePenTool = new QAction(tr("&Pen"),this);
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
actionCreateLineTool = new QAction(tr("&Line"), this);
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
// Create about action and tie to IntelliPhotoGui::about()
aboutAct = new QAction(tr("&About"), this);
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
actionAboutDialog = new QAction(tr("&About"), this);
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
aboutQtAct = new QAction(tr("About &Qt"), this);
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
// Create the menubar
@@ -315,39 +361,57 @@ void IntelliPhotoGui::createMenus()
{
// Create Save As option and the list of file types
saveAsMenu = new QMenu(tr("&Save As"), this);
foreach (QAction *action, saveAsActs)
foreach (QAction *action, actionSaveAs)
saveAsMenu->addAction(action);
// Attach all actions to File
fileMenu = new QMenu(tr("&File"), this);
fileMenu->addAction(openAct);
fileMenu->addAction(actionOpen);
fileMenu->addMenu(saveAsMenu);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
fileMenu->addAction(actionExit);
// Attach all actions to Options
optionMenu = new QMenu(tr("&Options"), this);
optionMenu->addAction(penColorAct);
optionMenu->addAction(penWidthAct);
optionMenu->addSeparator();
optionMenu->addAction(clearScreenAct);
optionMenu->addAction(actionSetActiveLayer);
optionMenu->addAction(actionSetActiveAlpha);
optionMenu->addAction(actionMovePositionUp);
optionMenu->addAction(actionMovePositionDown);
optionMenu->addAction(actionMovePositionLeft);
optionMenu->addAction(actionMovePositionRight);
optionMenu->addAction(actionMoveLayerUp);
optionMenu->addAction(actionMoveLayerDown);
// Attach all actions to Layer
layerMenu = new QMenu(tr("&Layer"), this);
layerMenu->addAction(newLayerAct);
layerMenu->addAction(deleteLayerAct);
layerMenu->addAction(deleteActiveLayerAct);
layerMenu->addAction(actionCreateNewLayer);
layerMenu->addAction(actionDeleteLayer);
//Attach all Color Options
colorMenu = new QMenu(tr("&Color"), this);
colorMenu->addAction(actionColorPickerFirstColor);
colorMenu->addAction(actionColorPickerSecondColor);
colorMenu->addAction(actionColorSwitch);
//Attach all Tool Options
toolMenu = new QMenu(tr("&Tools"), this);
toolMenu->addAction(actionCreatePenTool);
toolMenu->addAction(actionCreatePlainTool);
toolMenu->addAction(actionCreateLineTool);
toolMenu->addSeparator();
toolMenu->addMenu(colorMenu);
// Attach all actions to Help
helpMenu = new QMenu(tr("&Help"), this);
helpMenu->addAction(aboutAct);
helpMenu->addAction(aboutQtAct);
helpMenu->addAction(actionAboutDialog);
helpMenu->addAction(actionAboutQtDialog);
// Add menu items to the menubar
menuBar()->addMenu(fileMenu);
menuBar()->addMenu(optionMenu);
menuBar()->addMenu(layerMenu);
menuBar()->addMenu(toolMenu);
menuBar()->addMenu(helpMenu);
}
@@ -361,67 +425,10 @@ void IntelliPhotoGui::createGui(){
centralGuiWidget->setLayout(mainLayout);
//create Gui elements
clearButton = new QPushButton("set Color");
paintingArea = new PaintingArea();
RedLabel = new QLabel("Red:");
GreenLabel = new QLabel("Green");
BlueLabel = new QLabel("Blue:");
RedEdit = new QLineEdit("255");
GreenEdit = new QLineEdit("255");
BlueEdit = new QLineEdit("255");
RedEdit->setMaximumSize(150,20);
GreenEdit->setMaximumSize(150,20);
BlueEdit->setMaximumSize(150,20);
selectActiveButton = new QPushButton("select Active");
selectActiveLabel = new QLabel("Active:");
selectActiveEdit = new QLineEdit("1");
selectActiveLabel->setMaximumSize(150,20);
selectActiveEdit->setMaximumSize(150,20);
setAlphaButton = new QPushButton("set Alpha");
setAlphaLabel = new QLabel("Alpha:");
setAlphaEdit = new QLineEdit("255");
setAlphaEdit->setMaximumSize(150,20);
moveActiveUpButton = new QPushButton("move 5 Up");
moveActiveDownButton = new QPushButton("move 5 Down");
moveActiveLeftButton = new QPushButton("move 5 Left");
moveActiveRightButton = new QPushButton("move 5 Right");
layerMoveActiveDownButton = new QPushButton("Active Layer Down");
layerMoveActiveUpButton = new QPushButton("Active Layer Up");
//set gui elemtns position
mainLayout->addWidget(clearButton,0,25,1,1);
mainLayout->addWidget(paintingArea,0,0,25,25);
mainLayout->addWidget(RedLabel,1,25,1,1);
mainLayout->addWidget(RedEdit,2,25,1,1);
mainLayout->addWidget(GreenLabel,3,25,1,1);
mainLayout->addWidget(GreenEdit,4,25,1,1);
mainLayout->addWidget(BlueLabel,5,25,1,1);
mainLayout->addWidget(BlueEdit,6,25,1,1);
mainLayout->addWidget(selectActiveButton,7,25,1,1);
mainLayout->addWidget(selectActiveLabel,8,25,1,1);
mainLayout->addWidget(selectActiveEdit,9,25,1,1);
mainLayout->addWidget(setAlphaButton,10,25,1,1);
mainLayout->addWidget(setAlphaLabel,11,25,1,1);
mainLayout->addWidget(setAlphaEdit,12,25,1,1);
mainLayout->addWidget(moveActiveUpButton,13,25,1,1);
mainLayout->addWidget(moveActiveDownButton,14,25,1,1);
mainLayout->addWidget(moveActiveLeftButton,15,25,1,1);
mainLayout->addWidget(moveActiveRightButton,16,25,1,1);
mainLayout->addWidget(layerMoveActiveDownButton,17,25,1,1);
mainLayout->addWidget(layerMoveActiveUpButton,18,25,1,1);
//set gui elements
mainLayout->addWidget(paintingArea);
}
void IntelliPhotoGui::setIntelliStyle(){
@@ -436,7 +443,9 @@ void IntelliPhotoGui::setIntelliStyle(){
bool IntelliPhotoGui::maybeSave()
{
// Check for changes since last save
if (paintingArea->isModified()) {
//TODO insert variable for modified status here to make an save exit message
if (false) {
QMessageBox::StandardButton ret;
// Painting is the title
@@ -478,7 +487,7 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
} else {
// Call for the file to be saved
return paintingArea->saveImage(fileName, fileFormat.constData());
return paintingArea->save(fileName, fileFormat.constData());
}
}

View File

@@ -12,119 +12,119 @@
// PaintingArea used to paint the image
class PaintingArea;
class IntelliTool;
class IntelliColorPicker;
class IntelliPhotoGui : public QMainWindow
{
// Declares our class as a QObject which is the base class
// for all Qt objects
// QObjects handle events
Q_OBJECT
signals:
void sendClearColor(int r, int g, int b);
void sendActiveLayer(int a);
void sendAlpha(int a);
void moveUp(int a);
void moveDown(int a);
void moveRight(int a);
void moveLeft(int a);
void moveLayerUp();
void moveLayerDown();
public:
IntelliPhotoGui();
protected:
// Function used to close an event
void closeEvent(QCloseEvent *event) override;
// The events that can be triggered
private slots:
void open();
void save();
void penColor();
void penWidth();
void newLayer();
void deleteLayer();
void about();
//meta slots here (need further )
void slotOpen();
void slotSave();
void onClearedPressed();
void onActivePressed();
void onSetAlpha();
void onMoveUp();
void onMoveDown();
void onMoveLeft();
void onMoveRight();
void onMoveLayerUp();
void onMoveLayerDown();
//layer slots here
void slotCreateNewLayer();
void slotDeleteLayer();
void slotClearActiveLayer();
void slotSetActiveLayer();
void slotSetActiveAlpha();
void slotPositionMoveUp();
void slotPositionMoveDown();
void slotPositionMoveLeft();
void slotPositionMoveRight();
void slotMoveLayerUp();
void slotMoveLayerDown();
//color Picker slots here
void slotSetFirstColor();
void slotSetSecondColor();
void slotSwitchColor();
//tool slots here
void slotCreatePenTool();
void slotCreatePlainTool();
void slotCreateLineTool();
//slots for dialogs
void slotAboutDialog();
private:
// Will tie user actions to functions
void createActions();
void createMenus();
//setup GUI elements
void createGui();
//set style of the GUI
void setIntelliStyle();
// Will check if changes have occurred since last save
bool maybeSave();
// Opens the Save dialog and saves
bool saveFile(const QByteArray &fileFormat);
// What we'll draw on
PaintingArea *paintingArea;
PaintingArea* paintingArea;
// The menu widgets
QMenu *saveAsMenu;
QMenu *fileMenu;
QMenu *optionMenu;
QMenu *layerMenu;
QMenu *colorMenu;
QMenu *toolMenu;
QMenu *helpMenu;
// All the actions that can occur
QAction *openAct;
//meta image actions (need further modularisation)
QAction *actionOpen;
QAction *actionExit;
//color Picker actions
QAction *actionColorPickerFirstColor;
QAction *actionColorPickerSecondColor;
QAction *actionColorSwitch;
//tool actions
QAction *actionCreatePenTool;
QAction *actionCreatePlainTool;
QAction *actionCreateLineTool;
//dialog actions
QAction *actionAboutDialog;
QAction *actionAboutQtDialog;
//layer change actions
QAction *actionCreateNewLayer;
QAction *actionDeleteLayer;
QAction* actionSetActiveLayer;
QAction* actionSetActiveAlpha;
QAction* actionMovePositionUp;
QAction* actionMovePositionDown;
QAction* actionMovePositionLeft;
QAction* actionMovePositionRight;
QAction* actionMoveLayerUp;
QAction* actionMoveLayerDown;
// Actions tied to specific file formats
QList<QAction *> saveAsActs;
QAction *exitAct;
QAction *penColorAct;
QAction *penWidthAct;
QAction *clearScreenAct;
QAction *newLayerAct;
QAction *deleteLayerAct;
QAction *deleteActiveLayerAct;
QAction *aboutAct;
QAction *aboutQtAct;
QList<QAction *> actionSaveAs;
//main GUI elements
QWidget* centralGuiWidget;
QGridLayout *mainLayout;
QPushButton *clearButton;
QLabel *RedLabel;
QLabel *GreenLabel;
QLabel *BlueLabel;
QLineEdit *RedEdit;
QLineEdit *GreenEdit;
QLineEdit *BlueEdit;
QPushButton *selectActiveButton;
QLabel *selectActiveLabel;
QLineEdit *selectActiveEdit;
QPushButton *setAlphaButton;
QLabel *setAlphaLabel;
QLineEdit *setAlphaEdit;
QPushButton *moveActiveUpButton;
QPushButton *moveActiveDownButton;
QPushButton *moveActiveLeftButton;
QPushButton *moveActiveRightButton;
QPushButton *layerMoveActiveDownButton;
QPushButton *layerMoveActiveUpButton;
};

View File

@@ -20,7 +20,7 @@ bool IntelliImage::loadImage(const QString &fileName){
return false;
// 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);
return true;
@@ -50,9 +50,6 @@ void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){
// Draw a line from the last registered point to the current
painter.drawPoint(p1);
// Call to update the rectangular space where we drew
//update(QRect(p1, p2));
}
void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){
@@ -67,15 +64,6 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
}
void IntelliImage::floodFill(const QColor& color){
void IntelliImage::drawPlain(const QColor& color){
imageData.fill(color);
}
int IntelliImage::x(){
return imageData.size().width();
}
int IntelliImage::y(){
return imageData.size().height();
}

View File

@@ -13,34 +13,42 @@ enum class ImageType{
Shaped_Image
};
class IntelliImage{
class IntelliTool;
class IntelliImage{
friend IntelliTool;
protected:
void resizeImage(QImage *image, const QSize &newSize);
QImage imageData;
//calculate with polygon
public:
IntelliImage(int weight, int height);
virtual ~IntelliImage() = 0;
//start on top left
virtual void drawPixel(const QPoint &p1, const QColor& color);
virtual void drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth);
virtual void floodFill(const QColor& color);
virtual void drawPlain(const QColor& color);
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha)=0;
virtual QImage getDisplayable(int alpha=255)=0;
//gets a copy of the image !allocated
virtual IntelliImage* getDeepCopy()=0;
virtual void calculateVisiblity()=0;
//returns the filtered output
//sets the data for the visible image
virtual void setPolygon(const std::vector<QPoint>& polygonData)=0;
virtual std::vector<QPoint> getPolygonData(){ return std::vector<QPoint>();}
//loads an image to the ColorBuffer
virtual bool loadImage(const QString &fileName);
int x();
int y();
};
#endif

View File

@@ -12,6 +12,16 @@ IntelliRasterImage::~IntelliRasterImage(){
}
IntelliImage* IntelliRasterImage::getDeepCopy(){
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
raster->imageData.fill(Qt::transparent);
return raster;
}
void IntelliRasterImage::calculateVisiblity(){
//not used in raster image
}
QImage IntelliRasterImage::getDisplayable(int alpha){
return getDisplayable(imageData.size(), alpha);
}
@@ -21,7 +31,7 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
for(int y = 0; y<copy.height(); y++){
for(int x = 0; x<copy.width(); x++){
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
clr.setAlpha(std::min(alpha, clr.alpha()));
copy.setPixelColor(x,y, clr);
}
}

View File

@@ -4,7 +4,9 @@
#include"Image/IntelliImage.h"
class IntelliRasterImage : public IntelliImage{
friend IntelliTool;
protected:
virtual void calculateVisiblity() override;
public:
IntelliRasterImage(int weight, int height);
virtual ~IntelliRasterImage() override;
@@ -13,6 +15,8 @@ public:
virtual QImage getDisplayable(const QSize& displaySize,int alpha) override;
virtual QImage getDisplayable(int alpha=255) override;
//gets a copy of the image !allocated
virtual IntelliImage* getDeepCopy() override;
//sets the data for the visible image
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;

View File

@@ -5,7 +5,7 @@
#include<QDebug>
IntelliShapedImage::IntelliShapedImage(int weight, int height)
:IntelliImage(weight, height){
:IntelliRasterImage(weight, height){
}
IntelliShapedImage::~IntelliShapedImage(){
@@ -13,59 +13,73 @@ IntelliShapedImage::~IntelliShapedImage(){
}
QImage IntelliShapedImage::getDisplayable(int alpha){
return getDisplayable(imageData.size());
return getDisplayable(imageData.size(),alpha);
}
IntelliImage* IntelliShapedImage::getDeepCopy(){
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height());
shaped->setPolygon(this->polygonData);
shaped->imageData.fill(Qt::transparent);
return shaped;
}
void IntelliShapedImage::calculateVisiblity(){
if(polygonData.size()<=2){
QColor clr;
for(int y=0; y<imageData.height(); y++){
for(int x=0; x<imageData.width(); x++){
clr = imageData.pixel(x,y);
clr.setAlpha(255);
imageData.setPixelColor(x,y,clr);
}
}
return;
}
QPoint A = polygonData[0];
QColor clr;
for(int y=0; y<imageData.height(); y++){
for(int x=0; x<imageData.width(); x++){
int cutNumeber=0;
for(int i=1; i<static_cast<int>(polygonData.size()-1); i++){
QPoint B = polygonData[static_cast<size_t>(i)];
QPoint C = polygonData[static_cast<size_t>(i+1)];
QPoint P(x,y);
cutNumeber+=IntelliHelper::isInTriangle(A,B,C,P);
}
if(cutNumeber%2==0){
clr = imageData.pixelColor(x,y);
clr.setAlpha(0);
imageData.setPixelColor(x,y,clr);
}else{
clr = imageData.pixelColor(x,y);
clr.setAlpha(std::min(255, clr.alpha()));
imageData.setPixelColor(x,y,clr);
}
}
}
}
QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
if(polygonData.size()==0){
QImage copy = imageData;
for(int y = 0; y<copy.height(); y++){
for(int x = 0; x<copy.width(); x++){
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y, clr);
}
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}
QImage copy = imageData;
QPoint startPoint;
QPoint extrem(0,copy.width()+1);
for(int y = 0; y<copy.height(); y++){
extrem.setY(y);
startPoint.setY(y);
//traverse through x dircetion
for(int x=0; x<copy.width(); x++){
startPoint.setX(x);
//traverse all edges
int cutNumberX = 0;
for(size_t i=0; i<polygonData.size()-1; i++){
QPoint& start = polygonData[i];
QPoint& end = polygonData[i+1];
cutNumberX+=IntelliHelper::hasIntersection(startPoint, extrem, start, end);
}
//check if zhe cutNumber is Even -> not in Polygon
if(!(cutNumberX&1)){
QColor tmpColor(0,0,0);
tmpColor.setAlpha(0);
copy.setPixelColor(startPoint,tmpColor);
}else{
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y,clr);
}
for(int x = 0; x<copy.width(); x++){
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(std::min(alpha,clr.alpha()));
copy.setPixelColor(x,y, clr);
}
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}
void IntelliShapedImage::setPolygon(const std::vector<QPoint>& polygonData){
if(polygonData.size()<3){
return;
}
for(auto element:polygonData){
this->polygonData.push_back(QPoint(element.x(), element.y()));
this->polygonData.clear();
}else{
this->polygonData.clear();
for(auto element:polygonData){
this->polygonData.push_back(QPoint(element.x(), element.y()));
}
}
calculateVisiblity();
return;
}

View File

@@ -1,20 +1,27 @@
#ifndef INTELLISHAPE_H
#define INTELLISHAPE_H
#include"Image/IntelliImage.h"
class IntelliShapedImage : public IntelliImage{
#include"Image/IntelliRasterImage.h"
class IntelliShapedImage : public IntelliRasterImage{
friend IntelliTool;
protected:
std::vector<QPoint> polygonData;
public:
IntelliShapedImage(int weight, int height);
virtual ~IntelliShapedImage() override;
virtual void calculateVisiblity() override;
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha=255) override;
virtual QImage getDisplayable(int alpha=255) override;
//gets a copy of the image !allocated
virtual IntelliImage* getDeepCopy() override;
virtual std::vector<QPoint> getPolygonData() override{return polygonData;}
//sets the data for the visible image
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;
};

View File

@@ -0,0 +1,30 @@
#include "IntelliColorPicker.h"
IntelliColorPicker::IntelliColorPicker(){
firstColor = {255,0,0,255};
secondColor = {0,0,255,255};
}
IntelliColorPicker::~IntelliColorPicker(){
}
void IntelliColorPicker::switchColors(){
std::swap(firstColor, secondColor);
}
QColor IntelliColorPicker::getFirstColor(){
return this->firstColor;
}
QColor IntelliColorPicker::getSecondColor(){
return this->secondColor;
}
void IntelliColorPicker::setFirstColor(QColor Color){
this->firstColor = Color;
}
void IntelliColorPicker::setSecondColor(QColor Color){
this->secondColor = Color;
}

View File

@@ -0,0 +1,26 @@
#ifndef INTELLITOOLSETCOLORTOOL_H
#define INTELLITOOLSETCOLORTOOL_H
#include"QColor"
#include"QPoint"
#include"QColorDialog"
class IntelliColorPicker{
public:
IntelliColorPicker();
virtual ~IntelliColorPicker();
void switchColors();
QColor getFirstColor();
QColor getSecondColor();
void setFirstColor(QColor Color);
void setSecondColor(QColor Color);
private:
QColor firstColor;
QColor secondColor;
};
#endif // INTELLITOOLSETCOLORTOOL_H

View File

@@ -1,39 +1,4 @@
#include"IntelliHelper.h"
#include<algorithm>
int IntelliHelper::orientation(QPoint& p, QPoint& q, QPoint& r){
int value = (q.y()-p.y())*(r.x()-q.x())-
(q.x()-p.x())*(r.y()-q.y());
if(value==0) return 0;
return (value>0)?1:2;
}
bool IntelliHelper::onSegment(QPoint& p1, QPoint& q, QPoint& p2){
return (q.x() >= std::min(p1.x(),p2.x()) && q.x() <= std::max(p1.x(), p2.x()) &&
q.y() >= std::min(p1.y(),p2.y()) && q.y() <= std::max(p1.y(), p2.y()));
}
bool IntelliHelper::hasIntersection(QPoint& p1, QPoint& q1, QPoint& p2, QPoint& q2){
int o1 = IntelliHelper::orientation(p1,q1,p2);
int o2 = IntelliHelper::orientation(p1,q1,q2);
int o3 = IntelliHelper::orientation(p2,q2,p1);
int o4 = IntelliHelper::orientation(p2,q2,q1);
// General case
if (o1 != o2 && o3 != o4)
return true;
// p1, q1 and p2 are colinear and p2 lies on segment p1q1
if (o1 == 0 && onSegment(p1, p2, q1)) return true;
// p1, q1 and q2 are colinear and q2 lies on segment p1q1
if (o2 == 0 && onSegment(p1, q2, q1)) return true;
// p2, q2 and p1 are colinear and p1 lies on segment p2q2
if (o3 == 0 && onSegment(p2, p1, q2)) return true;
// p2, q2 and q1 are colinear and q1 lies on segment p2q2
if (o4 == 0 && onSegment(p2, q1, q2)) return true;
return false; // Doesn't fall in any of the above cases
}

View File

@@ -5,18 +5,27 @@
class IntelliHelper{
public:
//checks for orientation:
// 0 - colinear
// 1 - clockwise
// 2 - counter clockwise
static int orientation(QPoint& p1, QPoint& p2, QPoint& p3);
//checks if q is on segment p1-p2
static bool onSegment(QPoint& p1, QPoint& q, QPoint& p2);
static inline float sign(QPoint& p1, QPoint& p2, QPoint& p3){
return (p1.x()-p3.x())*(p2.y()-p3.y())-(p2.x()-p3.x())*(p1.y()-p3.y());
}
//cheks if p1-q1 intersects with p2-q2
static bool hasIntersection(QPoint& p1, QPoint& q1, QPoint& p2, QPoint& q2);
static inline bool isInTriangle(QPoint& A, QPoint& B, QPoint& C, QPoint& P){
float val1, val2, val3;
bool neg, pos;
val1 = IntelliHelper::sign(P,A,B);
val2 = IntelliHelper::sign(P,B,C);
val3 = IntelliHelper::sign(P,C,A);
neg = (val1<0.f) || (val2<0.f) || (val3<0.f);
pos = (val1>0.f) || (val2>0.f) || (val3>0.f);
return !(neg && pos);
}
};
#endif

View File

@@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-11-20T18:43:58. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{87de10b7-9dd6-4379-8674-fd04613e186e}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.5 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.5 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5125.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment-Konfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Scribble</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Jonas/Documents/QML/Scribble/Scribble.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@@ -1,4 +1,4 @@
QT += core gui
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -20,8 +20,13 @@ SOURCES += \
Image/IntelliImage.cpp \
Image/IntelliRasterImage.cpp \
Image/IntelliShapedImage.cpp \
IntelliHelper/IntelliColorPicker.cpp \
IntelliHelper/IntelliHelper.cpp \
Layer/PaintingArea.cpp \
Tool/IntelliTool.cpp \
Tool/IntelliToolLine.cpp \
Tool/IntelliToolPen.cpp \
Tool/IntelliToolPlain.cpp \
main.cpp
HEADERS += \
@@ -29,18 +34,22 @@ HEADERS += \
Image/IntelliImage.h \
Image/IntelliRasterImage.h \
Image/IntelliShapedImage.h \
IntelliHelper/IntelliColorPicker.h \
IntelliHelper/IntelliHelper.h \
Layer/PaintingArea.h \
Tool/IntelliTool.h
Tool/IntelliTool.h \
Tool/IntelliToolLine.h \
Tool/IntelliToolPen.h \
Tool/IntelliToolPlain.h
FORMS += \
widget.ui
QMAKE_CXXFLAGS
QMAKE_LFLAGS
RC_ICONS = icon.ico
ICON = icon.icns
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin

View File

@@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-11-23T20:59:26. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{39e188fc-db7d-4dae-b6b7-f93e7e62e580}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.6 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.6 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5126.win32_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment-Konfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Scribble</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/Scribble/Scribble.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@@ -1,124 +1,120 @@
// ---------- PaintingArea.cpp ----------
#include "string.h"
#include <vector>
#include <QtWidgets>
#include <QPoint>
#include <QRect>
#include "string.h"
#include "PaintingArea.h"
#include "Image/IntelliRasterImage.h"
#include "Image/IntelliShapedImage.h"
#include "Tool/IntelliToolPen.h"
#include "Tool/IntelliToolPlain.h"
#include "Tool/IntelliToolLine.h"
#include <vector>
#include <QPoint>
#define EXPORT
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
:QWidget(parent){
this->Tool = nullptr;
this->setUp(maxWidth, maxHeight);
#ifdef EXPORT
this->addLayer(maxWidth, maxHeight);
layerStructure[0].image->floodFill(QColor(255,255,255,255));
activeLayer=0;
#endif
#ifndef EXPORT
//tetsing
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
layerStructure[0].image->floodFill(QColor(255,0,0,255));
layerBundle[0].image->drawPlain(QColor(255,0,0,255));
std::vector<QPoint> polygon;
polygon.push_back(QPoint(100,0));
polygon.push_back(QPoint(200,200));
polygon.push_back(QPoint(0,200));
polygon.push_back(QPoint(100,0));
layerStructure[0].image->setPolygon(polygon);
polygon.push_back(QPoint(100,000));
polygon.push_back(QPoint(200,100));
polygon.push_back(QPoint(100,200));
polygon.push_back(QPoint(000,100));
layerBundle[0].image->setPolygon(polygon);
this->addLayer(200,200,150,150);
layerStructure[1].image->floodFill(QColor(0,255,0,255));
layerStructure[1].alpha=200;
layerBundle[1].image->drawPlain(QColor(0,255,0,255));
layerBundle[1].alpha=200;
activeLayer=1;
#endif
activeLayer=0;
}
PaintingArea::~PaintingArea(){
delete Tool;
}
void PaintingArea::setUp(int maxWidth, int maxHeight){
//set standart parameter
this->maxWidth = maxWidth;
this->maxHeight = maxHeight;
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
Canvas->fill(Qt::GlobalColor::white);
// Roots the widget to the top left even if resized
setAttribute(Qt::WA_StaticContents);
// Set defaults for the monitored variables
scribbling = false;
myPenWidth = 1;
myPenColor = Qt::blue;
}
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
LayerObject newLayer;
newLayer.width = width;
newLayer.height = height;
newLayer.hight = height;
newLayer.widthOffset = widthOffset;
newLayer.heightOffset = heightOffset;
newLayer.hightOffset = heightOffset;
if(type==ImageType::Raster_Image){
newLayer.image = new IntelliRasterImage(width,height);
}else if(type==ImageType::Shaped_Image){
newLayer.image = new IntelliShapedImage(width, height);
}
newLayer.alpha = 255;
this->layerStructure.push_back(newLayer);
return layerStructure.size()-1;
this->layerBundle.push_back(newLayer);
return static_cast<int>(layerBundle.size())-1;
}
void PaintingArea::deleteLayer(int index){
if(index<layerStructure.size()){
this->layerStructure.erase(layerStructure.begin()+index);
if(index<static_cast<int>(layerBundle.size())){
this->layerBundle.erase(layerBundle.begin()+index);
if(activeLayer>=index){
activeLayer--;
}
}
}
void PaintingArea::deleteActiveLayer(){
this->layerStructure.erase(layerStructure.begin()+activeLayer);
void PaintingArea::slotDeleteActiveLayer(){
if(activeLayer>=0 && activeLayer < static_cast<int>(layerBundle.size())){
this->layerBundle.erase(layerBundle.begin()+activeLayer);
activeLayer--;
}
}
void PaintingArea::setLayerToActive(int index) {
if(index<layerStructure.size()){
if(index>=0&&index<static_cast<int>(layerBundle.size())){
this->activeLayer=index;
}
}
void PaintingArea::setAlphaToLayer(int index, int alpha){
if(index<layerStructure.size()){
layerStructure[index].alpha=alpha;
void PaintingArea::setAlphaOfLayer(int index, int alpha){
if(index>=0&&index<static_cast<int>(layerBundle.size())){
layerBundle[static_cast<size_t>(index)].alpha=alpha;
}
}
QPixmap PaintingArea::getAsPixmap(){
assembleLayers();
return QPixmap::fromImage(*Canvas);
}
// Used to load the image and place it in the widget
bool PaintingArea::openImage(const QString &fileName)
bool PaintingArea::open(const QString &fileName)
{
if(this->activeLayer==-1){
return false;
}
IntelliImage* active = layerStructure[activeLayer].image;
IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
bool open = active->loadImage(fileName);
active->calculateVisiblity();
update();
return open;
}
// Save the current image
bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat)
bool PaintingArea::save(const QString &fileName, const char *fileFormat)
{
if(layerStructure.size()==0){
if(layerBundle.size()==0){
return false;
}
this->assembleLayers(true);
@@ -133,7 +129,6 @@ bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat)
}
}
if (Canvas->save(fileName, fileFormat)) {
return true;
} else {
@@ -141,67 +136,63 @@ bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat)
}
}
// Used to change the pen color
void PaintingArea::setPenColor(const QColor &newColor)
{
myPenColor = newColor;
}
// Used to change the pen width
void PaintingArea::setPenWidth(int newWidth)
{
myPenWidth = newWidth;
}
// Color the image area with white
void PaintingArea::clearImage(int r, int g, int b){
void PaintingArea::floodFill(int r, int g, int b, int a){
if(this->activeLayer==-1){
return;
}
IntelliImage* active = layerStructure[activeLayer].image;
active->floodFill(QColor(r, g, b, 255));
IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
active->drawPlain(QColor(r, g, b, a));
update();
}
void PaintingArea::activate(int a){
this->setLayerToActive(a);
void PaintingArea::movePositionActive(int x, int y){
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
layerBundle[static_cast<size_t>(activeLayer)].hightOffset += y;
}
void PaintingArea::setAlpha(int a){
if(activeLayer>=0){
layerStructure[activeLayer].alpha=a;
void PaintingArea::moveActiveLayer(int idx){
if(idx==1){
this->activateUpperLayer();
}else if(idx==-1){
this->activateLowerLayer();
}
}
void PaintingArea::getMoveUp(int a){
layerStructure[activeLayer].heightOffset-=a;
}
void PaintingArea::getMoveDown(int a){
layerStructure[activeLayer].heightOffset+=a;
}
void PaintingArea::getMoveRight(int a){
layerStructure[activeLayer].widthOffset+=a;
}
void PaintingArea::getMoveLeft(int a){
layerStructure[activeLayer].widthOffset-=a;
}
void PaintingArea::getMoveLayerUp(){
if(activeLayer<layerStructure.size()-1 && activeLayer>=0){
std::swap(layerStructure[activeLayer], layerStructure[activeLayer+1]);
activeLayer++;
void PaintingArea::slotActivateLayer(int a){
if(a>=0 && a < static_cast<int>(layerBundle.size())){
this->setLayerToActive(a);
}
}
void PaintingArea::getMoveLayerDown(){
if(activeLayer>0){
std::swap(layerStructure[activeLayer], layerStructure[activeLayer-1]);
activeLayer--;
}
void PaintingArea::colorPickerSetFirstColor(){
QColor clr = QColorDialog::getColor(colorPicker.getFirstColor(), nullptr, "Main Color");
this->colorPicker.setFirstColor(clr);
}
void PaintingArea::colorPickerSetSecondColor(){
QColor clr = QColorDialog::getColor(colorPicker.getSecondColor(), nullptr, "Secondary Color");
this->colorPicker.setSecondColor(clr);
}
void PaintingArea::colorPickerSwitchColor(){
this->colorPicker.switchColors();
}
void PaintingArea::createPenTool(){
delete this->Tool;
Tool = new IntelliToolPen(this, &colorPicker);
}
void PaintingArea::createPlainTool(){
delete this->Tool;
Tool = new IntelliToolPlainTool(this, &colorPicker);
}
void PaintingArea::createLineTool(){
delete this->Tool;
Tool = new IntelliToolLine(this, &colorPicker);
}
// If a mouse button is pressed check if it was the
@@ -209,18 +200,16 @@ void PaintingArea::getMoveLayerDown(){
// Set that we are currently drawing
void PaintingArea::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
if(this->activeLayer==-1){
return;
}
LayerObject& active = layerStructure[activeLayer];
int x = event->x()-active.widthOffset;
int y = event->y()-active.heightOffset;
//TODO CALCULATE LAST POINT
lastPoint=QPoint(x,y);
scribbling = true;
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].hightOffset;
if(event->button() == Qt::LeftButton){
Tool->onMouseLeftPressed(x, y);
}else if(event->button() == Qt::RightButton){
Tool->onMouseRightPressed(x, y);
}
update();
}
@@ -229,38 +218,27 @@ void PaintingArea::mousePressEvent(QMouseEvent *event)
// from the last position to the current
void PaintingArea::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) && scribbling){
if(this->activeLayer==-1){
return;
}
LayerObject& active = layerStructure[activeLayer];
int x = event->x()-active.widthOffset;
int y = event->y()-active.heightOffset;
//TODO CALCULATE NEW POINT
drawLineTo(QPoint(x,y));
update();
}
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].hightOffset;
Tool->onMouseMoved(x, y);
update();
}
// If the button is released we set variables to stop drawing
void PaintingArea::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && scribbling) {
if(this->activeLayer==-1){
return;
}
LayerObject& active = layerStructure[activeLayer];
int x = event->x()-active.widthOffset;
int y = event->y()-active.heightOffset;
//TODO CALCULATE NEW POINT
drawLineTo(QPoint(x,y));
update();
scribbling = false;
if(Tool == nullptr)
return;
int x = event->x()-layerBundle[activeLayer].widthOffset;
int y = event->y()-layerBundle[activeLayer].hightOffset;
if(event->button() == Qt::LeftButton){
Tool->onMouseLeftReleased(x, y);
}else if(event->button() == Qt::RightButton){
Tool->onMouseRightReleased(x, y);
}
update();
}
// QPainter provides functions to draw on the widget
@@ -280,62 +258,74 @@ void PaintingArea::paintEvent(QPaintEvent *event)
// to cut down on the need to resize the image
void PaintingArea::resizeEvent(QResizeEvent *event)
{
if(this->activeLayer==-1){
return;
}
LayerObject active = layerStructure[activeLayer];
QPainter painter(this);
QRect dirtyRec(QPoint(0,0), event->size());
painter.drawImage(dirtyRec, active.image->getDisplayable(event->size(), active.alpha), dirtyRec);
//TODO wait till tool works
update();
}
void PaintingArea::drawLineTo(const QPoint &endPoint)
{
//// Used to draw on the widget
if(this->activeLayer==-1){
return;
}
LayerObject active = layerStructure[activeLayer];
active.image->drawLine(lastPoint, endPoint,myPenColor, myPenWidth);
lastPoint = endPoint;
update();
}
void PaintingArea::resizeImage(QImage *image_res, const QSize &newSize){
image_res->scaled(newSize,Qt::IgnoreAspectRatio);
//TODO implement
}
void PaintingArea::activateUpperLayer(){
if(activeLayer!=-1 && activeLayer<layerBundle.size()-1){
std::swap(layerBundle[activeLayer], layerBundle[activeLayer+1]);
activeLayer++;
}
}
void PaintingArea::activateLowerLayer(){
if(activeLayer!=-1 && activeLayer>0){
std::swap(layerBundle[activeLayer], layerBundle[activeLayer-1]);
activeLayer--;
}
}
void PaintingArea::assembleLayers(bool forSaving){
if(forSaving){
Canvas->fill(Qt::GlobalColor::transparent);
}else{
Canvas->fill(Qt::GlobalColor::black);
}
//TODO interpolation of alpha for saving
for(size_t i=0; i<layerStructure.size(); i++){
LayerObject layer = layerStructure[i];
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++){
for(int y=0; y<layer.hight; y++){
if(layer.hightOffset+y<0) continue;
if(layer.hightOffset+y>=maxHeight) break;
for(int x=0; x<layer.width; x++){
clr_0=Canvas->pixelColor(layer.widthOffset+x, layer.heightOffset+y);
if(layer.widthOffset+x<0) continue;
if(layer.widthOffset+x>=maxWidth) break;
clr_0=Canvas->pixelColor(layer.widthOffset+x, layer.hightOffset+y);
clr_1=cpy.pixelColor(x,y);
float t = (float)clr_1.alpha()/255.f;
int r =(float)clr_1.red()*(t)+(float)clr_0.red()*(1.-t);
int g =(float)clr_1.green()*(t)+(float)clr_0.green()*(1.-t);
int b =(float)clr_1.blue()*(t)+(float)clr_0.blue()*(1.-t);
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);
Canvas->setPixelColor(layer.widthOffset+x, layer.hightOffset+y, clr_0);
}
}
}
}
void PaintingArea::createTempLayerAfter(int idx){
if(idx>=0){
LayerObject newLayer;
newLayer.alpha = 255;
newLayer.hight = layerBundle[idx].hight;
newLayer.width = layerBundle[idx].width;
newLayer.hightOffset = layerBundle[idx].hightOffset;
newLayer.widthOffset = layerBundle[idx].widthOffset;
newLayer.image = layerBundle[idx].image->getDeepCopy();
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
}
}

View File

@@ -4,18 +4,25 @@
#include <QColor>
#include <QImage>
#include"Image/IntelliImage.h"
#include <QPoint>
#include <QWidget>
#include <QList>
#include "Image/IntelliImage.h"
#include "Image/IntelliRasterImage.h"
#include "Image/IntelliShapedImage.h"
#include "Tool/IntelliTool.h"
#include "IntelliHelper/IntelliColorPicker.h"
struct LayerObject{
IntelliImage* image;
int width;
int height;
int hight;
int widthOffset;
int heightOffset;
int hightOffset;
int alpha=255;
};
class PaintingArea : public QWidget
@@ -24,46 +31,40 @@ class PaintingArea : public QWidget
// for all Qt objects
// QObjects handle events
Q_OBJECT
friend IntelliTool;
public:
PaintingArea(int maxWidth=600, int maxHeight=600, QWidget *parent = nullptr);
~PaintingArea();
// Handles all events
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
bool open(const QString &fileName);
bool save(const QString &fileName, const char *fileFormat);
int addLayer(int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
int addLayerAt(int idx, int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
void deleteLayer(int index);
void setLayerToActive(int index);
void setAlphaToLayer(int index, int alpha);
void setAlphaOfLayer(int index, int alpha);
void floodFill(int r, int g, int b, int a);
void movePositionActive(int x, int y);
void moveActiveLayer(int idx);
// Has the image been modified since last save
bool isModified() const { return modified; }
//change properties of colorPicker
void colorPickerSetFirstColor();
void colorPickerSetSecondColor();
void colorPickerSwitchColor();
void setPenColor(const QColor &newColor);
QColor penColor() const { return myPenColor; }
//create tools
void createPenTool();
void createPlainTool();
void createLineTool();
void setPenWidth(int newWidth);
int penWidth() const { return myPenWidth; }
QPixmap getAsPixmap();
public slots:
// Events to handle
void clearImage(int r, int g, int b);
void activate(int a);
void deleteActiveLayer();
void slotActivateLayer(int a);
void slotDeleteActiveLayer();
void setAlpha(int a);
void getMoveUp(int a);
void getMoveDown(int a);
void getMoveRight(int a);
void getMoveLeft(int a);
void getMoveLayerUp();
void getMoveLayerDown();
//void setUp helper for konstruktor
void setUp(int maxWidth, int maxHeight);
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
@@ -77,36 +78,28 @@ protected:
void resizeEvent(QResizeEvent *event) override;
private:
void setUp(int maxWidth, int maxHeight);
void activateUpperLayer();
void activateLowerLayer();
QImage* Canvas;
int maxWidth;
int maxHeight;
std::vector<LayerObject> layerStructure;
IntelliTool* Tool;
IntelliColorPicker colorPicker;
std::vector<LayerObject> layerBundle;
int activeLayer=-1;
void assembleLayers(bool forSaving=false);
void drawLineTo(const QPoint &endPoint);
void resizeImage(QImage *image_res, const QSize &newSize);
// Will be marked true or false depending on if
// we have saved after a change
bool modified=false;
// Marked true or false depending on if the user
// is drawing
bool scribbling;
// Holds the current pen width & color
int myPenWidth;
QColor myPenColor;
// Stores the image being drawn
// Stores the location at the current mouse event
QPoint lastPoint;
//Helper for Tool
void createTempLayerAfter(int idx);
};
#endif

View File

@@ -0,0 +1,36 @@
#include "IntelliColorPicker.h"
#include "QDebug"
IntelliColorPicker::IntelliColorPicker(PaintingArea* Area)
:IntelliTool(Area){
firstColor = {255,0,0,255};
secondColor = {0,0,255,255};
}
IntelliColorPicker::~IntelliColorPicker(){
}
void IntelliColorPicker::getColorbar(int firstOrSecondColor = 1){
QString Titel;
QColor newColor;
if(firstOrSecondColor == 1){
Titel = "Choose first Color";
newColor = QColorDialog::getColor(this->firstColor,nullptr,Titel);
this->firstColor = newColor;
qDebug() << "Firstcolor" << this->firstColor;
}
else{
Titel = "Choose second Color";
newColor = QColorDialog::getColor(this->secondColor,nullptr,Titel);
this->secondColor = newColor;
}
}
QColor IntelliColorPicker::getFirstColor(){
return firstColor;
}
QColor IntelliColorPicker::getSecondColor(){
return secondColor;
}

View File

@@ -0,0 +1,77 @@
#include"IntelliTool.h"
#include"Layer/PaintingArea.h"
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker){
this->Area=Area;
this->colorPicker=colorPicker;
}
IntelliTool::~IntelliTool(){
}
void IntelliTool::onMouseRightPressed(int x, int y){
if(drawing){
drawing=false;
this->deleteToolLayer();
}
}
void IntelliTool::onMouseRightReleased(int x, int y){
//optional for tool
}
void IntelliTool::onMouseLeftPressed(int x, int y){
this->drawing=true;
//create drawing layer
this->createToolLayer();
Canvas->image->calculateVisiblity();
}
void IntelliTool::onMouseLeftReleased(int x, int y){
if(drawing){
drawing=false;
this->mergeToolLayer();
this->deleteToolLayer();
Active->image->calculateVisiblity();
}
}
void IntelliTool::onMouseMoved(int x, int y){
if(drawing)
Canvas->image->calculateVisiblity();
}
void IntelliTool::createToolLayer(){
Area->createTempLayerAfter(Area->activeLayer);
this->Active=&Area->layerBundle[Area->activeLayer];
this->Canvas=&Area->layerBundle[Area->activeLayer+1];
}
void IntelliTool::mergeToolLayer(){
QColor clr_0;
QColor clr_1;
for(int y=0; y<Active->hight; y++){
for(int x=0; x<Active->width; x++){
clr_0=Active->image->imageData.pixelColor(x,y);
clr_1=Canvas->image->imageData.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);
Active->image->imageData.setPixelColor(x, y, clr_0);
}
}
}
void IntelliTool::deleteToolLayer(){
Area->deleteLayer(Area->activeLayer+1);
this->Canvas=nullptr;
}

View File

@@ -1,18 +1,34 @@
#ifndef Intelli_Tool_H
#define Intelli_Tool_H
#include"Layer/PaintingArea.h"
#include "IntelliHelper/IntelliColorPicker.h"
#include <vector>
class LayerObject;
class PaintingArea;
class IntelliTool{
private:
LayerObject* DataValue;
LayerObject* Preview;
void createToolLayer();
void mergeToolLayer();
void deleteToolLayer();
protected:
PaintingArea* Area;
IntelliColorPicker* colorPicker;
LayerObject* Active;
LayerObject* Canvas;
bool drawing = false;
public:
IntelliTool(LayerObject* DataValue, LayerObject* Preview);
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliTool() = 0;
virtual void onMousePressed(QMouseEvent *event) = 0;
virtual void onMouseMoved(QMouseEvent* event)=0;
virtual void onMouseReleased(QMouseEvent* event)=0;
virtual void onMouseRightPressed(int x, int y);
virtual void onMouseRightReleased(int x, int y);
virtual void onMouseLeftPressed(int x, int y);
virtual void onMouseLeftReleased(int x, int y);
virtual void onMouseMoved(int x, int y);
};
#endif

View File

@@ -0,0 +1,56 @@
#include "IntelliToolLine.h"
#include "Layer/PaintingArea.h"
#include "QColorDialog"
#include "QInputDialog"
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker)
:IntelliTool(Area, colorPicker){
this->lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
//create checkbox or scroll dialog to get line style
this->lineStyle = LineStyle::SOLID_LINE;
}
IntelliToolLine::~IntelliToolLine(){
}
void IntelliToolLine::onMouseRightPressed(int x, int y){
IntelliTool::onMouseRightPressed(x,y);
}
void IntelliToolLine::onMouseRightReleased(int x, int y){
IntelliTool::onMouseRightReleased(x,y);
}
void IntelliToolLine::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->start=QPoint(x,y);
this->Canvas->image->drawLine(start, start, colorPicker->getFirstColor(),lineWidth);
Canvas->image->calculateVisiblity();
}
void IntelliToolLine::onMouseLeftReleased(int x, int y){
IntelliTool::onMouseLeftReleased(x,y);
}
void IntelliToolLine::onMouseMoved(int x, int y){
IntelliTool::onMouseMoved(x,y);
if(this->drawing){
this->Canvas->image->drawPlain(Qt::transparent);
QPoint next(x,y);
switch(lineStyle){
case LineStyle::SOLID_LINE:
this->Canvas->image->drawLine(start,next,colorPicker->getFirstColor(),lineWidth);
break;
case LineStyle::DOTTED_LINE:
QPoint p1 =start.x() <= next.x() ? start : next;
QPoint p2 =start.x() < next.x() ? next : start;
int m = (float)(p2.y()-p1.y())/(float)(p2.x()-p1.x())+0.5f;
int c = start.y()-start.x()*m;
break;
}
}
IntelliTool::onMouseMoved(x,y);
}

View File

@@ -0,0 +1,31 @@
#ifndef INTELLITOOLLINE_H
#define INTELLITOOLLINE_H
#include "IntelliTool.h"
#include "QColor"
#include "QPoint"
enum class LineStyle{
SOLID_LINE,
DOTTED_LINE
};
class IntelliToolLine : public IntelliTool
{
QPoint start;
int lineWidth;
LineStyle lineStyle;
public:
IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliToolLine() override;
virtual void onMouseRightPressed(int x, int y) override;
virtual void onMouseRightReleased(int x, int y) override;
virtual void onMouseLeftPressed(int x, int y) override;
virtual void onMouseLeftReleased(int x, int y) override;
virtual void onMouseMoved(int x, int y) override;
};
#endif // INTELLITOOLLINE_H

View File

@@ -0,0 +1,42 @@
#include "IntelliToolPen.h"
#include "Layer/PaintingArea.h"
#include "QDebug"
#include "QColorDialog"
#include "QInputDialog"
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker)
:IntelliTool(Area, colorPicker){
this->penWidth = QInputDialog::getInt(nullptr, "Pen width", "Width:", 1,0, 50, 1);
}
IntelliToolPen::~IntelliToolPen(){
}
void IntelliToolPen::onMouseRightPressed(int x, int y){
IntelliTool::onMouseRightPressed(x,y);
}
void IntelliToolPen::onMouseRightReleased(int x, int y){
IntelliTool::onMouseRightReleased(x,y);
}
void IntelliToolPen::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->point=QPoint(x,y);
this->Canvas->image->drawPixel(point, colorPicker->getFirstColor());
Canvas->image->calculateVisiblity();
}
void IntelliToolPen::onMouseLeftReleased(int x, int y){
IntelliTool::onMouseLeftReleased(x,y);
}
void IntelliToolPen::onMouseMoved(int x, int y){
if(this->drawing){
QPoint newPoint(x,y);
this->Canvas->image->drawLine(this->point, newPoint, colorPicker->getFirstColor(), penWidth);
this->point=newPoint;
}
IntelliTool::onMouseMoved(x,y);
}

View File

@@ -0,0 +1,23 @@
#ifndef INTELLITOOLPEN_H
#define INTELLITOOLPEN_H
#include"IntelliTool.h"
#include"QColor"
#include"QPoint"
class IntelliToolPen : public IntelliTool{
int penWidth;
QPoint point;
public:
IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker);
virtual ~IntelliToolPen() override;
virtual void onMouseRightPressed(int x, int y) override;
virtual void onMouseRightReleased(int x, int y) override;
virtual void onMouseLeftPressed(int x, int y) override;
virtual void onMouseLeftReleased(int x, int y) override;
virtual void onMouseMoved(int x, int y) override;
};
#endif // INTELLITOOLPEN_H

View File

@@ -0,0 +1,30 @@
#include "IntelliToolPlain.h"
#include "Layer/PaintingArea.h"
#include "QColorDialog"
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker)
:IntelliTool(Area, colorPicker){
}
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
IntelliTool::onMouseLeftPressed(x,y);
this->Canvas->image->drawPlain(colorPicker->getFirstColor());
Canvas->image->calculateVisiblity();
}
void IntelliToolPlainTool::onMouseLeftReleased(int x, int y){
IntelliTool::onMouseLeftReleased(x,y);
}
void IntelliToolPlainTool::onMouseRightPressed(int x, int y){
IntelliTool::onMouseRightPressed(x,y);
}
void IntelliToolPlainTool::onMouseRightReleased(int x, int y){
IntelliTool::onMouseRightReleased(x,y);
}
void IntelliToolPlainTool::onMouseMoved(int x, int y){
IntelliTool::onMouseMoved(x,y);
}

View File

@@ -0,0 +1,20 @@
#ifndef INTELLITOOLFLOODFILLTOOL_H
#define INTELLITOOLFLOODFILLTOOL_H
#include "IntelliTool.h"
#include "QColor"
class IntelliToolPlainTool : public IntelliTool
{
public:
IntelliToolPlainTool(PaintingArea *Area, IntelliColorPicker* colorPicker);
void onMouseLeftPressed(int x, int y) override;
void onMouseLeftReleased(int x, int y) override;
void onMouseRightPressed(int x, int y) override;
void onMouseRightReleased(int x, int y) override;
void onMouseMoved(int x, int y) override;
};
#endif // INTELLITOOLFLOODFILLTOOL_H

BIN
src/Painting/icon.icns Normal file

Binary file not shown.

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
<width>360</width>
<height>206</height>
</rect>
</property>
<property name="windowTitle">