mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +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);
|
||||
}
|
||||
|
||||
// Opens a dialog that allows the user to create a New Layer
|
||||
void IntelliPhotoGui::slotCreateNewLayer(){
|
||||
// Opens a dialog that allows the user to create a New RASTER Layer
|
||||
void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
||||
// Stores button value
|
||||
bool ok1, ok2;
|
||||
|
||||
@@ -85,11 +85,36 @@ void IntelliPhotoGui::slotCreateNewLayer(){
|
||||
200,1, 500, 1, &ok2);
|
||||
// Create New Layer
|
||||
if (ok1&&ok2) {
|
||||
paintingArea->addLayer(width,height,0,0);
|
||||
paintingArea->addLayer(width,height,0,0,IntelliImage::ImageType::RASTERIMAGE);
|
||||
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
|
||||
void IntelliPhotoGui::slotDeleteLayer(){
|
||||
// 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(){
|
||||
paintingArea->movePositionActive(0,-20);
|
||||
update();
|
||||
@@ -343,10 +386,16 @@ void IntelliPhotoGui::createActions(){
|
||||
actionOpen->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
|
||||
connect(actionOpen, SIGNAL(triggered()), this, SLOT(slotOpen()));
|
||||
|
||||
// Create New Layer action and tie to IntelliPhotoGui::newLayer()
|
||||
actionCreateNewLayer = new QAction(tr("&New Layer..."), this);
|
||||
actionCreateNewLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||
connect(actionCreateNewLayer, SIGNAL(triggered()), this, SLOT(slotCreateNewLayer()));
|
||||
// Create New RASTER Layer action and tie to IntelliPhotoGui::newLayer()
|
||||
actionCreateNewRasterLayer = new QAction(tr("&Raster Image"), this);
|
||||
actionCreateNewRasterLayer->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_N));
|
||||
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()
|
||||
actionDeleteLayer = new QAction(tr("&Delete Layer..."), this);
|
||||
@@ -361,6 +410,10 @@ void IntelliPhotoGui::createActions(){
|
||||
actionSetActiveAlpha->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_A));
|
||||
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->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Up));
|
||||
connect(actionMovePositionUp, SIGNAL(triggered()), this, SLOT(slotPositionMoveUp()));
|
||||
@@ -510,12 +563,17 @@ void IntelliPhotoGui::createMenus(){
|
||||
renderMenu->addAction(actionUpdateRenderSettingsOn);
|
||||
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
|
||||
layerMenu = new QMenu(tr("&Layer"), this);
|
||||
layerMenu->addAction(actionCreateNewLayer);
|
||||
layerMenu->addMenu(layerCreationMenu);
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionSetActiveAlpha);
|
||||
layerMenu->addAction(actionSetActiveLayer);
|
||||
layerMenu->addAction(actionSetPolygon);
|
||||
layerMenu->addSeparator();
|
||||
layerMenu->addAction(actionMovePositionUp);
|
||||
layerMenu->addAction(actionMovePositionDown);
|
||||
|
||||
@@ -44,11 +44,13 @@ void slotOpen();
|
||||
void slotSave();
|
||||
|
||||
// layer slots here
|
||||
void slotCreateNewLayer();
|
||||
void slotCreateNewRasterLayer();
|
||||
void slotCreateNewShapedLayer();
|
||||
void slotDeleteLayer();
|
||||
void slotClearActiveLayer();
|
||||
void slotSetActiveLayer();
|
||||
void slotSetActiveAlpha();
|
||||
void slotSetPolygon();
|
||||
void slotPositionMoveUp();
|
||||
void slotPositionMoveDown();
|
||||
void slotPositionMoveLeft();
|
||||
@@ -133,6 +135,7 @@ QMenu*saveAsMenu;
|
||||
QMenu*fileMenu;
|
||||
QMenu*renderMenu;
|
||||
QMenu*optionMenu;
|
||||
QMenu*layerCreationMenu;
|
||||
QMenu*layerMenu;
|
||||
QMenu*colorMenu;
|
||||
QMenu*toolCreationMenu;
|
||||
@@ -168,10 +171,12 @@ QAction*actionAboutDialog;
|
||||
QAction*actionAboutQtDialog;
|
||||
|
||||
// layer change actions
|
||||
QAction*actionCreateNewLayer;
|
||||
QAction*actionDeleteLayer;
|
||||
QAction* actionCreateNewRasterLayer;
|
||||
QAction* actionCreateNewShapedLayer;
|
||||
QAction* actionDeleteLayer;
|
||||
QAction* actionSetActiveLayer;
|
||||
QAction* actionSetActiveAlpha;
|
||||
QAction* actionSetPolygon;
|
||||
QAction* actionMovePositionUp;
|
||||
QAction* actionMovePositionDown;
|
||||
QAction* actionMovePositionLeft;
|
||||
|
||||
@@ -110,6 +110,13 @@ void PaintingArea::setLayerAlpha(int idx, int 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
|
||||
bool PaintingArea::open(const QString &filePath){
|
||||
|
||||
@@ -115,6 +115,11 @@ void setLayerActive(int idx);
|
||||
* \param alpha - New alpha value of the layer
|
||||
*/
|
||||
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
|
||||
* \param r - Red value of the color the layer should be filled with
|
||||
|
||||
Reference in New Issue
Block a user