mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-15 21:00:37 +02:00
Ran Uncrustify Again
This commit is contained in:
@@ -16,7 +16,7 @@ IntelliPhotoGui::IntelliPhotoGui(){
|
|||||||
// Size the app
|
// Size the app
|
||||||
resize(600,600);
|
resize(600,600);
|
||||||
showMaximized();
|
showMaximized();
|
||||||
setDefaultToolValue();
|
setDefaultToolValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// User tried to close the app
|
// User tried to close the app
|
||||||
@@ -81,7 +81,7 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
|||||||
if (ok1&&ok2)
|
if (ok1&&ok2)
|
||||||
{
|
{
|
||||||
int layer = paintingArea->addLayer(width,height,0,0);
|
int layer = paintingArea->addLayer(width,height,0,0);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,12 +95,12 @@ void IntelliPhotoGui::slotDeleteLayer(){
|
|||||||
// Define the standard Value, min, max, step and ok button
|
// Define the standard Value, min, max, step and ok button
|
||||||
int layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
|
int layerNumber = QInputDialog::getInt(this, tr("delete Layer"),
|
||||||
tr("Number:"),
|
tr("Number:"),
|
||||||
paintingArea->getNumberOfActiveLayer(),0, 500, 1, &ok);
|
paintingArea->getNumberOfActiveLayer(),0, 500, 1, &ok);
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok){
|
if (ok) {
|
||||||
paintingArea->deleteLayer(layerNumber);
|
paintingArea->deleteLayer(layerNumber);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetActiveAlpha(){
|
void IntelliPhotoGui::slotSetActiveAlpha(){
|
||||||
@@ -120,7 +120,7 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
|
|||||||
if (ok1&&ok2)
|
if (ok1&&ok2)
|
||||||
{
|
{
|
||||||
paintingArea->setLayerAlpha(layer,alpha);
|
paintingArea->setLayerAlpha(layer,alpha);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ void IntelliPhotoGui::slotClearActiveLayer(){
|
|||||||
if (ok1&&ok2&&ok3&&ok4)
|
if (ok1&&ok2&&ok3&&ok4)
|
||||||
{
|
{
|
||||||
paintingArea->floodFill(red, green, blue, alpha);
|
paintingArea->floodFill(red, green, blue, alpha);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,57 +196,57 @@ void IntelliPhotoGui::slotSetActiveLayer(){
|
|||||||
if (ok1)
|
if (ok1)
|
||||||
{
|
{
|
||||||
paintingArea->setLayerActive(layer);
|
paintingArea->setLayerActive(layer);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetFirstColor(){
|
void IntelliPhotoGui::slotSetFirstColor(){
|
||||||
paintingArea->colorPickerSetFirstColor();
|
paintingArea->colorPickerSetFirstColor();
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSetSecondColor(){
|
void IntelliPhotoGui::slotSetSecondColor(){
|
||||||
paintingArea->colorPickerSetSecondColor();
|
paintingArea->colorPickerSetSecondColor();
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotSwapColor(){
|
void IntelliPhotoGui::slotSwapColor(){
|
||||||
paintingArea->colorPickerSwapColors();
|
paintingArea->colorPickerSwapColors();
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreatePenTool(){
|
void IntelliPhotoGui::slotCreatePenTool(){
|
||||||
PenButton->setChecked(true);
|
PenButton->setChecked(true);
|
||||||
paintingArea->createPenTool();
|
paintingArea->createPenTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreatePlainTool(){
|
void IntelliPhotoGui::slotCreatePlainTool(){
|
||||||
PlainButton->setChecked(true);
|
PlainButton->setChecked(true);
|
||||||
paintingArea->createPlainTool();
|
paintingArea->createPlainTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreateLineTool(){
|
void IntelliPhotoGui::slotCreateLineTool(){
|
||||||
LineButton->setChecked(true);
|
LineButton->setChecked(true);
|
||||||
paintingArea->createLineTool();
|
paintingArea->createLineTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreateRectangleTool(){
|
void IntelliPhotoGui::slotCreateRectangleTool(){
|
||||||
RectangleButton->setChecked(true);
|
RectangleButton->setChecked(true);
|
||||||
paintingArea->createRectangleTool();
|
paintingArea->createRectangleTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreateCircleTool(){
|
void IntelliPhotoGui::slotCreateCircleTool(){
|
||||||
CircleButton->setChecked(true);
|
CircleButton->setChecked(true);
|
||||||
paintingArea->createCircleTool();
|
paintingArea->createCircleTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreatePolygonTool(){
|
void IntelliPhotoGui::slotCreatePolygonTool(){
|
||||||
PolygonButton->setChecked(true);
|
PolygonButton->setChecked(true);
|
||||||
paintingArea->createPolygonTool();
|
paintingArea->createPolygonTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotCreateFloodFillTool(){
|
void IntelliPhotoGui::slotCreateFloodFillTool(){
|
||||||
FloodFillButton->setChecked(true);
|
FloodFillButton->setChecked(true);
|
||||||
paintingArea->createFloodFillTool();
|
paintingArea->createFloodFillTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -258,26 +258,26 @@ void IntelliPhotoGui::slotAboutDialog(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotEnterPressed(){
|
void IntelliPhotoGui::slotEnterPressed(){
|
||||||
QString string = EditLineWidth->text();
|
QString string = EditLineWidth->text();
|
||||||
if(string.toInt() > 50){
|
if(string.toInt() > 50) {
|
||||||
EditLineWidth->setText("50");
|
EditLineWidth->setText("50");
|
||||||
}
|
}
|
||||||
paintingArea->Toolsettings.setLineWidth(string.toInt());
|
paintingArea->Toolsettings.setLineWidth(string.toInt());
|
||||||
string = EditLineInnerAlpha->text();
|
string = EditLineInnerAlpha->text();
|
||||||
if(string.toInt() > 255){
|
if(string.toInt() > 255) {
|
||||||
EditLineInnerAlpha->setText("255");
|
EditLineInnerAlpha->setText("255");
|
||||||
}
|
}
|
||||||
paintingArea->Toolsettings.setInnerAlpha(string.toInt());
|
paintingArea->Toolsettings.setInnerAlpha(string.toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotResetTools(){
|
void IntelliPhotoGui::slotResetTools(){
|
||||||
CircleButton->setChecked(false);
|
CircleButton->setChecked(false);
|
||||||
FloodFillButton->setChecked(false);
|
FloodFillButton->setChecked(false);
|
||||||
LineButton->setChecked(false);
|
LineButton->setChecked(false);
|
||||||
PenButton->setChecked(false);
|
PenButton->setChecked(false);
|
||||||
PlainButton->setChecked(false);
|
PlainButton->setChecked(false);
|
||||||
PolygonButton->setChecked(false);
|
PolygonButton->setChecked(false);
|
||||||
RectangleButton->setChecked(false);
|
RectangleButton->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define menu actions that call functions
|
// Define menu actions that call functions
|
||||||
@@ -359,45 +359,45 @@ void IntelliPhotoGui::createActions(){
|
|||||||
//Create Color Actions here
|
//Create Color Actions here
|
||||||
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
|
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
|
||||||
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
|
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
|
||||||
connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor()));
|
connect(FirstColorButton, SIGNAL(clicked()), this, SLOT(slotSetFirstColor()));
|
||||||
|
|
||||||
actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
|
actionColorPickerSecondColor = new QAction(tr("&Secondary"), this);
|
||||||
connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor()));
|
connect(actionColorPickerSecondColor, SIGNAL(triggered()), this, SLOT(slotSetSecondColor()));
|
||||||
connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor()));
|
connect(SecondColorButton, SIGNAL(clicked()), this, SLOT(slotSetSecondColor()));
|
||||||
|
|
||||||
actionColorSwap = new QAction(tr("&Switch"), this);
|
actionColorSwap = new QAction(tr("&Switch"), this);
|
||||||
actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
actionColorSwap->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
||||||
connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor()));
|
connect(actionColorSwap, SIGNAL(triggered()), this, SLOT(slotSwapColor()));
|
||||||
connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor()));
|
connect(SwitchColorButton, SIGNAL(clicked()), this, SLOT(slotSwapColor()));
|
||||||
|
|
||||||
//Create Tool actions down here
|
//Create Tool actions down here
|
||||||
actionCreatePlainTool = new QAction(tr("&Plain"), this);
|
actionCreatePlainTool = new QAction(tr("&Plain"), this);
|
||||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
|
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
|
||||||
|
|
||||||
|
|
||||||
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
||||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
||||||
|
|
||||||
actionCreateLineTool = new QAction(tr("&Line"), this);
|
actionCreateLineTool = new QAction(tr("&Line"), this);
|
||||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
|
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
|
||||||
|
|
||||||
actionCreateCircleTool = new QAction(tr("&Circle"), this);
|
actionCreateCircleTool = new QAction(tr("&Circle"), this);
|
||||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
|
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
|
||||||
|
|
||||||
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
|
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
|
||||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
|
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
|
||||||
|
|
||||||
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
|
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
|
||||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
|
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
|
||||||
|
|
||||||
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
|
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
|
||||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetTools()));
|
||||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
||||||
|
|
||||||
// Create about action and tie to IntelliPhotoGui::about()
|
// Create about action and tie to IntelliPhotoGui::about()
|
||||||
@@ -408,29 +408,29 @@ void IntelliPhotoGui::createActions(){
|
|||||||
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
||||||
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
|
|
||||||
connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
||||||
connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
||||||
|
|
||||||
connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool()));
|
connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool()));
|
||||||
|
|
||||||
connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool()));
|
connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool()));
|
||||||
|
|
||||||
connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool()));
|
connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool()));
|
||||||
|
|
||||||
connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool()));
|
connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool()));
|
||||||
|
|
||||||
connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool()));
|
connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool()));
|
||||||
|
|
||||||
connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool()));
|
connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool()));
|
||||||
|
|
||||||
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetTools()));
|
||||||
connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
|
connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the menubar
|
// Create the menubar
|
||||||
@@ -472,12 +472,12 @@ void IntelliPhotoGui::createMenus(){
|
|||||||
|
|
||||||
//Attach all Tool Options
|
//Attach all Tool Options
|
||||||
toolMenu = new QMenu(tr("&Tools"), this);
|
toolMenu = new QMenu(tr("&Tools"), this);
|
||||||
toolMenu->addAction(actionCreateCircleTool);
|
toolMenu->addAction(actionCreateCircleTool);
|
||||||
toolMenu->addAction(actionCreateFloodFillTool);
|
toolMenu->addAction(actionCreateFloodFillTool);
|
||||||
toolMenu->addAction(actionCreateLineTool);
|
toolMenu->addAction(actionCreateLineTool);
|
||||||
toolMenu->addAction(actionCreatePenTool);
|
toolMenu->addAction(actionCreatePenTool);
|
||||||
toolMenu->addAction(actionCreatePlainTool);
|
toolMenu->addAction(actionCreatePlainTool);
|
||||||
toolMenu->addAction(actionCreatePolygonTool);
|
toolMenu->addAction(actionCreatePolygonTool);
|
||||||
toolMenu->addAction(actionCreateRectangleTool);
|
toolMenu->addAction(actionCreateRectangleTool);
|
||||||
toolMenu->addSeparator();
|
toolMenu->addSeparator();
|
||||||
toolMenu->addMenu(colorMenu);
|
toolMenu->addMenu(colorMenu);
|
||||||
@@ -506,137 +506,137 @@ void IntelliPhotoGui::createGui(){
|
|||||||
|
|
||||||
// create Gui elements
|
// create Gui elements
|
||||||
paintingArea = new PaintingArea();
|
paintingArea = new PaintingArea();
|
||||||
paintingArea->DumpyGui = this;
|
paintingArea->DumpyGui = this;
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
p = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
||||||
CircleButton = new QPushButton();
|
CircleButton = new QPushButton();
|
||||||
CircleButton->setFixedSize(Buttonsize);
|
CircleButton->setFixedSize(Buttonsize);
|
||||||
CircleButton->setIcon(p);
|
CircleButton->setIcon(p);
|
||||||
CircleButton->setIconSize(Buttonsize);
|
CircleButton->setIconSize(Buttonsize);
|
||||||
CircleButton->setCheckable(true);
|
CircleButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
|
p = QPixmap(":/Icons/Buttons/icons/flood-fill-tool.svg");
|
||||||
FloodFillButton = new QPushButton();
|
FloodFillButton = new QPushButton();
|
||||||
FloodFillButton->setFixedSize(Buttonsize);
|
FloodFillButton->setFixedSize(Buttonsize);
|
||||||
FloodFillButton->setIcon(p);
|
FloodFillButton->setIcon(p);
|
||||||
FloodFillButton->setIconSize(Buttonsize);
|
FloodFillButton->setIconSize(Buttonsize);
|
||||||
FloodFillButton->setCheckable(true);
|
FloodFillButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/icon.png");
|
p = QPixmap(":/Icons/Buttons/icons/icon.png");
|
||||||
LineButton = new QPushButton();
|
LineButton = new QPushButton();
|
||||||
LineButton->setFixedSize(Buttonsize);
|
LineButton->setFixedSize(Buttonsize);
|
||||||
LineButton->setIcon(p);
|
LineButton->setIcon(p);
|
||||||
LineButton->setIconSize(Buttonsize);
|
LineButton->setIconSize(Buttonsize);
|
||||||
LineButton->setCheckable(true);
|
LineButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
|
p = QPixmap(":/Icons/Buttons/icons/pen-tool.svg");
|
||||||
PenButton = new QPushButton();
|
PenButton = new QPushButton();
|
||||||
PenButton->setFixedSize(Buttonsize);
|
PenButton->setFixedSize(Buttonsize);
|
||||||
PenButton->setIcon(p);
|
PenButton->setIcon(p);
|
||||||
PenButton->setIconSize(Buttonsize);
|
PenButton->setIconSize(Buttonsize);
|
||||||
PenButton->setCheckable(true);
|
PenButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/icon.png");
|
p = QPixmap(":/Icons/Buttons/icons/icon.png");
|
||||||
PlainButton = new QPushButton();
|
PlainButton = new QPushButton();
|
||||||
PlainButton->setFixedSize(Buttonsize);
|
PlainButton->setFixedSize(Buttonsize);
|
||||||
PlainButton->setIcon(p);
|
PlainButton->setIcon(p);
|
||||||
PlainButton->setIconSize(Buttonsize);
|
PlainButton->setIconSize(Buttonsize);
|
||||||
PlainButton->setCheckable(true);
|
PlainButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
|
p = QPixmap(":/Icons/Buttons/icons/polygon-tool.svg");
|
||||||
PolygonButton = new QPushButton();
|
PolygonButton = new QPushButton();
|
||||||
PolygonButton->setFixedSize(Buttonsize);
|
PolygonButton->setFixedSize(Buttonsize);
|
||||||
PolygonButton->setIcon(p);
|
PolygonButton->setIcon(p);
|
||||||
PolygonButton->setIconSize(Buttonsize);
|
PolygonButton->setIconSize(Buttonsize);
|
||||||
PolygonButton->setCheckable(true);
|
PolygonButton->setCheckable(true);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
|
p = QPixmap(":/Icons/Buttons/icons/rectangle-tool.svg");
|
||||||
RectangleButton = new QPushButton();
|
RectangleButton = new QPushButton();
|
||||||
RectangleButton->setFixedSize(Buttonsize);
|
RectangleButton->setFixedSize(Buttonsize);
|
||||||
RectangleButton->setIcon(p);
|
RectangleButton->setIcon(p);
|
||||||
RectangleButton->setIconSize(Buttonsize);
|
RectangleButton->setIconSize(Buttonsize);
|
||||||
RectangleButton->setCheckable(true);
|
RectangleButton->setCheckable(true);
|
||||||
|
|
||||||
WidthLine = new QLabel();
|
WidthLine = new QLabel();
|
||||||
WidthLine->setText("Width");
|
WidthLine->setText("Width");
|
||||||
WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
WidthLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
||||||
|
|
||||||
EditLineWidth = new QLineEdit();
|
EditLineWidth = new QLineEdit();
|
||||||
EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
EditLineWidth->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
||||||
EditLineWidth->setText("5");
|
EditLineWidth->setText("5");
|
||||||
ValidatorLineWidth = new QIntValidator();
|
ValidatorLineWidth = new QIntValidator();
|
||||||
ValidatorLineWidth->setTop(99);
|
ValidatorLineWidth->setTop(99);
|
||||||
ValidatorLineWidth->setBottom(1);
|
ValidatorLineWidth->setBottom(1);
|
||||||
EditLineWidth->setValidator(ValidatorLineWidth);
|
EditLineWidth->setValidator(ValidatorLineWidth);
|
||||||
|
|
||||||
innerAlphaLine = new QLabel();
|
innerAlphaLine = new QLabel();
|
||||||
innerAlphaLine->setText("Inner Alpha");
|
innerAlphaLine->setText("Inner Alpha");
|
||||||
innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
innerAlphaLine->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
||||||
|
|
||||||
EditLineInnerAlpha = new QLineEdit();
|
EditLineInnerAlpha = new QLineEdit();
|
||||||
EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
EditLineInnerAlpha->setFixedSize(Buttonsize.width(),Buttonsize.height()/3);
|
||||||
EditLineInnerAlpha->setText("255");
|
EditLineInnerAlpha->setText("255");
|
||||||
ValidatorInnerAlpha = new QIntValidator();
|
ValidatorInnerAlpha = new QIntValidator();
|
||||||
ValidatorInnerAlpha->setTop(999);
|
ValidatorInnerAlpha->setTop(999);
|
||||||
ValidatorInnerAlpha->setBottom(0);
|
ValidatorInnerAlpha->setBottom(0);
|
||||||
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
EditLineInnerAlpha->setValidator(ValidatorInnerAlpha);
|
||||||
|
|
||||||
FirstColorButton = new QPushButton();
|
FirstColorButton = new QPushButton();
|
||||||
FirstColorButton->setFixedSize(Buttonsize/2);
|
FirstColorButton->setFixedSize(Buttonsize/2);
|
||||||
|
|
||||||
SecondColorButton = new QPushButton();
|
SecondColorButton = new QPushButton();
|
||||||
SecondColorButton->setFixedSize(Buttonsize/2);
|
SecondColorButton->setFixedSize(Buttonsize/2);
|
||||||
|
|
||||||
p = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
|
p = QPixmap(":/Icons/Buttons/icons/Wechselpfeile.png");
|
||||||
SwitchColorButton = new QPushButton();
|
SwitchColorButton = new QPushButton();
|
||||||
SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2);
|
SwitchColorButton->setFixedSize(Buttonsize.width(),Buttonsize.height()/2);
|
||||||
SwitchColorButton->setIcon(p);
|
SwitchColorButton->setIcon(p);
|
||||||
SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2));
|
SwitchColorButton->setIconSize(QSize(Buttonsize.width(),Buttonsize.height()/2));
|
||||||
|
|
||||||
ActiveLayerLine = new QLabel();
|
ActiveLayerLine = new QLabel();
|
||||||
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer());
|
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer());
|
||||||
ActiveLayerLine->setText(string);
|
ActiveLayerLine->setText(string);
|
||||||
ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3);
|
ActiveLayerLine->setFixedSize(Buttonsize.width()+10,Buttonsize.height()/3);
|
||||||
|
|
||||||
p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData());
|
p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData());
|
||||||
|
|
||||||
ActiveLayerImageButton = new QPushButton();
|
ActiveLayerImageButton = new QPushButton();
|
||||||
ActiveLayerImageButton->setFixedSize(Buttonsize);
|
ActiveLayerImageButton->setFixedSize(Buttonsize);
|
||||||
ActiveLayerImageButton->setIcon(p);
|
ActiveLayerImageButton->setIcon(p);
|
||||||
ActiveLayerImageButton->setIconSize(Buttonsize);
|
ActiveLayerImageButton->setIconSize(Buttonsize);
|
||||||
|
|
||||||
// set gui elements
|
// set gui elements
|
||||||
|
|
||||||
mainLayout->addWidget(paintingArea,1,1,20,1);
|
mainLayout->addWidget(paintingArea,1,1,20,1);
|
||||||
mainLayout->addWidget(CircleButton,1,2,1,2);
|
mainLayout->addWidget(CircleButton,1,2,1,2);
|
||||||
mainLayout->addWidget(FloodFillButton,2,2,1,2);
|
mainLayout->addWidget(FloodFillButton,2,2,1,2);
|
||||||
mainLayout->addWidget(LineButton,3,2,1,2);
|
mainLayout->addWidget(LineButton,3,2,1,2);
|
||||||
mainLayout->addWidget(PenButton,4,2,1,2);
|
mainLayout->addWidget(PenButton,4,2,1,2);
|
||||||
mainLayout->addWidget(PlainButton,5,2,1,2);
|
mainLayout->addWidget(PlainButton,5,2,1,2);
|
||||||
mainLayout->addWidget(PolygonButton,6,2,1,2);
|
mainLayout->addWidget(PolygonButton,6,2,1,2);
|
||||||
mainLayout->addWidget(RectangleButton,7,2,1,2);
|
mainLayout->addWidget(RectangleButton,7,2,1,2);
|
||||||
mainLayout->addWidget(WidthLine,8,2,1,2);
|
mainLayout->addWidget(WidthLine,8,2,1,2);
|
||||||
mainLayout->addWidget(EditLineWidth,9,2,1,2);
|
mainLayout->addWidget(EditLineWidth,9,2,1,2);
|
||||||
mainLayout->addWidget(innerAlphaLine,10,2,1,2);
|
mainLayout->addWidget(innerAlphaLine,10,2,1,2);
|
||||||
mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2);
|
mainLayout->addWidget(EditLineInnerAlpha,11,2,1,2);
|
||||||
mainLayout->addWidget(FirstColorButton,12,2,1,1);
|
mainLayout->addWidget(FirstColorButton,12,2,1,1);
|
||||||
mainLayout->addWidget(SecondColorButton,12,3,1,1);
|
mainLayout->addWidget(SecondColorButton,12,3,1,1);
|
||||||
mainLayout->addWidget(SwitchColorButton,13,2,1,2);
|
mainLayout->addWidget(SwitchColorButton,13,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerLine,14,2,1,2);
|
mainLayout->addWidget(ActiveLayerLine,14,2,1,2);
|
||||||
mainLayout->addWidget(ActiveLayerImageButton,15,2,1,2);
|
mainLayout->addWidget(ActiveLayerImageButton,15,2,1,2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setIntelliStyle(){
|
void IntelliPhotoGui::setIntelliStyle(){
|
||||||
// Set the title
|
// Set the title
|
||||||
setWindowTitle("IntelliPhoto Prototype");
|
setWindowTitle("IntelliPhoto Prototype");
|
||||||
// Set style sheet
|
// Set style sheet
|
||||||
this->setStyleSheet("background-color:rgb(64,64,64)");
|
this->setStyleSheet("background-color:rgb(64,64,64)");
|
||||||
this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)");
|
this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)");
|
||||||
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
this->menuBar()->setStyleSheet("color:rgb(255,255,255)");
|
||||||
QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
QString string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
||||||
FirstColorButton->setStyleSheet(string);
|
FirstColorButton->setStyleSheet(string);
|
||||||
string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
|
string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
|
||||||
SecondColorButton->setStyleSheet(string);
|
SecondColorButton->setStyleSheet(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliPhotoGui::maybeSave(){
|
bool IntelliPhotoGui::maybeSave(){
|
||||||
@@ -688,18 +688,18 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::setDefaultToolValue(){
|
void IntelliPhotoGui::setDefaultToolValue(){
|
||||||
slotEnterPressed();
|
slotEnterPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::UpdateGui(){
|
void IntelliPhotoGui::UpdateGui(){
|
||||||
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer());
|
QString string = QString("Active Layer: %1").arg(paintingArea->getNumberOfActiveLayer());
|
||||||
ActiveLayerLine->setText(string);
|
ActiveLayerLine->setText(string);
|
||||||
p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData());
|
p = p.fromImage(paintingArea->getImageOfActiveLayer()->getImageData());
|
||||||
ActiveLayerImageButton->setIcon(p);
|
ActiveLayerImageButton->setIcon(p);
|
||||||
ActiveLayerImageButton->setIconSize(Buttonsize);
|
ActiveLayerImageButton->setIconSize(Buttonsize);
|
||||||
|
|
||||||
string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
string = QString("background-color: %1").arg(paintingArea->colorPicker.getFirstColor().name());
|
||||||
FirstColorButton->setStyleSheet(string);
|
FirstColorButton->setStyleSheet(string);
|
||||||
string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
|
string = QString("background-color: %1").arg(paintingArea->colorPicker.getSecondColor().name());
|
||||||
SecondColorButton->setStyleSheet(string);
|
SecondColorButton->setStyleSheet(string);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ bool IntelliImage::loadImage(const QString &filePath){
|
|||||||
QImage loadedImage;
|
QImage loadedImage;
|
||||||
|
|
||||||
// If the image wasn't loaded leave this function
|
// If the image wasn't loaded leave this function
|
||||||
if (!loadedImage.load(filePath))
|
if (!loadedImage.load(filePath))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// scaled Image to size of Layer
|
// scaled Image to size of Layer
|
||||||
@@ -83,5 +83,5 @@ QColor IntelliImage::getPixelColor(QPoint& point){
|
|||||||
}
|
}
|
||||||
|
|
||||||
QImage IntelliImage::getImageData(){
|
QImage IntelliImage::getImageData(){
|
||||||
return imageData;
|
return imageData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ public:
|
|||||||
* \brief The Types, which an Image can be.
|
* \brief The Types, which an Image can be.
|
||||||
*/
|
*/
|
||||||
enum class ImageType {
|
enum class ImageType {
|
||||||
RASTERIMAGE,
|
RASTERIMAGE,
|
||||||
SHAPEDIMAGE
|
SHAPEDIMAGE
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -125,7 +125,7 @@ virtual std::vector<QPoint> getPolygonData(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual ImageType getTypeOfImage(){
|
virtual ImageType getTypeOfImage(){
|
||||||
return TypeOfImage;
|
return TypeOfImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
IntelliRasterImage::IntelliRasterImage(int weight, int height)
|
IntelliRasterImage::IntelliRasterImage(int weight, int height)
|
||||||
: IntelliImage(weight, height){
|
: IntelliImage(weight, height){
|
||||||
TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliRasterImage::~IntelliRasterImage(){
|
IntelliRasterImage::~IntelliRasterImage(){
|
||||||
@@ -15,7 +15,7 @@ IntelliRasterImage::~IntelliRasterImage(){
|
|||||||
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
||||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
|
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height());
|
||||||
raster->imageData.fill(Qt::transparent);
|
raster->imageData.fill(Qt::transparent);
|
||||||
raster->TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
raster->TypeOfImage = IntelliImage::ImageType::RASTERIMAGE;
|
||||||
return raster;
|
return raster;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
IntelliShapedImage::IntelliShapedImage(int weight, int height)
|
IntelliShapedImage::IntelliShapedImage(int weight, int height)
|
||||||
: IntelliRasterImage(weight, height){
|
: IntelliRasterImage(weight, height){
|
||||||
TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliShapedImage::~IntelliShapedImage(){
|
IntelliShapedImage::~IntelliShapedImage(){
|
||||||
@@ -21,7 +21,7 @@ IntelliImage* IntelliShapedImage::getDeepCopy(){
|
|||||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height());
|
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height());
|
||||||
shaped->setPolygon(this->polygonData);
|
shaped->setPolygon(this->polygonData);
|
||||||
shaped->imageData.fill(Qt::transparent);
|
shaped->imageData.fill(Qt::transparent);
|
||||||
shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
shaped->TypeOfImage = IntelliImage::ImageType::SHAPEDIMAGE;
|
||||||
return shaped;
|
return shaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ IntelliRenderSettings::IntelliRenderSettings()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliRenderSettings::getFastRenderer(){
|
bool IntelliRenderSettings::getFastRenderer(){
|
||||||
return fastRenderer;
|
return fastRenderer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
class IntelliRenderSettings
|
class IntelliRenderSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntelliRenderSettings();
|
IntelliRenderSettings();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The getfastRenderer gets the value of the flag for the fastRenderer setting.
|
* \brief The getfastRenderer gets the value of the flag for the fastRenderer setting.
|
||||||
* \return Returns true if fastRenderer is active else false
|
* \return Returns true if fastRenderer is active else false
|
||||||
*/
|
*/
|
||||||
bool getFastRenderer();
|
bool getFastRenderer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fastRenderer = true;
|
bool fastRenderer = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTELLIRENDERSETTINGS_H
|
#endif // INTELLIRENDERSETTINGS_H
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
IntelliToolsettings::IntelliToolsettings()
|
IntelliToolsettings::IntelliToolsettings()
|
||||||
{
|
{
|
||||||
lineWidth = 1;
|
lineWidth = 1;
|
||||||
innerAlpha = 255;
|
innerAlpha = 255;
|
||||||
Linestyle = LineStyle::SOLID_LINE;
|
Linestyle = LineStyle::SOLID_LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolsettings::~IntelliToolsettings(){
|
IntelliToolsettings::~IntelliToolsettings(){
|
||||||
@@ -13,41 +13,41 @@ IntelliToolsettings::~IntelliToolsettings(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IntelliToolsettings::getLineWidth(){
|
int IntelliToolsettings::getLineWidth(){
|
||||||
return lineWidth;
|
return lineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setLineWidth(){
|
void IntelliToolsettings::setLineWidth(){
|
||||||
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setLineWidth(int LineWidth){
|
void IntelliToolsettings::setLineWidth(int LineWidth){
|
||||||
if(LineWidth < 1){
|
if(LineWidth < 1) {
|
||||||
LineWidth = 1;
|
LineWidth = 1;
|
||||||
}
|
}
|
||||||
else if(LineWidth > 50){
|
else if(LineWidth > 50) {
|
||||||
LineWidth = 50;
|
LineWidth = 50;
|
||||||
}
|
}
|
||||||
lineWidth = LineWidth;
|
lineWidth = LineWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
int IntelliToolsettings::getInnerAlpha(){
|
int IntelliToolsettings::getInnerAlpha(){
|
||||||
return this->innerAlpha;
|
return this->innerAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setInnerAlpha(){
|
void IntelliToolsettings::setInnerAlpha(){
|
||||||
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1);
|
this->innerAlpha = QInputDialog::getInt(nullptr,"Inner Aplha Input", "Value",0,0,255,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolsettings::setInnerAlpha(int innerAlpha){
|
void IntelliToolsettings::setInnerAlpha(int innerAlpha){
|
||||||
if(innerAlpha < 0){
|
if(innerAlpha < 0) {
|
||||||
innerAlpha = 0;
|
innerAlpha = 0;
|
||||||
}
|
}
|
||||||
else if(innerAlpha > 255){
|
else if(innerAlpha > 255) {
|
||||||
innerAlpha = 255;
|
innerAlpha = 255;
|
||||||
}
|
}
|
||||||
this->innerAlpha = innerAlpha;
|
this->innerAlpha = innerAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){
|
IntelliToolsettings::LineStyle IntelliToolsettings::getLinestyle(){
|
||||||
return Linestyle;
|
return Linestyle;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,27 +3,27 @@
|
|||||||
|
|
||||||
class IntelliToolsettings {
|
class IntelliToolsettings {
|
||||||
public:
|
public:
|
||||||
/*!
|
/*!
|
||||||
* \brief The LineStyle enum classifing all ways of drawing a line.
|
* \brief The LineStyle enum classifing all ways of drawing a line.
|
||||||
*/
|
*/
|
||||||
enum class LineStyle {
|
enum class LineStyle {
|
||||||
SOLID_LINE,
|
SOLID_LINE,
|
||||||
DOTTED_LINE
|
DOTTED_LINE
|
||||||
};
|
};
|
||||||
IntelliToolsettings();
|
IntelliToolsettings();
|
||||||
virtual ~IntelliToolsettings();
|
virtual ~IntelliToolsettings();
|
||||||
int getLineWidth();
|
int getLineWidth();
|
||||||
void setLineWidth();
|
void setLineWidth();
|
||||||
void setLineWidth(int LineWidth);
|
void setLineWidth(int LineWidth);
|
||||||
int getInnerAlpha();
|
int getInnerAlpha();
|
||||||
void setInnerAlpha();
|
void setInnerAlpha();
|
||||||
void setInnerAlpha(int innerAlpha);
|
void setInnerAlpha(int innerAlpha);
|
||||||
LineStyle getLinestyle();
|
LineStyle getLinestyle();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int lineWidth;
|
int lineWidth;
|
||||||
int innerAlpha;
|
int innerAlpha;
|
||||||
LineStyle Linestyle;
|
LineStyle Linestyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTELLITOOLSETTINGS_H
|
#endif // INTELLITOOLSETTINGS_H
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ std::vector<Triangle> IntelliTriangulation::calculateTriangles(std::vector<QPoin
|
|||||||
QPoint BP(point.x()-post.x(), point.y()-post.y());
|
QPoint BP(point.x()-post.x(), point.y()-post.y());
|
||||||
|
|
||||||
float topSclar = AP.x()*BP.x()+AP.y()*BP.y();
|
float topSclar = AP.x()*BP.x()+AP.y()*BP.y();
|
||||||
float absolute = static_cast<float>(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.)));
|
float absolute = static_cast<float>(sqrt(pow(AP.x(),2.)+pow(AP.y(),2.))*sqrt(pow(BP.x(),2.)+pow(BP.y(),2.)));
|
||||||
return acos(topSclar/absolute);
|
return acos(topSclar/absolute);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ std::vector<Triangle> IntelliTriangulation::calculateTriangles(std::vector<QPoin
|
|||||||
|
|
||||||
// return if the vertex is a tip
|
// return if the vertex is a tip
|
||||||
auto isTip = [](float angle){
|
auto isTip = [](float angle){
|
||||||
return static_cast<double>(angle)<(pi/2.);
|
return static_cast<double>(angle)<(pi/2.);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<TriangleHelper> Vertices;
|
std::vector<TriangleHelper> Vertices;
|
||||||
@@ -88,7 +88,7 @@ std::vector<Triangle> IntelliTriangulation::calculateTriangles(std::vector<QPoin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update post und prev idx
|
// update post und prev idx
|
||||||
post = getPrev(post, Vertices.size());
|
post = getPrev(post, Vertices.size());
|
||||||
prev = prev<smallest.idx ? prev : (prev-1);
|
prev = prev<smallest.idx ? prev : (prev-1);
|
||||||
|
|
||||||
// calcultae neighboors of prev and post to calculate new interior angles
|
// calcultae neighboors of prev and post to calculate new interior angles
|
||||||
@@ -115,7 +115,7 @@ std::vector<Triangle> IntelliTriangulation::calculateTriangles(std::vector<QPoin
|
|||||||
|
|
||||||
bool IntelliTriangulation::isInPolygon(std::vector<Triangle> &triangles, QPoint &point){
|
bool IntelliTriangulation::isInPolygon(std::vector<Triangle> &triangles, QPoint &point){
|
||||||
for(auto triangle : triangles) {
|
for(auto triangle : triangles) {
|
||||||
if(IntelliTriangulation::isInTriangle(triangle, point)) {
|
if(IntelliTriangulation::isInTriangle(triangle, point)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ inline bool isInTriangle(Triangle& tri, QPoint& P){
|
|||||||
float val1, val2, val3;
|
float val1, val2, val3;
|
||||||
bool neg, pos;
|
bool neg, pos;
|
||||||
|
|
||||||
val1 = IntelliTriangulation::sign(P,tri.A,tri.B);
|
val1 = IntelliTriangulation::sign(P,tri.A,tri.B);
|
||||||
val2 = IntelliTriangulation::sign(P,tri.B,tri.C);
|
val2 = IntelliTriangulation::sign(P,tri.B,tri.C);
|
||||||
val3 = IntelliTriangulation::sign(P,tri.C,tri.A);
|
val3 = IntelliTriangulation::sign(P,tri.C,tri.A);
|
||||||
|
|
||||||
neg = (val1<0.f) || (val2<0.f) || (val3<0.f);
|
neg = (val1<0.f) || (val2<0.f) || (val3<0.f);
|
||||||
pos = (val1>0.f) || (val2>0.f) || (val3>0.f);
|
pos = (val1>0.f) || (val2>0.f) || (val3>0.f);
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
||||||
: QWidget(parent){
|
: QWidget(parent){
|
||||||
this->Tool = nullptr;
|
this->Tool = nullptr;
|
||||||
this->setLayerDimensions(maxWidth, maxHeight);
|
this->setLayerDimensions(maxWidth, maxHeight);
|
||||||
this->addLayer(200,200,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
|
this->addLayer(200,200,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
|
layerBundle[0].image->drawPlain(QColor(0,0,255,255));
|
||||||
std::vector<QPoint> polygon;
|
std::vector<QPoint> polygon;
|
||||||
polygon.push_back(QPoint(100,000));
|
polygon.push_back(QPoint(100,000));
|
||||||
@@ -31,7 +31,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
|||||||
polygon.push_back(QPoint(000,100));
|
polygon.push_back(QPoint(000,100));
|
||||||
layerBundle[0].image->setPolygon(polygon);
|
layerBundle[0].image->setPolygon(polygon);
|
||||||
|
|
||||||
this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE);
|
this->addLayer(200,200,150,150,IntelliImage::ImageType::RASTERIMAGE);
|
||||||
layerBundle[1].image->drawPlain(QColor(0,255,0,255));
|
layerBundle[1].image->drawPlain(QColor(0,255,0,255));
|
||||||
layerBundle[1].alpha=200;
|
layerBundle[1].alpha=200;
|
||||||
|
|
||||||
@@ -59,22 +59,22 @@ int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOff
|
|||||||
newLayer.height = height;
|
newLayer.height = height;
|
||||||
newLayer.widthOffset = widthOffset;
|
newLayer.widthOffset = widthOffset;
|
||||||
newLayer.heightOffset = heightOffset;
|
newLayer.heightOffset = heightOffset;
|
||||||
if(type==IntelliImage::ImageType::RASTERIMAGE) {
|
if(type==IntelliImage::ImageType::RASTERIMAGE) {
|
||||||
newLayer.image = new IntelliRasterImage(width,height);
|
newLayer.image = new IntelliRasterImage(width,height);
|
||||||
}else if(type==IntelliImage::ImageType::SHAPEDIMAGE) {
|
}else if(type==IntelliImage::ImageType::SHAPEDIMAGE) {
|
||||||
newLayer.image = new IntelliShapedImage(width, height);
|
newLayer.image = new IntelliShapedImage(width, height);
|
||||||
}
|
}
|
||||||
newLayer.alpha = 255;
|
newLayer.alpha = 255;
|
||||||
this->layerBundle.push_back(newLayer);
|
this->layerBundle.push_back(newLayer);
|
||||||
activeLayer = static_cast<int>(layerBundle.size())-1;
|
activeLayer = static_cast<int>(layerBundle.size())-1;
|
||||||
return activeLayer;
|
return activeLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaintingArea::deleteLayer(int idx){
|
void PaintingArea::deleteLayer(int idx){
|
||||||
if(idx<static_cast<int>(layerBundle.size())) {
|
if(idx<static_cast<int>(layerBundle.size())) {
|
||||||
this->layerBundle.erase(layerBundle.begin()+idx);
|
this->layerBundle.erase(layerBundle.begin()+idx);
|
||||||
if(activeLayer>=idx && activeLayer != 0) {
|
if(activeLayer>=idx && activeLayer != 0) {
|
||||||
activeLayer--;
|
activeLayer--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ bool PaintingArea::open(const QString &filePath){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
|
IntelliImage* active = layerBundle[static_cast<size_t>(activeLayer)].image;
|
||||||
bool open = active->loadImage(filePath);
|
bool open = active->loadImage(filePath);
|
||||||
active->calculateVisiblity();
|
active->calculateVisiblity();
|
||||||
update();
|
update();
|
||||||
return open;
|
return open;
|
||||||
@@ -116,19 +116,19 @@ bool PaintingArea::save(const QString &filePath, const char*fileFormat){
|
|||||||
if(layerBundle.size()==0) {
|
if(layerBundle.size()==0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this->drawLayers(true);
|
this->drawLayers(true);
|
||||||
|
|
||||||
if(!strcmp(fileFormat,"PNG")) {
|
if(!strcmp(fileFormat,"PNG")) {
|
||||||
QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8);
|
QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8);
|
||||||
fileFormat = "png";
|
fileFormat = "png";
|
||||||
if (visibleImage.save(filePath, fileFormat)) {
|
if (visibleImage.save(filePath, fileFormat)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Canvas->save(filePath, fileFormat)) {
|
if (Canvas->save(filePath, fileFormat)) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -146,23 +146,23 @@ void PaintingArea::floodFill(int r, int g, int b, int a){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::movePositionActive(int x, int y){
|
void PaintingArea::movePositionActive(int x, int y){
|
||||||
if(Tool!=nullptr){
|
if(Tool!=nullptr) {
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool->getIsDrawing()) {
|
||||||
IntelliTool* temp = copyActiveTool();
|
IntelliTool* temp = copyActiveTool();
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
this->Tool = temp;
|
this->Tool = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
layerBundle[static_cast<size_t>(activeLayer)].widthOffset += x;
|
||||||
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
layerBundle[static_cast<size_t>(activeLayer)].heightOffset += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::moveActiveLayer(int idx){
|
void PaintingArea::moveActiveLayer(int idx){
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool->getIsDrawing()) {
|
||||||
IntelliTool* temp = copyActiveTool();
|
IntelliTool* temp = copyActiveTool();
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
this->Tool = temp;
|
this->Tool = temp;
|
||||||
}
|
}
|
||||||
if(idx==1) {
|
if(idx==1) {
|
||||||
this->selectLayerUp();
|
this->selectLayerUp();
|
||||||
}else if(idx==-1) {
|
}else if(idx==-1) {
|
||||||
@@ -171,13 +171,13 @@ void PaintingArea::moveActiveLayer(int idx){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::slotActivateLayer(int a){
|
void PaintingArea::slotActivateLayer(int a){
|
||||||
if(Tool != nullptr){
|
if(Tool != nullptr) {
|
||||||
if(Tool->getIsDrawing()){
|
if(Tool->getIsDrawing()) {
|
||||||
IntelliTool* temp = copyActiveTool();
|
IntelliTool* temp = copyActiveTool();
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
this->Tool = temp;
|
this->Tool = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
|
if(a>=0 && a < static_cast<int>(layerBundle.size())) {
|
||||||
this->setLayerActive(a);
|
this->setLayerActive(a);
|
||||||
}
|
}
|
||||||
@@ -199,52 +199,52 @@ void PaintingArea::colorPickerSwapColors(){
|
|||||||
|
|
||||||
void PaintingArea::createPenTool(){
|
void PaintingArea::createPenTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolPen(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::createPlainTool(){
|
void PaintingArea::createPlainTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolPlainTool(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::createLineTool(){
|
void PaintingArea::createLineTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolLine(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::createRectangleTool(){
|
void PaintingArea::createRectangleTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolRectangle(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::createCircleTool(){
|
void PaintingArea::createCircleTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolCircle(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
void PaintingArea::createPolygonTool(){
|
void PaintingArea::createPolygonTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolPolygon(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::createFloodFillTool(){
|
void PaintingArea::createFloodFillTool(){
|
||||||
delete this->Tool;
|
delete this->Tool;
|
||||||
Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings);
|
Tool = new IntelliToolFloodFill(this, &colorPicker, &Toolsettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintingArea::getWidthOfActive(){
|
int PaintingArea::getWidthOfActive(){
|
||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].width;
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].width;
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintingArea::getHeightOfActive(){
|
int PaintingArea::getHeightOfActive(){
|
||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].height;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){
|
IntelliImage::ImageType PaintingArea::getTypeOfImageRealLayer(){
|
||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getTypeOfImage();
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getTypeOfImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
|
std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
|
||||||
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getPolygonData();
|
return this->layerBundle[static_cast<unsigned long long>(activeLayer)].image->getPolygonData();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a mouse button is pressed check if it was the
|
// If a mouse button is pressed check if it was the
|
||||||
@@ -253,8 +253,8 @@ std::vector<QPoint> PaintingArea::getPolygonDataOfRealLayer(){
|
|||||||
void PaintingArea::mousePressEvent(QMouseEvent*event){
|
void PaintingArea::mousePressEvent(QMouseEvent*event){
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
||||||
if(event->button() == Qt::LeftButton) {
|
if(event->button() == Qt::LeftButton) {
|
||||||
Tool->onMouseLeftPressed(x, y);
|
Tool->onMouseLeftPressed(x, y);
|
||||||
}else if(event->button() == Qt::RightButton) {
|
}else if(event->button() == Qt::RightButton) {
|
||||||
@@ -269,8 +269,8 @@ void PaintingArea::mousePressEvent(QMouseEvent*event){
|
|||||||
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
||||||
Tool->onMouseMoved(x, y);
|
Tool->onMouseMoved(x, y);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -279,8 +279,8 @@ void PaintingArea::mouseMoveEvent(QMouseEvent*event){
|
|||||||
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
||||||
if(Tool == nullptr)
|
if(Tool == nullptr)
|
||||||
return;
|
return;
|
||||||
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
int x = event->x()-layerBundle[static_cast<unsigned long long>(activeLayer)].widthOffset;
|
||||||
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
int y = event->y()-layerBundle[static_cast<unsigned long long>(activeLayer)].heightOffset;
|
||||||
if(event->button() == Qt::LeftButton) {
|
if(event->button() == Qt::LeftButton) {
|
||||||
Tool->onMouseLeftReleased(x, y);
|
Tool->onMouseLeftReleased(x, y);
|
||||||
}else if(event->button() == Qt::RightButton) {
|
}else if(event->button() == Qt::RightButton) {
|
||||||
@@ -290,20 +290,20 @@ void PaintingArea::mouseReleaseEvent(QMouseEvent*event){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::wheelEvent(QWheelEvent*event){
|
void PaintingArea::wheelEvent(QWheelEvent*event){
|
||||||
if(this->Tool != nullptr){
|
if(this->Tool != nullptr) {
|
||||||
QPoint numDegrees = event->angleDelta() / 8;
|
QPoint numDegrees = event->angleDelta() / 8;
|
||||||
if(!numDegrees.isNull()) {
|
if(!numDegrees.isNull()) {
|
||||||
QPoint numSteps = numDegrees / 15;
|
QPoint numSteps = numDegrees / 15;
|
||||||
Tool->onWheelScrolled(numSteps.y()* -1);
|
Tool->onWheelScrolled(numSteps.y()* -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// QPainter provides functions to draw on the widget
|
// QPainter provides functions to draw on the widget
|
||||||
// The QPaintEvent is sent to widgets that need to
|
// The QPaintEvent is sent to widgets that need to
|
||||||
// update themselves
|
// update themselves
|
||||||
void PaintingArea::paintEvent(QPaintEvent*event){
|
void PaintingArea::paintEvent(QPaintEvent*event){
|
||||||
this->drawLayers();
|
this->drawLayers();
|
||||||
|
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
QRect dirtyRec = event->rect();
|
QRect dirtyRec = event->rect();
|
||||||
@@ -323,15 +323,15 @@ void PaintingArea::resizeLayer(QImage*image_res, const QSize &newSize){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::selectLayerUp(){
|
void PaintingArea::selectLayerUp(){
|
||||||
if(activeLayer!=-1 && static_cast<unsigned long long>(activeLayer)<layerBundle.size()-1) {
|
if(activeLayer!=-1 && static_cast<unsigned long long>(activeLayer)<layerBundle.size()-1) {
|
||||||
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer+1)]);
|
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer+1)]);
|
||||||
activeLayer++;
|
activeLayer++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintingArea::selectLayerDown(){
|
void PaintingArea::selectLayerDown(){
|
||||||
if(activeLayer!=-1 && activeLayer>0) {
|
if(activeLayer!=-1 && activeLayer>0) {
|
||||||
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer-1)]);
|
std::swap(layerBundle[static_cast<unsigned long long>(activeLayer)], layerBundle[static_cast<unsigned long long>(activeLayer-1)]);
|
||||||
activeLayer--;
|
activeLayer--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,32 +375,32 @@ void PaintingArea::createTempTopLayer(int idx){
|
|||||||
if(idx>=0) {
|
if(idx>=0) {
|
||||||
LayerObject newLayer;
|
LayerObject newLayer;
|
||||||
newLayer.alpha = 255;
|
newLayer.alpha = 255;
|
||||||
newLayer.height = layerBundle[static_cast<unsigned long long>(idx)].height;
|
newLayer.height = layerBundle[static_cast<unsigned long long>(idx)].height;
|
||||||
newLayer.width = layerBundle[static_cast<unsigned long long>(idx)].width;
|
newLayer.width = layerBundle[static_cast<unsigned long long>(idx)].width;
|
||||||
newLayer.heightOffset = layerBundle[static_cast<unsigned long long>(idx)].heightOffset;
|
newLayer.heightOffset = layerBundle[static_cast<unsigned long long>(idx)].heightOffset;
|
||||||
newLayer.widthOffset = layerBundle[static_cast<unsigned long long>(idx)].widthOffset;
|
newLayer.widthOffset = layerBundle[static_cast<unsigned long long>(idx)].widthOffset;
|
||||||
newLayer.image = layerBundle[static_cast<unsigned long long>(idx)].image->getDeepCopy();
|
newLayer.image = layerBundle[static_cast<unsigned long long>(idx)].image->getDeepCopy();
|
||||||
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
|
layerBundle.insert(layerBundle.begin()+idx+1,newLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliTool* PaintingArea::copyActiveTool(){
|
IntelliTool* PaintingArea::copyActiveTool(){
|
||||||
switch(Tool->getTooltype()){
|
switch(Tool->getTooltype()) {
|
||||||
case IntelliTool::Tooltype::CIRCLE: return new IntelliToolCircle(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::CIRCLE: return new IntelliToolCircle(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::FLOODFILL: return new IntelliToolFloodFill(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::FLOODFILL: return new IntelliToolFloodFill(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::LINE: return new IntelliToolLine(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::LINE: return new IntelliToolLine(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::PEN: return new IntelliToolPen(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::PEN: return new IntelliToolPen(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::PLAIN: return new IntelliToolPlainTool(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::PLAIN: return new IntelliToolPlainTool(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::POLYGON: return new IntelliToolPolygon(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::POLYGON: return new IntelliToolPolygon(this,&colorPicker, &Toolsettings);
|
||||||
case IntelliTool::Tooltype::RECTANGLE: return new IntelliToolRectangle(this,&colorPicker, &Toolsettings);
|
case IntelliTool::Tooltype::RECTANGLE: return new IntelliToolRectangle(this,&colorPicker, &Toolsettings);
|
||||||
default: return nullptr;
|
default: return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintingArea::getNumberOfActiveLayer(){
|
int PaintingArea::getNumberOfActiveLayer(){
|
||||||
return activeLayer;
|
return activeLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliImage* PaintingArea::getImageOfActiveLayer(){
|
IntelliImage* PaintingArea::getImageOfActiveLayer(){
|
||||||
return layerBundle[activeLayer].image;
|
return layerBundle[activeLayer].image;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
|
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
|
||||||
this->Area=Area;
|
this->Area=Area;
|
||||||
this->colorPicker=colorPicker;
|
this->colorPicker=colorPicker;
|
||||||
this->Toolsettings=Toolsettings;
|
this->Toolsettings=Toolsettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -50,8 +50,8 @@ void IntelliTool::onWheelScrolled(int value){
|
|||||||
|
|
||||||
void IntelliTool::createToolLayer(){
|
void IntelliTool::createToolLayer(){
|
||||||
Area->createTempTopLayer(Area->activeLayer);
|
Area->createTempTopLayer(Area->activeLayer);
|
||||||
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
this->activeLayer=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
||||||
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::mergeToolLayer(){
|
void IntelliTool::mergeToolLayer(){
|
||||||
@@ -74,7 +74,7 @@ void IntelliTool::mergeToolLayer(){
|
|||||||
activeLayer->image->imageData.setPixelColor(x, y, clr_0);
|
activeLayer->image->imageData.setPixelColor(x, y, clr_0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Area->DumpyGui->UpdateGui();
|
Area->DumpyGui->UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliTool::deleteToolLayer(){
|
void IntelliTool::deleteToolLayer(){
|
||||||
@@ -83,9 +83,9 @@ void IntelliTool::deleteToolLayer(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
IntelliTool::Tooltype IntelliTool::getTooltype(){
|
IntelliTool::Tooltype IntelliTool::getTooltype(){
|
||||||
return ActiveType;
|
return ActiveType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntelliTool::getIsDrawing(){
|
bool IntelliTool::getIsDrawing(){
|
||||||
return isDrawing;
|
return isDrawing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ class PaintingArea;
|
|||||||
*/
|
*/
|
||||||
class IntelliTool {
|
class IntelliTool {
|
||||||
public:
|
public:
|
||||||
enum class Tooltype{
|
enum class Tooltype {
|
||||||
CIRCLE,
|
CIRCLE,
|
||||||
FLOODFILL,
|
FLOODFILL,
|
||||||
LINE,
|
LINE,
|
||||||
PEN,
|
PEN,
|
||||||
PLAIN,
|
PLAIN,
|
||||||
POLYGON,
|
POLYGON,
|
||||||
RECTANGLE
|
RECTANGLE
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
/*!
|
/*!
|
||||||
* \brief A function that creates a layer to draw on.
|
* \brief A function that creates a layer to draw on.
|
||||||
|
|||||||
@@ -4,46 +4,46 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolCircle::IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::CIRCLE;
|
this->ActiveType = Tooltype::CIRCLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolCircle::~IntelliToolCircle(){
|
IntelliToolCircle::~IntelliToolCircle(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolCircle::drawCircle(int radius){
|
void IntelliToolCircle::drawCircle(int radius){
|
||||||
int outer = radius+20;
|
int outer = radius+20;
|
||||||
QColor inner = this->colorPicker->getSecondColor();
|
QColor inner = this->colorPicker->getSecondColor();
|
||||||
inner.setAlpha(Toolsettings->getInnerAlpha());
|
inner.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
int yMin, yMax, xMin, xMax;
|
int yMin, yMax, xMin, xMax;
|
||||||
yMin = centerPoint.y()-radius;
|
yMin = centerPoint.y()-radius;
|
||||||
yMax = centerPoint.y()+radius;
|
yMax = centerPoint.y()+radius;
|
||||||
// x = x0+-sqrt(r2-(y-y0)2)
|
// x = x0+-sqrt(r2-(y-y0)2)
|
||||||
for(int i=yMin; i<=yMax; i++) {
|
for(int i=yMin; i<=yMax; i++) {
|
||||||
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1);
|
this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement circle drawing algorithm bresenham
|
//TODO implement circle drawing algorithm bresenham
|
||||||
radius = static_cast<int>(radius +(Toolsettings->getLineWidth()/2.)-1.);
|
radius = static_cast<int>(radius +(Toolsettings->getLineWidth()/2.)-1.);
|
||||||
yMin = (centerPoint.y()-radius);
|
yMin = (centerPoint.y()-radius);
|
||||||
yMax = (centerPoint.y()+radius);
|
yMax = (centerPoint.y()+radius);
|
||||||
for(int i=yMin; i<=yMax; i++) {
|
for(int i=yMin; i<=yMax; i++) {
|
||||||
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMin = static_cast<int>(centerPoint.x()-sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
xMax = static_cast<int>(centerPoint.x()+sqrt(pow(radius,2)-pow(i-centerPoint.y(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
xMin = (centerPoint.x()-radius);
|
xMin = (centerPoint.x()-radius);
|
||||||
xMax = (centerPoint.x()+radius);
|
xMax = (centerPoint.x()+radius);
|
||||||
for(int i=xMin; i<=xMax; i++) {
|
for(int i=xMin; i<=xMax; i++) {
|
||||||
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
int yMin = static_cast<int>(centerPoint.y()-sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
||||||
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
int yMax = static_cast<int>(centerPoint.y()+sqrt(pow(radius,2)-pow(i-centerPoint.x(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ void IntelliToolCircle::onMouseLeftReleased(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolCircle::onWheelScrolled(int value){
|
void IntelliToolCircle::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolCircle::onMouseMoved(int x, int y){
|
void IntelliToolCircle::onMouseMoved(int x, int y){
|
||||||
|
|||||||
@@ -6,12 +6,12 @@
|
|||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolFloodFill::IntelliToolFloodFill(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::FLOODFILL;
|
this->ActiveType = Tooltype::FLOODFILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolFloodFill::~IntelliToolFloodFill(){
|
IntelliToolFloodFill::~IntelliToolFloodFill(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolFloodFill::onMouseRightPressed(int x, int y){
|
void IntelliToolFloodFill::onMouseRightPressed(int x, int y){
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
#include "QInputDialog"
|
#include "QInputDialog"
|
||||||
|
|
||||||
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolLine::IntelliToolLine(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::LINE;
|
this->ActiveType = Tooltype::LINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolLine::~IntelliToolLine(){
|
IntelliToolLine::~IntelliToolLine(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolLine::onMouseRightPressed(int x, int y){
|
void IntelliToolLine::onMouseRightPressed(int x, int y){
|
||||||
@@ -23,7 +23,7 @@ void IntelliToolLine::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolLine::onMouseLeftPressed(int x, int y){
|
void IntelliToolLine::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
this->lineStartingPoint=QPoint(x,y);
|
this->lineStartingPoint=QPoint(x,y);
|
||||||
this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(lineStartingPoint, colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,21 +33,21 @@ void IntelliToolLine::onMouseLeftReleased(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolLine::onWheelScrolled(int value){
|
void IntelliToolLine::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolLine::onMouseMoved(int x, int y){
|
void IntelliToolLine::onMouseMoved(int x, int y){
|
||||||
if(this->isDrawing) {
|
if(this->isDrawing) {
|
||||||
this->Canvas->image->drawPlain(Qt::transparent);
|
this->Canvas->image->drawPlain(Qt::transparent);
|
||||||
QPoint next(x,y);
|
QPoint next(x,y);
|
||||||
switch(Toolsettings->getLinestyle()) {
|
switch(Toolsettings->getLinestyle()) {
|
||||||
case IntelliToolsettings::LineStyle::SOLID_LINE:
|
case IntelliToolsettings::LineStyle::SOLID_LINE:
|
||||||
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(lineStartingPoint,next,colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
break;
|
break;
|
||||||
case IntelliToolsettings::LineStyle::DOTTED_LINE:
|
case IntelliToolsettings::LineStyle::DOTTED_LINE:
|
||||||
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
|
QPoint p1 =lineStartingPoint.x() <= next.x() ? lineStartingPoint : next;
|
||||||
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
|
QPoint p2 =lineStartingPoint.x() < next.x() ? next : lineStartingPoint;
|
||||||
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
|
int m = static_cast<int>(static_cast<float>(p2.y()-p1.y())/static_cast<float>(p2.x()-p1.x())+0.5f);
|
||||||
int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
|
int c = lineStartingPoint.y()-lineStartingPoint.x()*m;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,12 +5,12 @@
|
|||||||
#include "QInputDialog"
|
#include "QInputDialog"
|
||||||
|
|
||||||
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolPen::IntelliToolPen(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::PEN;
|
this->ActiveType = Tooltype::PEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolPen::~IntelliToolPen(){
|
IntelliToolPen::~IntelliToolPen(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPen::onMouseRightPressed(int x, int y){
|
void IntelliToolPen::onMouseRightPressed(int x, int y){
|
||||||
@@ -24,7 +24,7 @@ void IntelliToolPen::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
this->previousPoint=QPoint(x,y);
|
this->previousPoint=QPoint(x,y);
|
||||||
this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(previousPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
Canvas->image->calculateVisiblity();
|
Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
|||||||
void IntelliToolPen::onMouseMoved(int x, int y){
|
void IntelliToolPen::onMouseMoved(int x, int y){
|
||||||
if(this->isDrawing) {
|
if(this->isDrawing) {
|
||||||
QPoint newPoint(x,y);
|
QPoint newPoint(x,y);
|
||||||
this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(this->previousPoint, newPoint, colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->previousPoint=newPoint;
|
this->previousPoint=newPoint;
|
||||||
}
|
}
|
||||||
IntelliTool::onMouseMoved(x,y);
|
IntelliTool::onMouseMoved(x,y);
|
||||||
@@ -43,5 +43,5 @@ void IntelliToolPen::onMouseMoved(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolPen::onWheelScrolled(int value){
|
void IntelliToolPen::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
#include "QColorDialog"
|
#include "QColorDialog"
|
||||||
|
|
||||||
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolPlainTool::IntelliToolPlainTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::PLAIN;
|
this->ActiveType = Tooltype::PLAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolPlainTool::~IntelliToolPlainTool(){
|
IntelliToolPlainTool::~IntelliToolPlainTool(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
|
void IntelliToolPlainTool::onMouseLeftPressed(int x, int y){
|
||||||
|
|||||||
@@ -5,63 +5,63 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
isInside = false;
|
isInside = false;
|
||||||
this->ActiveType = Tooltype::POLYGON;
|
this->ActiveType = Tooltype::POLYGON;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolPolygon::~IntelliToolPolygon(){
|
IntelliToolPolygon::~IntelliToolPolygon(){
|
||||||
if(isDrawing){
|
if(isDrawing) {
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
void IntelliToolPolygon::onMouseLeftPressed(int x, int y){
|
||||||
if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()){
|
if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::SHAPEDIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(Area->getPolygonDataOfRealLayer());
|
||||||
QPoint Point(x,y);
|
QPoint Point(x,y);
|
||||||
isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
|
isInside = IntelliTriangulation::isInPolygon(Triangles,Point);
|
||||||
}
|
}
|
||||||
else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()){
|
else if(!isDrawing && Area->getTypeOfImageRealLayer() == IntelliImage::ImageType::RASTERIMAGE && x > 0 && y > 0 && x<Area->getWidthOfActive() && y<Area->getHeightOfActive()) {
|
||||||
isInside = true;
|
isInside = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isInside && !isDrawing) {
|
if(isInside && !isDrawing) {
|
||||||
IntelliTool::onMouseLeftPressed(x,y);
|
IntelliTool::onMouseLeftPressed(x,y);
|
||||||
QPoint drawingPoint = QPoint(x,y);
|
QPoint drawingPoint = QPoint(x,y);
|
||||||
|
|
||||||
isDrawing = true;
|
isDrawing = true;
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
|
|
||||||
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPointList.back(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
|
else if(isDrawing && isNearStart(x,y,QPointList.front())) {
|
||||||
if(QPointList.size() > 2){
|
if(QPointList.size() > 2) {
|
||||||
isPointNearStart = true;
|
isPointNearStart = true;
|
||||||
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList.back(), QPointList.front(), colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
IntelliTool::onMouseRightPressed(x,y);
|
IntelliTool::onMouseRightPressed(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(isDrawing) {
|
else if(isDrawing) {
|
||||||
QPoint drawingPoint(x,y);
|
QPoint drawingPoint(x,y);
|
||||||
QPointList.push_back(drawingPoint);
|
QPointList.push_back(drawingPoint);
|
||||||
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList[QPointList.size() - 2], QPointList[QPointList.size() - 1], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->calculateVisiblity();
|
this->Canvas->image->calculateVisiblity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseRightPressed(int x, int y){
|
void IntelliToolPolygon::onMouseRightPressed(int x, int y){
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
@@ -69,14 +69,14 @@ void IntelliToolPolygon::onMouseRightPressed(int x, int y){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
||||||
if(isPointNearStart) {
|
if(isPointNearStart) {
|
||||||
isInside = false;
|
isInside = false;
|
||||||
isPointNearStart = false;
|
isPointNearStart = false;
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
std::vector<Triangle> Triangles = IntelliTriangulation::calculateTriangles(QPointList);
|
||||||
QPoint Point;
|
QPoint Point;
|
||||||
QColor colorTwo(colorPicker->getSecondColor());
|
QColor colorTwo(colorPicker->getSecondColor());
|
||||||
colorTwo.setAlpha(Toolsettings->getInnerAlpha());
|
colorTwo.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
for(int i = 0; i < activeLayer->width; i++) {
|
for(int i = 0; i < activeLayer->width; i++) {
|
||||||
for(int j = 0; j < activeLayer->height; j++) {
|
for(int j = 0; j < activeLayer->height; j++) {
|
||||||
Point = QPoint(i,j);
|
Point = QPoint(i,j);
|
||||||
@@ -85,9 +85,9 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
|
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
|
||||||
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
|
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
|
||||||
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
QPointList.clear();
|
QPointList.clear();
|
||||||
IntelliTool::onMouseLeftReleased(x,y);
|
IntelliTool::onMouseLeftReleased(x,y);
|
||||||
@@ -101,7 +101,7 @@ void IntelliToolPolygon::onMouseRightReleased(int x, int y){
|
|||||||
void IntelliToolPolygon::onWheelScrolled(int value){
|
void IntelliToolPolygon::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
if(!isDrawing) {
|
if(!isDrawing) {
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth() + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ bool IntelliToolPolygon::isNearStart(int x, int y, QPoint Startpoint){
|
|||||||
bool isNear = false;
|
bool isNear = false;
|
||||||
int StartX = Startpoint.x();
|
int StartX = Startpoint.x();
|
||||||
int StartY = Startpoint.y();
|
int StartY = Startpoint.y();
|
||||||
int valueToNear = 5;
|
int valueToNear = 5;
|
||||||
|
|
||||||
for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) {
|
for(int i = StartX - valueToNear; i < StartX + valueToNear; i++) {
|
||||||
for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) {
|
for(int j = StartY - valueToNear; j < StartY + valueToNear; j++) {
|
||||||
|
|||||||
@@ -3,30 +3,30 @@
|
|||||||
#include "QInputDialog"
|
#include "QInputDialog"
|
||||||
|
|
||||||
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
IntelliToolRectangle::IntelliToolRectangle(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||||
this->ActiveType = Tooltype::RECTANGLE;
|
this->ActiveType = Tooltype::RECTANGLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliToolRectangle::~IntelliToolRectangle(){
|
IntelliToolRectangle::~IntelliToolRectangle(){
|
||||||
IntelliTool::onMouseRightPressed(0,0);
|
IntelliTool::onMouseRightPressed(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolRectangle::drawRectangle(QPoint otherCorner){
|
void IntelliToolRectangle::drawRectangle(QPoint otherCorner){
|
||||||
int xMin = std::min(originCorner.x(), otherCorner.x());
|
int xMin = std::min(originCorner.x(), otherCorner.x());
|
||||||
int xMax = std::max(originCorner.x(), otherCorner.x());
|
int xMax = std::max(originCorner.x(), otherCorner.x());
|
||||||
|
|
||||||
int yMin = std::min(originCorner.y(), otherCorner.y());
|
int yMin = std::min(originCorner.y(), otherCorner.y());
|
||||||
int yMax = std::max(originCorner.y(), otherCorner.y());
|
int yMax = std::max(originCorner.y(), otherCorner.y());
|
||||||
|
|
||||||
QColor clr = colorPicker->getSecondColor();
|
QColor clr = colorPicker->getSecondColor();
|
||||||
clr.setAlpha(Toolsettings->getInnerAlpha());
|
clr.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
for(int y=yMin; y<=yMax; y++) {
|
for(int y=yMin; y<=yMax; y++) {
|
||||||
this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1);
|
this->Canvas->image->drawLine(QPoint(xMin,y), QPoint(xMax, y), clr, 1);
|
||||||
}
|
}
|
||||||
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPoint(xMin, yMin),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMin, yMax), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
this->Canvas->image->drawLine(QPoint(xMax, yMax),QPoint(xMax, yMin), this->colorPicker->getFirstColor(), Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
|
void IntelliToolRectangle::onMouseRightPressed(int x, int y){
|
||||||
@@ -59,5 +59,5 @@ void IntelliToolRectangle::onMouseMoved(int x, int y){
|
|||||||
|
|
||||||
void IntelliToolRectangle::onWheelScrolled(int value){
|
void IntelliToolRectangle::onWheelScrolled(int value){
|
||||||
IntelliTool::onWheelScrolled(value);
|
IntelliTool::onWheelScrolled(value);
|
||||||
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
Toolsettings->setLineWidth(Toolsettings->getLineWidth()+value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user