mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 12:20:32 +02:00
Automated Release Preparation
This commit is contained in:
@@ -16,7 +16,7 @@ class IntelliInputDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/*!
|
||||
/*!
|
||||
* \brief IntelliInputDialog is the baisc constructor to for the InputDialog
|
||||
* \param Title - Title of the Input Dialog.
|
||||
* \param Label - A Label for the Iput Dialog, to show further information.
|
||||
|
||||
@@ -105,7 +105,7 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
|
||||
paintingArea->historyadd();
|
||||
paintingArea->historyadd();
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
|
||||
paintingArea->historyadd();
|
||||
paintingArea->historyadd();
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ void IntelliPhotoGui::slotDeleteLayer(){
|
||||
// Create New Layer
|
||||
if(ok1) {
|
||||
paintingArea->deleteLayer(layerNumber - 1);
|
||||
paintingArea->historyadd();
|
||||
paintingArea->historyadd();
|
||||
UpdateGui();
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ void IntelliPhotoGui::slotEnterPressed(){
|
||||
void IntelliPhotoGui::slotResetToolButtons(){
|
||||
CircleButton->setChecked(false);
|
||||
FloodFillButton->setChecked(false);
|
||||
GradientButton->setChecked(false);
|
||||
GradientButton->setChecked(false);
|
||||
LineButton->setChecked(false);
|
||||
PenButton->setChecked(false);
|
||||
PlainButton->setChecked(false);
|
||||
@@ -389,8 +389,8 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSaveAs.append(action);
|
||||
}
|
||||
|
||||
// Set exporter to actions
|
||||
QAction*pngSaveAction = new QAction("PNG-8...", this);
|
||||
// Set exporter to actions
|
||||
QAction*pngSaveAction = new QAction("PNG-8...", this);
|
||||
pngSaveAction->setData("PNG");
|
||||
// When clicked call IntelliPhotoGui::save()
|
||||
connect(pngSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||
@@ -419,7 +419,7 @@ void IntelliPhotoGui::createActions(){
|
||||
connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer()));
|
||||
|
||||
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
||||
actionDeleteLayer = new QAction(tr("&Delete Layer"), this);
|
||||
actionDeleteLayer = new QAction(tr("&Delete Layer"), this);
|
||||
actionDeleteLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_D));
|
||||
connect(actionDeleteLayer, SIGNAL(triggered()), this, SLOT(slotDeleteLayer()));
|
||||
|
||||
@@ -428,52 +428,52 @@ void IntelliPhotoGui::createActions(){
|
||||
connect(actionChangeDim, SIGNAL(triggered()), this, SLOT(slotChangeDim()));
|
||||
connect(dimCanvas, SIGNAL(clicked()), this, SLOT(slotChangeDim()));
|
||||
|
||||
actionSetActiveLayer = new QAction(tr("&Set Active"), this);
|
||||
actionSetActiveLayer = new QAction(tr("&Set Active"), this);
|
||||
actionSetActiveLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
|
||||
connect(actionSetActiveLayer, SIGNAL(triggered()), this, SLOT(slotSetActiveLayer()));
|
||||
|
||||
actionSetActiveAlpha = new QAction(tr("&Set Alpha"), this);
|
||||
actionSetActiveAlpha = new QAction(tr("&Set Alpha"), this);
|
||||
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
||||
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
||||
|
||||
actionSetPolygon = new QAction(tr("&Set Polygon Data"), this);
|
||||
actionSetPolygon = new QAction(tr("&Set Polygon Data"), this);
|
||||
actionSetPolygon->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_P));
|
||||
connect(actionSetPolygon, SIGNAL(triggered()), this, SLOT(slotSetPolygon()));
|
||||
|
||||
actionMovePositionUp = new QAction(tr("&Move Up"), this);
|
||||
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 = 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 = 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 = 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 Forth"), this);
|
||||
actionMoveLayerUp = new QAction(tr("&Move Forth"), this);
|
||||
actionMoveLayerUp->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Up));
|
||||
connect(actionMoveLayerUp, SIGNAL(triggered()), this, SLOT(slotMoveLayerUp()));
|
||||
|
||||
actionMoveLayerDown = new QAction(tr("&Move Back"), this);
|
||||
actionMoveLayerDown = new QAction(tr("&Move Back"), this);
|
||||
actionMoveLayerDown->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_Down));
|
||||
connect(actionMoveLayerDown, SIGNAL(triggered()), this, SLOT(slotMoveLayerDown()));
|
||||
|
||||
// Create Update RenderSettings Actions here
|
||||
actionUpdateFastRenderSettingsOn = new QAction(tr("&On"), this);
|
||||
actionUpdateFastRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A));
|
||||
connect(actionUpdateFastRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOn()));
|
||||
// Create Update RenderSettings Actions here
|
||||
actionUpdateFastRenderSettingsOn = new QAction(tr("&On"), this);
|
||||
actionUpdateFastRenderSettingsOn->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_A));
|
||||
connect(actionUpdateFastRenderSettingsOn, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOn()));
|
||||
|
||||
actionUpdateFastRenderSettingsOff = new QAction(tr("&Off"), this);
|
||||
actionUpdateFastRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D));
|
||||
connect(actionUpdateFastRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOff()));
|
||||
actionUpdateFastRenderSettingsOff = new QAction(tr("&Off"), this);
|
||||
actionUpdateFastRenderSettingsOff->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + +Qt::Key_D));
|
||||
connect(actionUpdateFastRenderSettingsOff, SIGNAL(triggered()),this, SLOT(slotUpdateFastRenderSettingsOff()));
|
||||
|
||||
// Create Color Actions here
|
||||
// Create Color Actions here
|
||||
actionColorPickerFirstColor = new QAction(tr("&Main"), this);
|
||||
actionColorPickerFirstColor->setShortcut(QKeySequence(Qt::ALT + Qt::Key_N));
|
||||
connect(actionColorPickerFirstColor, SIGNAL(triggered()), this, SLOT(slotSetFirstColor()));
|
||||
@@ -489,81 +489,81 @@ void IntelliPhotoGui::createActions(){
|
||||
connect(actionColorSwap, SIGNAL(triggered()), 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->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_P));
|
||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePlainTool, SIGNAL(triggered()), this, SLOT(slotCreatePlainTool()));
|
||||
|
||||
|
||||
actionCreatePenTool = new QAction(tr("&Pen"),this);
|
||||
actionCreatePenTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_S));
|
||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePenTool, SIGNAL(triggered()), this, SLOT(slotCreatePenTool()));
|
||||
|
||||
actionCreateLineTool = new QAction(tr("&Line"), this);
|
||||
actionCreateLineTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_L));
|
||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateLineTool, SIGNAL(triggered()), this, SLOT(slotCreateLineTool()));
|
||||
|
||||
actionCreateCircleTool = new QAction(tr("&Circle"), this);
|
||||
actionCreateCircleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_C));
|
||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateCircleTool, SIGNAL(triggered()), this, SLOT(slotCreateCircleTool()));
|
||||
|
||||
actionCreateRectangleTool = new QAction(tr("&Rectangle"), this);
|
||||
actionCreateRectangleTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_R));
|
||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateRectangleTool, SIGNAL(triggered()), this, SLOT(slotCreateRectangleTool()));
|
||||
|
||||
actionCreatePolygonTool = new QAction(tr("&Polygon"), this);
|
||||
actionCreatePolygonTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_V));
|
||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreatePolygonTool, SIGNAL(triggered()), this, SLOT(slotCreatePolygonTool()));
|
||||
|
||||
actionCreateFloodFillTool = new QAction(tr("&FloodFill"), this);
|
||||
actionCreateFloodFillTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_F));
|
||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateFloodFillTool, SIGNAL(triggered()), this, SLOT(slotCreateFloodFillTool()));
|
||||
|
||||
actionCreateGradientTool = new QAction(tr("&Gradient"),this);
|
||||
actionCreateGradientTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_G));
|
||||
connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
actionCreateGradientTool->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::SHIFT + Qt::Key_G));
|
||||
connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotResetToolButtons()));
|
||||
connect(actionCreateGradientTool, SIGNAL(triggered()), this, SLOT(slotCreateGradientTool()));
|
||||
|
||||
// Create about action and tie to IntelliPhotoGui::about()
|
||||
actionAboutDialog = new QAction(tr("&About"), this);
|
||||
actionAboutDialog = new QAction(tr("&About"), this);
|
||||
connect(actionAboutDialog, SIGNAL(triggered()), this, SLOT(slotAboutDialog()));
|
||||
|
||||
// Create about Qt action and tie to IntelliPhotoGui::aboutQt()
|
||||
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
||||
actionAboutQtDialog = new QAction(tr("About &Qt"), this);
|
||||
connect(actionAboutQtDialog, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
|
||||
connect(EditLineWidth, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
||||
connect(EditLineInnerAlpha, SIGNAL(returnPressed()), this, SLOT(slotEnterPressed()));
|
||||
|
||||
connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(CircleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(CircleButton, SIGNAL(clicked()), this, SLOT(slotCreateCircleTool()));
|
||||
|
||||
connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(FloodFillButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(FloodFillButton, SIGNAL(clicked()), this, SLOT(slotCreateFloodFillTool()));
|
||||
|
||||
connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(GradientButton, SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(GradientButton, SIGNAL(clicked()), this, SLOT(slotCreateGradientTool()));
|
||||
|
||||
connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(LineButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(LineButton, SIGNAL(clicked()), this, SLOT(slotCreateLineTool()));
|
||||
|
||||
connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PenButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PenButton, SIGNAL(clicked()), this, SLOT(slotCreatePenTool()));
|
||||
|
||||
connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PlainButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PlainButton, SIGNAL(clicked()), this, SLOT(slotCreatePlainTool()));
|
||||
|
||||
connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PolygonButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(PolygonButton, SIGNAL(clicked()), this, SLOT(slotCreatePolygonTool()));
|
||||
|
||||
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(RectangleButton,SIGNAL(pressed()), this, SLOT(slotResetToolButtons()));
|
||||
connect(RectangleButton, SIGNAL(clicked()), this, SLOT(slotCreateRectangleTool()));
|
||||
|
||||
actionSetWidth = new QAction(tr("&Set Width"),this);
|
||||
@@ -574,11 +574,11 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSetInnerAlpha->setShortcut(QKeySequence(Qt::ALT + Qt::Key_A));
|
||||
connect(actionSetInnerAlpha, SIGNAL(triggered()), this, SLOT(slotSetInnerAlpha()));
|
||||
|
||||
actionGoBack = new QAction(tr("&Undo"),this);
|
||||
actionGoBack = new QAction(tr("&Undo"),this);
|
||||
actionGoBack->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||
connect(actionGoBack, SIGNAL(triggered()), this, SLOT(slotGoBack()));
|
||||
|
||||
actionGoForward = new QAction(tr("&Redo"),this);
|
||||
actionGoForward = new QAction(tr("&Redo"),this);
|
||||
actionGoForward->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Y));
|
||||
connect(actionGoForward, SIGNAL(triggered()), this, SLOT(slotGoForward()));
|
||||
}
|
||||
@@ -586,31 +586,31 @@ void IntelliPhotoGui::createActions(){
|
||||
// Create the menubar
|
||||
void IntelliPhotoGui::createMenus(){
|
||||
// Create Save As option and the list of file types
|
||||
saveAsMenu = new QMenu(tr("&Export As"), this);
|
||||
saveAsMenu = new QMenu(tr("&Export As"), this);
|
||||
foreach (QAction * action, actionSaveAs)
|
||||
saveAsMenu->addAction(action);
|
||||
|
||||
// Attach all actions to file menu
|
||||
// Attach all actions to file menu
|
||||
fileMenu = new QMenu(tr("&File"), this);
|
||||
fileMenu->addAction(actionOpen);
|
||||
fileMenu->addMenu(saveAsMenu);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(actionExit);
|
||||
|
||||
// Attach the save project option to file menu
|
||||
QAction*projectSaveAction = new QAction("Save Project", this);
|
||||
projectSaveAction->setData("idf");
|
||||
connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||
projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
fileMenu->addAction(projectSaveAction);
|
||||
// Attach the save project option to file menu
|
||||
QAction*projectSaveAction = new QAction("Save Project", this);
|
||||
projectSaveAction->setData("idf");
|
||||
connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||
projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||
fileMenu->addAction(projectSaveAction);
|
||||
|
||||
// Attach all actions to Render Settings
|
||||
// Attach all actions to Render Settings
|
||||
renderMenu = new QMenu(tr("&Fast Renderer"), this);
|
||||
renderMenu->addAction(actionUpdateFastRenderSettingsOn);
|
||||
renderMenu->addAction(actionUpdateFastRenderSettingsOff);
|
||||
renderMenu->addAction(actionUpdateFastRenderSettingsOn);
|
||||
renderMenu->addAction(actionUpdateFastRenderSettingsOff);
|
||||
|
||||
// Attach all Layer Creations to Menu
|
||||
layerCreationMenu = new QMenu(tr("&Create Layer"), this);
|
||||
// Attach all Layer Creations to Menu
|
||||
layerCreationMenu = new QMenu(tr("&Create Layer"), this);
|
||||
layerCreationMenu->addAction(actionCreateNewRasterLayer);
|
||||
layerCreationMenu->addAction(actionCreateNewShapedLayer);
|
||||
|
||||
@@ -622,7 +622,7 @@ void IntelliPhotoGui::createMenus(){
|
||||
layerMenu->addAction(actionSetActiveLayer);
|
||||
layerMenu->addAction(actionSetPolygon);
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionMovePositionUp);
|
||||
layerMenu->addAction(actionMovePositionUp);
|
||||
layerMenu->addAction(actionMovePositionDown);
|
||||
layerMenu->addAction(actionMovePositionLeft);
|
||||
layerMenu->addAction(actionMovePositionRight);
|
||||
@@ -631,14 +631,14 @@ void IntelliPhotoGui::createMenus(){
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionDeleteLayer);
|
||||
|
||||
// Attach all Color Options
|
||||
// Attach all Color Options
|
||||
colorMenu = new QMenu(tr("&Color"), this);
|
||||
colorMenu->addAction(actionColorPickerFirstColor);
|
||||
colorMenu->addAction(actionColorPickerSecondColor);
|
||||
colorMenu->addAction(actionColorSwap);
|
||||
|
||||
// Attach all Tool Creation Actions
|
||||
toolCreationMenu = new QMenu(tr("&Tool Selection"), this);
|
||||
// Attach all Tool Creation Actions
|
||||
toolCreationMenu = new QMenu(tr("&Tool Selection"), this);
|
||||
toolCreationMenu->addAction(actionCreateCircleTool);
|
||||
toolCreationMenu->addAction(actionCreateFloodFillTool);
|
||||
toolCreationMenu->addAction(actionCreateGradientTool);
|
||||
@@ -648,20 +648,20 @@ void IntelliPhotoGui::createMenus(){
|
||||
toolCreationMenu->addAction(actionCreatePolygonTool);
|
||||
toolCreationMenu->addAction(actionCreateRectangleTool);
|
||||
|
||||
// Attach all Tool Setting Actions
|
||||
toolSettingsMenu = new QMenu(tr("&Tool Settings"), this);
|
||||
// Attach all Tool Setting Actions
|
||||
toolSettingsMenu = new QMenu(tr("&Tool Settings"), this);
|
||||
toolSettingsMenu->addAction(actionSetWidth);
|
||||
toolSettingsMenu->addAction(actionSetInnerAlpha);
|
||||
|
||||
// Attach all Tool Options
|
||||
// Attach all Tool Options
|
||||
toolMenu = new QMenu(tr("&Tools"), this);
|
||||
toolMenu->addMenu(toolCreationMenu);
|
||||
toolMenu->addMenu(toolSettingsMenu);
|
||||
toolMenu->addMenu(toolSettingsMenu);
|
||||
|
||||
// Attach all actions to Options
|
||||
optionMenu = new QMenu(tr("&Options"), this);
|
||||
optionMenu->addAction(actionGoBack);
|
||||
optionMenu->addAction(actionGoForward);
|
||||
optionMenu->addAction(actionGoForward);
|
||||
optionMenu->addSeparator();
|
||||
optionMenu->addMenu(renderMenu);
|
||||
optionMenu->addAction(actionChangeDim);
|
||||
@@ -674,9 +674,9 @@ void IntelliPhotoGui::createMenus(){
|
||||
// Add menu items to the menubar
|
||||
menuBar()->addMenu(fileMenu);
|
||||
menuBar()->addMenu(optionMenu);
|
||||
menuBar()->addMenu(layerMenu);
|
||||
menuBar()->addMenu(toolMenu);
|
||||
menuBar()->addMenu(colorMenu);
|
||||
menuBar()->addMenu(layerMenu);
|
||||
menuBar()->addMenu(toolMenu);
|
||||
menuBar()->addMenu(colorMenu);
|
||||
menuBar()->addMenu(helpMenu);
|
||||
}
|
||||
|
||||
@@ -694,10 +694,10 @@ void IntelliPhotoGui::createGui(){
|
||||
paintingArea = new PaintingArea(1280, 720);
|
||||
paintingArea->guiReference = this;
|
||||
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
QRect screenGeometry = screen->geometry();
|
||||
Buttonsize.setWidth(screenGeometry.width()/20);
|
||||
Buttonsize.setHeight(screenGeometry.height()/20);
|
||||
QScreen*screen = QGuiApplication::primaryScreen();
|
||||
QRect screenGeometry = screen->geometry();
|
||||
Buttonsize.setWidth(screenGeometry.width() / 20);
|
||||
Buttonsize.setHeight(screenGeometry.height() / 20);
|
||||
|
||||
preview = QPixmap(":/Icons/Buttons/icons/circle-tool.svg");
|
||||
CircleButton = new QPushButton();
|
||||
@@ -713,12 +713,12 @@ void IntelliPhotoGui::createGui(){
|
||||
FloodFillButton->setIconSize(Buttonsize);
|
||||
FloodFillButton->setCheckable(true);
|
||||
|
||||
preview = QPixmap(":/Icons/Buttons/icons/gradient-tool.svg");
|
||||
GradientButton = new QPushButton();
|
||||
GradientButton->setFixedSize(Buttonsize);
|
||||
GradientButton->setIcon(preview);
|
||||
GradientButton->setIconSize(Buttonsize);
|
||||
GradientButton->setCheckable(true);
|
||||
preview = QPixmap(":/Icons/Buttons/icons/gradient-tool.svg");
|
||||
GradientButton = new QPushButton();
|
||||
GradientButton->setFixedSize(Buttonsize);
|
||||
GradientButton->setIcon(preview);
|
||||
GradientButton->setIconSize(Buttonsize);
|
||||
GradientButton->setCheckable(true);
|
||||
|
||||
preview = QPixmap(":/Icons/Buttons/icons/line-tool.svg");
|
||||
LineButton = new QPushButton();
|
||||
@@ -791,10 +791,10 @@ void IntelliPhotoGui::createGui(){
|
||||
SwitchColorButton->setIcon(preview);
|
||||
SwitchColorButton->setIconSize(QSize(Buttonsize.width() * 2,Buttonsize.height()));
|
||||
|
||||
ActiveLayerLabel = new QLabel();
|
||||
ActiveLayerLabel = new QLabel();
|
||||
QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1);
|
||||
ActiveLayerLabel->setText(string);
|
||||
ActiveLayerLabel->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3);
|
||||
ActiveLayerLabel->setText(string);
|
||||
ActiveLayerLabel->setFixedSize(Buttonsize.width() * 2 + 10,(Buttonsize.height() * 2) / 3);
|
||||
|
||||
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
||||
if(activePicture) {
|
||||
@@ -845,7 +845,7 @@ void IntelliPhotoGui::createGui(){
|
||||
mainLayout->addWidget(FirstColorButton,9,2,1,1);
|
||||
mainLayout->addWidget(SecondColorButton,9,3,1,1);
|
||||
mainLayout->addWidget(SwitchColorButton,10,2,1,2);
|
||||
mainLayout->addWidget(ActiveLayerLabel,11,2,1,2);
|
||||
mainLayout->addWidget(ActiveLayerLabel,11,2,1,2);
|
||||
mainLayout->addWidget(ActiveLayerImageLabel,12,2,1,2);
|
||||
mainLayout->addWidget(dimActive,13,2,1,2);
|
||||
mainLayout->addWidget(dimCanvas,14,2,1,2);
|
||||
@@ -931,7 +931,7 @@ void IntelliPhotoGui::setToolWidth(int value){
|
||||
|
||||
void IntelliPhotoGui::UpdateGui(){
|
||||
QString string = QString("Active Layer: %1").arg(paintingArea->getIndexOfActiveLayer() + 1);
|
||||
ActiveLayerLabel->setText(string);
|
||||
ActiveLayerLabel->setText(string);
|
||||
|
||||
IntelliImage* activePicture = paintingArea->getImageOfActiveLayer();
|
||||
if(activePicture) {
|
||||
@@ -956,7 +956,7 @@ void IntelliPhotoGui::UpdateGui(){
|
||||
if(paintingArea->layerBundle.size() != 0) {
|
||||
string = QString("%1x%2").arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getIndexOfActiveLayer())].width).arg(paintingArea->layerBundle[static_cast<size_t>
|
||||
(paintingArea->getIndexOfActiveLayer())].height);
|
||||
(paintingArea->getIndexOfActiveLayer())].height);
|
||||
dimActive->setText(string);
|
||||
}
|
||||
else{
|
||||
|
||||
@@ -115,13 +115,13 @@ void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& co
|
||||
}
|
||||
|
||||
void IntelliImage::drawPlain(const QColor& color){
|
||||
if(fastRenderering) {
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
if(fastRenderering) {
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
imageData.fill(color);
|
||||
if(fastRenderering) {
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
if(fastRenderering) {
|
||||
this->imageData = this->imageData.convertToFormat(QImage::Format_Indexed8);
|
||||
}
|
||||
}
|
||||
|
||||
QColor IntelliImage::getPixelColor(QPoint& point){
|
||||
|
||||
@@ -23,7 +23,7 @@ IntelliRasterImage::~IntelliRasterImage(){
|
||||
}
|
||||
|
||||
IntelliImage* IntelliRasterImage::getDeepCopy(){
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false);
|
||||
IntelliRasterImage* raster = new IntelliRasterImage(imageData.width(), imageData.height(), false);
|
||||
raster->imageData.fill(Qt::transparent);
|
||||
raster->TypeOfImage = ImageType::RASTERIMAGE;
|
||||
return raster;
|
||||
|
||||
@@ -12,7 +12,7 @@ IntelliShapedImage::IntelliShapedImage(int width, int height, bool fastRendererO
|
||||
|
||||
IntelliShapedImage* IntelliShapedImage::copy(const IntelliShapedImage& image){
|
||||
this->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), this->fastRenderering);
|
||||
shaped->imageData.copy(0,0,image.getWidth(),image.getWidth());
|
||||
return shaped;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ QImage IntelliShapedImage::getDisplayable(int alpha){
|
||||
}
|
||||
|
||||
IntelliImage* IntelliShapedImage::getDeepCopy(){
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false);
|
||||
IntelliShapedImage* shaped = new IntelliShapedImage(imageData.width(), imageData.height(), false);
|
||||
shaped->setPolygon(this->polygonData);
|
||||
shaped->imageData.fill(Qt::transparent);
|
||||
shaped->TypeOfImage = ImageType::SHAPEDIMAGE;
|
||||
|
||||
@@ -94,7 +94,7 @@ bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){
|
||||
}
|
||||
Canvas->setRenderSettings(static_cast<bool>(rendersetting));
|
||||
openFile.close();
|
||||
Canvas->historyadd();
|
||||
Canvas->historyadd();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ LayerObject::LayerObject(const LayerObject& layer){
|
||||
|
||||
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget*parent)
|
||||
: QLabel(parent){
|
||||
this->Tool = nullptr;
|
||||
this->setCanvasDimensions(maxWidth, maxHeight);
|
||||
this->Tool = nullptr;
|
||||
this->setCanvasDimensions(maxWidth, maxHeight);
|
||||
activeLayer = -1;
|
||||
}
|
||||
|
||||
@@ -275,8 +275,8 @@ void PaintingArea::createFloodFillTool(){
|
||||
}
|
||||
|
||||
void PaintingArea::createGradientTool(){
|
||||
delete this->Tool;
|
||||
Tool = new IntelliToolGradient(this, &colorPicker, &Toolsettings);
|
||||
delete this->Tool;
|
||||
Tool = new IntelliToolGradient(this, &colorPicker, &Toolsettings);
|
||||
}
|
||||
|
||||
int PaintingArea::getWidthOfActive(){
|
||||
@@ -509,30 +509,30 @@ void PaintingArea::updateTools(){
|
||||
|
||||
void PaintingArea::historyadd(){
|
||||
|
||||
historyPresent++;
|
||||
if (historyPresent == 100) {
|
||||
historyPresent++;
|
||||
if (historyPresent == 100) {
|
||||
historyPresent = 0;
|
||||
}
|
||||
historyMaxFuture = historyPresent;
|
||||
if (historyPresent == historyMaxPast){
|
||||
historyMaxPast++;
|
||||
if (historyMaxPast == 100){
|
||||
if (historyPresent == historyMaxPast) {
|
||||
historyMaxPast++;
|
||||
if (historyMaxPast == 100) {
|
||||
historyMaxPast = 0;
|
||||
}
|
||||
}
|
||||
history[static_cast<size_t>(historyPresent)] = layerBundle;
|
||||
}
|
||||
}
|
||||
history[static_cast<size_t>(historyPresent)] = layerBundle;
|
||||
}
|
||||
|
||||
void PaintingArea::historyGoBack(){
|
||||
if (historyPresent != historyMaxPast) {
|
||||
if (--historyPresent == -1)
|
||||
historyPresent = 99;
|
||||
if (activeLayer == -1)
|
||||
activeLayer = 0;
|
||||
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
|
||||
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
|
||||
if (history[static_cast<size_t>(historyPresent)].size() == 0)
|
||||
activeLayer = -1;
|
||||
if (activeLayer == -1)
|
||||
activeLayer = 0;
|
||||
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
|
||||
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size()) - 1;
|
||||
if (history[static_cast<size_t>(historyPresent)].size() == 0)
|
||||
activeLayer = -1;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
@@ -542,12 +542,12 @@ void PaintingArea::historyGoForward(){
|
||||
if (historyPresent != historyMaxFuture) {
|
||||
if (++historyPresent == 100)
|
||||
historyPresent = 0;
|
||||
if (activeLayer == -1)
|
||||
activeLayer = 0;
|
||||
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
|
||||
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size())-1;
|
||||
if (history[static_cast<size_t>(historyPresent)].size() == 0)
|
||||
activeLayer = -1;
|
||||
if (activeLayer == -1)
|
||||
activeLayer = 0;
|
||||
if (layerBundle.size() > history[static_cast<size_t>(historyPresent)].size())
|
||||
activeLayer = static_cast<int>(history[static_cast<size_t>(historyPresent)].size()) - 1;
|
||||
if (history[static_cast<size_t>(historyPresent)].size() == 0)
|
||||
activeLayer = -1;
|
||||
layerBundle = history[static_cast<size_t>(historyPresent)];
|
||||
}
|
||||
this->guiReference->UpdateGui();
|
||||
|
||||
@@ -457,8 +457,8 @@ bool createTempTopLayer(int idx);
|
||||
void updateTools();
|
||||
|
||||
/*!
|
||||
* \brief history - an array out of containers to save history actions.
|
||||
*/
|
||||
* \brief history - an array out of containers to save history actions.
|
||||
*/
|
||||
std::vector<LayerObject> history[100] = {layerBundle};
|
||||
|
||||
/*!
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
enum class Tooltype {
|
||||
CIRCLE,
|
||||
FLOODFILL,
|
||||
GRADIENT,
|
||||
GRADIENT,
|
||||
LINE,
|
||||
PEN,
|
||||
PLAIN,
|
||||
|
||||
@@ -4,128 +4,128 @@
|
||||
#include <QDebug>
|
||||
|
||||
IntelliToolGradient::IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings)
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->ActiveType = Tooltype::GRADIENT;
|
||||
this->LineColor = QColor(0,0,0,255);
|
||||
this->hasMoved = false;
|
||||
: IntelliTool(Area, colorPicker, Toolsettings){
|
||||
this->ActiveType = Tooltype::GRADIENT;
|
||||
this->LineColor = QColor(0,0,0,255);
|
||||
this->hasMoved = false;
|
||||
}
|
||||
|
||||
IntelliToolGradient::~IntelliToolGradient(){
|
||||
IntelliTool::onMouseRightPressed(0,0);
|
||||
IntelliTool::onMouseRightPressed(0,0);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseLeftPressed(int x, int y){
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
doubleStartPoint[0] = static_cast<double>(x);
|
||||
doubleStartPoint[1] = static_cast<double>(y);
|
||||
startPoint = QPoint(x,y);
|
||||
endPoint = QPoint(x,y);
|
||||
VectorStartEnd[0] = 0;
|
||||
VectorStartEnd[1] = 0;
|
||||
Canvas->image->drawPixel(startPoint,LineColor);
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
doubleStartPoint[0] = static_cast<double>(x);
|
||||
doubleStartPoint[1] = static_cast<double>(y);
|
||||
startPoint = QPoint(x,y);
|
||||
endPoint = QPoint(x,y);
|
||||
VectorStartEnd[0] = 0;
|
||||
VectorStartEnd[1] = 0;
|
||||
Canvas->image->drawPixel(startPoint,LineColor);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseLeftReleased(int x, int y){
|
||||
if(hasMoved && this->isDrawing){
|
||||
computeGradientLayer();
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
if(hasMoved && this->isDrawing) {
|
||||
computeGradientLayer();
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
}
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseRightReleased(int x, int y){
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
IntelliTool::onMouseRightReleased(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onMouseMoved(int x, int y){
|
||||
if(this->isDrawing){
|
||||
hasMoved = true;
|
||||
endPoint = QPoint(x,y);
|
||||
VectorStartEnd[0] = static_cast<float>(endPoint.x() - startPoint.x());
|
||||
VectorStartEnd[1] = static_cast<float>(endPoint.y() - startPoint.y());
|
||||
NormalVector[0] = VectorStartEnd[1];
|
||||
NormalVector[1] = (-1*VectorStartEnd[0]);
|
||||
NormalDotNormal = dotProduct(NormalVector,NormalVector);
|
||||
this->Canvas->image->drawPlain(Qt::transparent);
|
||||
computeGradientLayer();
|
||||
Canvas->image->drawLine(startPoint,endPoint,LineColor,1);
|
||||
}
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
if(this->isDrawing) {
|
||||
hasMoved = true;
|
||||
endPoint = QPoint(x,y);
|
||||
VectorStartEnd[0] = static_cast<float>(endPoint.x() - startPoint.x());
|
||||
VectorStartEnd[1] = static_cast<float>(endPoint.y() - startPoint.y());
|
||||
NormalVector[0] = VectorStartEnd[1];
|
||||
NormalVector[1] = (-1 * VectorStartEnd[0]);
|
||||
NormalDotNormal = dotProduct(NormalVector,NormalVector);
|
||||
this->Canvas->image->drawPlain(Qt::transparent);
|
||||
computeGradientLayer();
|
||||
Canvas->image->drawLine(startPoint,endPoint,LineColor,1);
|
||||
}
|
||||
IntelliTool::onMouseMoved(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::onWheelScrolled(int value){
|
||||
IntelliTool::onWheelScrolled(value);
|
||||
IntelliTool::onWheelScrolled(value);
|
||||
}
|
||||
|
||||
void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){
|
||||
double doublePoint[2];
|
||||
doublePoint[0] = static_cast<double>(Point.x());
|
||||
doublePoint[1] = static_cast<double>(Point.y());
|
||||
double doublePointSubA[2];
|
||||
doublePointSubA[0] = doublePoint[0] - doubleStartPoint[0];
|
||||
doublePointSubA[1] = doublePoint[1] - doubleStartPoint[1];
|
||||
double Perpendicular[2];
|
||||
double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector);
|
||||
Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0];
|
||||
Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1];
|
||||
double VectorAPoint[2];
|
||||
VectorAPoint[0] = static_cast<double>(Perpendicular[0] - doubleStartPoint[0]);
|
||||
VectorAPoint[1] = static_cast<double>(Perpendicular[1] - doubleStartPoint[1]);
|
||||
double ratio;
|
||||
if(((VectorAPoint[0] < 0 && VectorStartEnd[0] < 0) || (VectorAPoint[0] > 0 && VectorStartEnd[0] > 0)) && ((VectorAPoint[1] < 0 && VectorStartEnd[1] < 0) || (VectorAPoint[1] > 0 && VectorStartEnd[1] > 0)))
|
||||
ratio = lenghtVector(VectorAPoint)/lenghtVector(VectorStartEnd);
|
||||
else{
|
||||
ratio = -1;
|
||||
}
|
||||
QColor computedColor;
|
||||
if(ratio < 0){
|
||||
computedColor = colorPicker->getFirstColor();
|
||||
}
|
||||
else if(ratio > 1){
|
||||
computedColor = colorPicker->getSecondColor();
|
||||
}
|
||||
else{
|
||||
int red;
|
||||
int green;
|
||||
int blue;
|
||||
int alpha;
|
||||
int red2;
|
||||
int green2;
|
||||
int blue2;
|
||||
int alpha2;
|
||||
colorPicker->getFirstColor().getRgb(&red,&green,&blue,&alpha);
|
||||
colorPicker->getSecondColor().getRgb(&red2,&green2,&blue2,&alpha2);
|
||||
computedColor.setRed(static_cast<int>(ratio * red2 + (1 - ratio) * red));
|
||||
computedColor.setGreen(static_cast<int>(ratio * green2 + (1 - ratio) * green));
|
||||
computedColor.setBlue(static_cast<int>(ratio * blue2 + (1 - ratio) * blue));
|
||||
computedColor.setAlpha(static_cast<int>(ratio * alpha2 + (1 - ratio) * alpha));
|
||||
}
|
||||
Canvas->image->drawPixel(Point,computedColor);
|
||||
double doublePoint[2];
|
||||
doublePoint[0] = static_cast<double>(Point.x());
|
||||
doublePoint[1] = static_cast<double>(Point.y());
|
||||
double doublePointSubA[2];
|
||||
doublePointSubA[0] = doublePoint[0] - doubleStartPoint[0];
|
||||
doublePointSubA[1] = doublePoint[1] - doubleStartPoint[1];
|
||||
double Perpendicular[2];
|
||||
double PointSubADotNormal = dotProduct(doublePointSubA,NormalVector);
|
||||
Perpendicular[0] = doublePoint[0] - (PointSubADotNormal / NormalDotNormal) * NormalVector[0];
|
||||
Perpendicular[1] = doublePoint[1] - (PointSubADotNormal / NormalDotNormal) * NormalVector[1];
|
||||
double VectorAPoint[2];
|
||||
VectorAPoint[0] = static_cast<double>(Perpendicular[0] - doubleStartPoint[0]);
|
||||
VectorAPoint[1] = static_cast<double>(Perpendicular[1] - doubleStartPoint[1]);
|
||||
double ratio;
|
||||
if(((VectorAPoint[0] < 0 && VectorStartEnd[0] < 0) || (VectorAPoint[0] > 0 && VectorStartEnd[0] > 0)) && ((VectorAPoint[1] < 0 && VectorStartEnd[1] < 0) || (VectorAPoint[1] > 0 && VectorStartEnd[1] > 0)))
|
||||
ratio = lenghtVector(VectorAPoint) / lenghtVector(VectorStartEnd);
|
||||
else{
|
||||
ratio = -1;
|
||||
}
|
||||
QColor computedColor;
|
||||
if(ratio < 0) {
|
||||
computedColor = colorPicker->getFirstColor();
|
||||
}
|
||||
else if(ratio > 1) {
|
||||
computedColor = colorPicker->getSecondColor();
|
||||
}
|
||||
else{
|
||||
int red;
|
||||
int green;
|
||||
int blue;
|
||||
int alpha;
|
||||
int red2;
|
||||
int green2;
|
||||
int blue2;
|
||||
int alpha2;
|
||||
colorPicker->getFirstColor().getRgb(&red,&green,&blue,&alpha);
|
||||
colorPicker->getSecondColor().getRgb(&red2,&green2,&blue2,&alpha2);
|
||||
computedColor.setRed(static_cast<int>(ratio * red2 + (1 - ratio) * red));
|
||||
computedColor.setGreen(static_cast<int>(ratio * green2 + (1 - ratio) * green));
|
||||
computedColor.setBlue(static_cast<int>(ratio * blue2 + (1 - ratio) * blue));
|
||||
computedColor.setAlpha(static_cast<int>(ratio * alpha2 + (1 - ratio) * alpha));
|
||||
}
|
||||
Canvas->image->drawPixel(Point,computedColor);
|
||||
}
|
||||
|
||||
double IntelliToolGradient::dotProduct(double Vector1[2], double Vector2[2]){
|
||||
return static_cast<double>(Vector1[0]*Vector2[0]+Vector1[1]*Vector2[1]);
|
||||
return static_cast<double>(Vector1[0] * Vector2[0] + Vector1[1] * Vector2[1]);
|
||||
}
|
||||
|
||||
double IntelliToolGradient::lenghtVector(double Vector[2]){
|
||||
return static_cast<double>((sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1])));
|
||||
return static_cast<double>((sqrt(Vector[0] * Vector[0] + Vector[1] * Vector[1])));
|
||||
}
|
||||
|
||||
void IntelliToolGradient::computeGradientLayer(){
|
||||
bool switched = false;
|
||||
if(Canvas->image->isFastRendering()){
|
||||
switched = true;
|
||||
Canvas->image->updateRendererSetting(false);
|
||||
}
|
||||
for(int i = 0; i < activeLayer->height; i++){
|
||||
for(int j = 0; j < activeLayer->width; j++){
|
||||
computeAndDrawPixelColor(QPoint(j,i));
|
||||
}
|
||||
}
|
||||
if(switched){
|
||||
Canvas->image->updateRendererSetting(true);
|
||||
}
|
||||
bool switched = false;
|
||||
if(Canvas->image->isFastRendering()) {
|
||||
switched = true;
|
||||
Canvas->image->updateRendererSetting(false);
|
||||
}
|
||||
for(int i = 0; i < activeLayer->height; i++) {
|
||||
for(int j = 0; j < activeLayer->width; j++) {
|
||||
computeAndDrawPixelColor(QPoint(j,i));
|
||||
}
|
||||
}
|
||||
if(switched) {
|
||||
Canvas->image->updateRendererSetting(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,129 +4,129 @@
|
||||
/*!
|
||||
* \brief The IntelliToolGradient class that represents a gradient call
|
||||
*/
|
||||
class IntelliToolGradient : public IntelliTool{
|
||||
class IntelliToolGradient : public IntelliTool {
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief IntelliToolGradient basic constructor of the gradient tool.
|
||||
* \param Area - a reference to the paintingArea
|
||||
* \param colorPicker - a reference to the colorpicker
|
||||
* \param Toolsettings - a regerence to the Toolsettings
|
||||
*/
|
||||
IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
/*!
|
||||
* \brief IntelliToolGradient basic constructor of the gradient tool.
|
||||
* \param Area - a reference to the paintingArea
|
||||
* \param colorPicker - a reference to the colorpicker
|
||||
* \param Toolsettings - a regerence to the Toolsettings
|
||||
*/
|
||||
IntelliToolGradient(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings);
|
||||
|
||||
/*!
|
||||
* \brief ~IntelliToolGradient basic destructor.
|
||||
*/
|
||||
virtual ~IntelliToolGradient() override;
|
||||
/*!
|
||||
* \brief ~IntelliToolGradient basic destructor.
|
||||
*/
|
||||
virtual ~IntelliToolGradient() override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the active/canvas layer.
|
||||
* \param y - The y coordinate relative to the active/canvas layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the scroll event. A positive value means scrolling outwards. Call this in child classes!
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value) override;
|
||||
/*!
|
||||
* \brief A function managing the scroll event. A positive value means scrolling outwards. Call this in child classes!
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Call this in child classes!
|
||||
* \param x - The x coordinate of the new mouse position.
|
||||
* \param y - The y coordinate of the new mouse position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Call this in child classes!
|
||||
* \param x - The x coordinate of the new mouse position.
|
||||
* \param y - The y coordinate of the new mouse position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
|
||||
private:
|
||||
|
||||
/*!
|
||||
* \brief startPoint of the line
|
||||
*/
|
||||
QPoint startPoint;
|
||||
/*!
|
||||
* \brief startPoint of the line
|
||||
*/
|
||||
QPoint startPoint;
|
||||
|
||||
/*!
|
||||
* \brief endPoint of the line
|
||||
*/
|
||||
QPoint endPoint;
|
||||
/*!
|
||||
* \brief doubleStartPoint startPoint as double Values
|
||||
*/
|
||||
double doubleStartPoint[2];
|
||||
/*!
|
||||
* \brief endPoint of the line
|
||||
*/
|
||||
QPoint endPoint;
|
||||
/*!
|
||||
* \brief doubleStartPoint startPoint as double Values
|
||||
*/
|
||||
double doubleStartPoint[2];
|
||||
|
||||
/*!
|
||||
* \brief VectorStartEnd a vector between start and end point.
|
||||
*/
|
||||
double VectorStartEnd[2];
|
||||
/*!
|
||||
* \brief VectorStartEnd a vector between start and end point.
|
||||
*/
|
||||
double VectorStartEnd[2];
|
||||
|
||||
/*!
|
||||
* \brief NormalVector of the VectorStartEnd
|
||||
*/
|
||||
double NormalVector[2];
|
||||
/*!
|
||||
* \brief NormalVector of the VectorStartEnd
|
||||
*/
|
||||
double NormalVector[2];
|
||||
|
||||
/*!
|
||||
* \brief NormalDotNormal dot product of Normal*Normal
|
||||
*/
|
||||
double NormalDotNormal;
|
||||
/*!
|
||||
* \brief NormalDotNormal dot product of Normal*Normal
|
||||
*/
|
||||
double NormalDotNormal;
|
||||
|
||||
/*!
|
||||
* \brief LineColor color of th line.
|
||||
*/
|
||||
QColor LineColor;
|
||||
/*!
|
||||
* \brief LineColor color of th line.
|
||||
*/
|
||||
QColor LineColor;
|
||||
|
||||
/*!
|
||||
* \brief hasMoved indicates a movement
|
||||
*/
|
||||
bool hasMoved;
|
||||
/*!
|
||||
* \brief hasMoved indicates a movement
|
||||
*/
|
||||
bool hasMoved;
|
||||
|
||||
/*!
|
||||
* \brief computeAndDrawPixelColor computes the pixelcolor for a given point and sets it to the image.
|
||||
* \param Point the point which shoud be computed
|
||||
*/
|
||||
void computeAndDrawPixelColor(QPoint Point);
|
||||
/*!
|
||||
* \brief computeAndDrawPixelColor computes the pixelcolor for a given point and sets it to the image.
|
||||
* \param Point the point which shoud be computed
|
||||
*/
|
||||
void computeAndDrawPixelColor(QPoint Point);
|
||||
|
||||
/*!
|
||||
* \brief dotProduct calculates the dot product of 2 vetors.
|
||||
* \param Vector1 - first argument
|
||||
* \param Vector2 - second argument
|
||||
* \return returns the dot product.
|
||||
*/
|
||||
double dotProduct(double Vector1[2], double Vector2[2]);
|
||||
/*!
|
||||
* \brief dotProduct calculates the dot product of 2 vetors.
|
||||
* \param Vector1 - first argument
|
||||
* \param Vector2 - second argument
|
||||
* \return returns the dot product.
|
||||
*/
|
||||
double dotProduct(double Vector1[2], double Vector2[2]);
|
||||
|
||||
/*!
|
||||
* \brief lenghtVector returns the length of a vector
|
||||
* \param Vector - Vector to calculate the length
|
||||
* \return returns the length of the vector
|
||||
*/
|
||||
double lenghtVector(double Vector[2]);
|
||||
/*!
|
||||
* \brief lenghtVector returns the length of a vector
|
||||
* \param Vector - Vector to calculate the length
|
||||
* \return returns the length of the vector
|
||||
*/
|
||||
double lenghtVector(double Vector[2]);
|
||||
|
||||
/*!
|
||||
* \brief computeGradientLayer computes the gradient over all pixels in the image.
|
||||
*/
|
||||
void computeGradientLayer();
|
||||
/*!
|
||||
* \brief computeGradientLayer computes the gradient over all pixels in the image.
|
||||
*/
|
||||
void computeGradientLayer();
|
||||
};
|
||||
|
||||
#endif // INTELLITOOLGRADIENT_H
|
||||
|
||||
Reference in New Issue
Block a user