mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-17 05:40:31 +02:00
implemented creation of certain image type and alo button for setting poylgon data
TODO implement setPolygon function
This commit is contained in:
@@ -65,8 +65,8 @@ void IntelliPhotoGui::slotSave(){
|
|||||||
saveFile(fileFormat);
|
saveFile(fileFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opens a dialog that allows the user to create a New Layer
|
// Opens a dialog that allows the user to create a New RASTER Layer
|
||||||
void IntelliPhotoGui::slotCreateNewLayer(){
|
void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
||||||
// Stores button value
|
// Stores button value
|
||||||
bool ok1, ok2;
|
bool ok1, ok2;
|
||||||
|
|
||||||
@@ -85,11 +85,36 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
|||||||
200,1, 500, 1, &ok2);
|
200,1, 500, 1, &ok2);
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok1&&ok2) {
|
if (ok1&&ok2) {
|
||||||
paintingArea->addLayer(width,height,0,0);
|
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opens a dialog that allows the user to create a New SHAPED Layer
|
||||||
|
void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
||||||
|
// Stores button value
|
||||||
|
bool ok1, ok2;
|
||||||
|
|
||||||
|
// "New Layer" is the title of the window
|
||||||
|
// the next tr is the text to display
|
||||||
|
// Define the standard Value, min, max, step and ok button
|
||||||
|
QInputDialog Input;
|
||||||
|
Input.setPalette(Palette);
|
||||||
|
|
||||||
|
int width = Input.getInt(this, tr("New Layer"),
|
||||||
|
tr("Width:"),
|
||||||
|
200,1, 500, 1, &ok1);
|
||||||
|
|
||||||
|
int height = QInputDialog::getInt(this, tr("New Layer"),
|
||||||
|
tr("Height:"),
|
||||||
|
200,1, 500, 1, &ok2);
|
||||||
|
// Create New Layer
|
||||||
|
if (ok1&&ok2) {
|
||||||
|
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::SHAPEDIMAGE);
|
||||||
|
UpdateGui();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Opens a dialog that allows the user to delete a Layer
|
// Opens a dialog that allows the user to delete a Layer
|
||||||
void IntelliPhotoGui::slotDeleteLayer(){
|
void IntelliPhotoGui::slotDeleteLayer(){
|
||||||
// Stores button value
|
// Stores button value
|
||||||
@@ -129,6 +154,24 @@ void IntelliPhotoGui::slotSetActiveAlpha(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntelliPhotoGui::slotSetPolygon(){
|
||||||
|
// Stores button value
|
||||||
|
bool ok1;
|
||||||
|
|
||||||
|
// "Layer to set on" is the title of the window
|
||||||
|
// the next tr is the text to display
|
||||||
|
// Define the standard Value, min, max, step and ok button
|
||||||
|
int layer = QInputDialog::getInt(this, tr("Layer to set on"),
|
||||||
|
tr("Layer:"),
|
||||||
|
1,1,500,1, &ok1);
|
||||||
|
|
||||||
|
if (ok1)
|
||||||
|
{
|
||||||
|
paintingArea->setPolygon(layer-1);
|
||||||
|
UpdateGui();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void IntelliPhotoGui::slotPositionMoveUp(){
|
void IntelliPhotoGui::slotPositionMoveUp(){
|
||||||
paintingArea->movePositionActive(0,-20);
|
paintingArea->movePositionActive(0,-20);
|
||||||
update();
|
update();
|
||||||
@@ -343,10 +386,16 @@ void IntelliPhotoGui::createActions(){
|
|||||||
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
||||||
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
|
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
|
||||||
|
|
||||||
// Create New Layer action and tie to IntelliPhotoGui::newLayer()
|
// Create New RASTER Layer action and tie to IntelliPhotoGui::newLayer()
|
||||||
actionCreateNewLayer = new QAction(tr("&New Layer..."), this);
|
actionCreateNewRasterLayer = new QAction(tr("&Raster Image"), this);
|
||||||
actionCreateNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||||
connect(actionCreateNewLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewLayer()));
|
connect(actionCreateNewRasterLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewRasterLayer()));
|
||||||
|
|
||||||
|
|
||||||
|
// Create New SHAPED Layer action and tie to IntelliPhotoGui::newLayer()
|
||||||
|
actionCreateNewShapedLayer = new QAction(tr("&Shaped Image"), this);
|
||||||
|
actionCreateNewShapedLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N + Qt::ALT));
|
||||||
|
connect(actionCreateNewShapedLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewShapedLayer()));
|
||||||
|
|
||||||
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
// Delete New Layer action and tie to IntelliPhotoGui::deleteLayer()
|
||||||
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
||||||
@@ -361,6 +410,10 @@ void IntelliPhotoGui::createActions(){
|
|||||||
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
||||||
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
connect(actionSetActiveAlpha, SIGNAL(triggered()), this, SLOT(slotSetActiveAlpha()));
|
||||||
|
|
||||||
|
actionSetPolygon = new QAction(tr("&set new Polygondata"), 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));
|
actionMovePositionUp->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
|
||||||
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
|
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
|
||||||
@@ -510,12 +563,17 @@ void IntelliPhotoGui::createMenus(){
|
|||||||
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
||||||
renderMenu->addAction(actionUpdateRenderSettingsOff);
|
renderMenu->addAction(actionUpdateRenderSettingsOff);
|
||||||
|
|
||||||
|
//Attach all Layer Creations to Menu
|
||||||
|
layerCreationMenu = new QMenu(tr("&Create new Layer"), this);
|
||||||
|
layerCreationMenu->addAction(actionCreateNewRasterLayer);
|
||||||
|
layerCreationMenu->addAction(actionCreateNewShapedLayer);
|
||||||
// Attach all actions to Layer
|
// Attach all actions to Layer
|
||||||
layerMenu = new QMenu(tr("&Layer"), this);
|
layerMenu = new QMenu(tr("&Layer"), this);
|
||||||
layerMenu->addAction(actionCreateNewLayer);
|
layerMenu->addMenu(layerCreationMenu);
|
||||||
layerMenu->addSeparator();
|
layerMenu->addSeparator();
|
||||||
layerMenu->addAction(actionSetActiveAlpha);
|
layerMenu->addAction(actionSetActiveAlpha);
|
||||||
layerMenu->addAction(actionSetActiveLayer);
|
layerMenu->addAction(actionSetActiveLayer);
|
||||||
|
layerMenu->addAction(actionSetPolygon);
|
||||||
layerMenu->addSeparator();
|
layerMenu->addSeparator();
|
||||||
layerMenu->addAction(actionMovePositionUp);
|
layerMenu->addAction(actionMovePositionUp);
|
||||||
layerMenu->addAction(actionMovePositionDown);
|
layerMenu->addAction(actionMovePositionDown);
|
||||||
|
|||||||
@@ -44,11 +44,13 @@ void slotOpen();
|
|||||||
void slotSave();
|
void slotSave();
|
||||||
|
|
||||||
// layer slots here
|
// layer slots here
|
||||||
void slotCreateNewLayer();
|
void slotCreateNewRasterLayer();
|
||||||
|
void slotCreateNewShapedLayer();
|
||||||
void slotDeleteLayer();
|
void slotDeleteLayer();
|
||||||
void slotClearActiveLayer();
|
void slotClearActiveLayer();
|
||||||
void slotSetActiveLayer();
|
void slotSetActiveLayer();
|
||||||
void slotSetActiveAlpha();
|
void slotSetActiveAlpha();
|
||||||
|
void slotSetPolygon();
|
||||||
void slotPositionMoveUp();
|
void slotPositionMoveUp();
|
||||||
void slotPositionMoveDown();
|
void slotPositionMoveDown();
|
||||||
void slotPositionMoveLeft();
|
void slotPositionMoveLeft();
|
||||||
@@ -133,6 +135,7 @@ QMenu*saveAsMenu;
|
|||||||
QMenu*fileMenu;
|
QMenu*fileMenu;
|
||||||
QMenu*renderMenu;
|
QMenu*renderMenu;
|
||||||
QMenu*optionMenu;
|
QMenu*optionMenu;
|
||||||
|
QMenu*layerCreationMenu;
|
||||||
QMenu*layerMenu;
|
QMenu*layerMenu;
|
||||||
QMenu*colorMenu;
|
QMenu*colorMenu;
|
||||||
QMenu*toolCreationMenu;
|
QMenu*toolCreationMenu;
|
||||||
@@ -168,10 +171,12 @@ QAction*actionAboutDialog;
|
|||||||
QAction*actionAboutQtDialog;
|
QAction*actionAboutQtDialog;
|
||||||
|
|
||||||
// layer change actions
|
// layer change actions
|
||||||
QAction*actionCreateNewLayer;
|
QAction* actionCreateNewRasterLayer;
|
||||||
QAction*actionDeleteLayer;
|
QAction* actionCreateNewShapedLayer;
|
||||||
|
QAction* actionDeleteLayer;
|
||||||
QAction* actionSetActiveLayer;
|
QAction* actionSetActiveLayer;
|
||||||
QAction* actionSetActiveAlpha;
|
QAction* actionSetActiveAlpha;
|
||||||
|
QAction* actionSetPolygon;
|
||||||
QAction* actionMovePositionUp;
|
QAction* actionMovePositionUp;
|
||||||
QAction* actionMovePositionDown;
|
QAction* actionMovePositionDown;
|
||||||
QAction* actionMovePositionLeft;
|
QAction* actionMovePositionLeft;
|
||||||
|
|||||||
@@ -110,6 +110,13 @@ void PaintingArea::setLayerAlpha(int idx, int alpha){
|
|||||||
layerBundle[static_cast<size_t>(idx)].alpha=alpha;
|
layerBundle[static_cast<size_t>(idx)].alpha=alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void PaintingArea::setPolygon(int idx){
|
||||||
|
if(idx>=0&&idx<static_cast<int>(layerBundle.size())) {
|
||||||
|
if(layerBundle[static_cast<size_t>(idx)].image->getTypeOfImage()==IntelliImage::ImageType::SHAPEDIMAGE){
|
||||||
|
qDebug() << "Todo Implement here set Polygon";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Used to load the image and place it in the widget
|
// Used to load the image and place it in the widget
|
||||||
bool PaintingArea::open(const QString &filePath){
|
bool PaintingArea::open(const QString &filePath){
|
||||||
|
|||||||
@@ -115,6 +115,11 @@ void setLayerActive(int idx);
|
|||||||
* \param alpha - New alpha value of the layer
|
* \param alpha - New alpha value of the layer
|
||||||
*/
|
*/
|
||||||
void setLayerAlpha(int idx, int alpha);
|
void setLayerAlpha(int idx, int alpha);
|
||||||
|
/*!
|
||||||
|
* \brief setPolygon is used for setting polygondata, it only works on RASTER images
|
||||||
|
* \param idx - represents the number of the layer with should be transformed
|
||||||
|
*/
|
||||||
|
void setPolygon(int idx);
|
||||||
/*!
|
/*!
|
||||||
* \brief The floodFill method fills a the active layer with a given color
|
* \brief The floodFill method fills a the active layer with a given color
|
||||||
* \param r - Red value of the color the layer should be filled with
|
* \param r - Red value of the color the layer should be filled with
|
||||||
|
|||||||
Reference in New Issue
Block a user