mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 20:30:32 +02:00
Merge branch 'dev-save' into dev-history
This commit is contained in:
@@ -3,8 +3,10 @@
|
|||||||
#include "IntelliPhotoGui.h"
|
#include "IntelliPhotoGui.h"
|
||||||
#include "Layer/PaintingArea.h"
|
#include "Layer/PaintingArea.h"
|
||||||
|
|
||||||
#include "QEvent"
|
#include <QEvent>
|
||||||
#include "QCloseEvent"
|
#include <QCloseEvent>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
// IntelliPhotoGui constructor
|
// IntelliPhotoGui constructor
|
||||||
IntelliPhotoGui::IntelliPhotoGui(){
|
IntelliPhotoGui::IntelliPhotoGui(){
|
||||||
@@ -50,10 +52,28 @@ void IntelliPhotoGui::slotOpen(){
|
|||||||
// If we have a file name load the image and place
|
// If we have a file name load the image and place
|
||||||
// it in the paintingArea
|
// it in the paintingArea
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
paintingArea->open(fileName);
|
bool rightFileType =true;
|
||||||
UpdateGui();
|
if(fileName.size()>=4){
|
||||||
}
|
QString endung(".idf");
|
||||||
}
|
int length = fileName.size();
|
||||||
|
for(int i=0; i<4; i++){
|
||||||
|
if(endung[i]!=fileName[length-4+i]){
|
||||||
|
rightFileType = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rightFileType){
|
||||||
|
IntelliDatamanager::loadProject(paintingArea,fileName);
|
||||||
|
UpdateGui();
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
paintingArea->open(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the user clicks Save As in the menu
|
// Called when the user clicks Save As in the menu
|
||||||
@@ -82,7 +102,7 @@ void IntelliPhotoGui::slotCreateNewRasterLayer(){
|
|||||||
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok1&&ok2) {
|
if (ok1&&ok2) {
|
||||||
paintingArea->addLayer(width,height,0,0,ImageType::RASTERIMAGE);
|
paintingArea->addLayer(width,height,0,0,255,ImageType::RASTERIMAGE);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,7 +121,7 @@ void IntelliPhotoGui::slotCreateNewShapedLayer(){
|
|||||||
|
|
||||||
// Create New Layer
|
// Create New Layer
|
||||||
if (ok1&&ok2) {
|
if (ok1&&ok2) {
|
||||||
paintingArea->addLayer(width, height, 0, 0, ImageType::SHAPEDIMAGE);
|
paintingArea->addLayer(width, height, 0, 0,255, ImageType::SHAPEDIMAGE);
|
||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -364,6 +384,14 @@ void IntelliPhotoGui::createActions(){
|
|||||||
actionSaveAs.append(pngSaveAction);
|
actionSaveAs.append(pngSaveAction);
|
||||||
pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
pngSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_S));
|
||||||
|
|
||||||
|
QAction*projectSaveAction = new QAction("Projekt", this);
|
||||||
|
projectSaveAction->setData("idf");
|
||||||
|
// When clicked call IntelliPhotoGui::save()
|
||||||
|
connect(projectSaveAction, SIGNAL(triggered()), this, SLOT(slotSave()));
|
||||||
|
// Attach each PNG in save Menu
|
||||||
|
actionSaveAs.append(projectSaveAction);
|
||||||
|
projectSaveAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
|
||||||
|
|
||||||
// Create exit action and tie to IntelliPhotoGui::close()
|
// Create exit action and tie to IntelliPhotoGui::close()
|
||||||
actionExit = new QAction(tr("&Exit"), this);
|
actionExit = new QAction(tr("&Exit"), this);
|
||||||
actionExit->setShortcuts(QKeySequence::Quit);
|
actionExit->setShortcuts(QKeySequence::Quit);
|
||||||
@@ -835,6 +863,10 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat){
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
// Call for the file to be saved
|
// Call for the file to be saved
|
||||||
|
if(fileFormat == "idf"){
|
||||||
|
return IntelliDatamanager::saveProject(paintingArea, fileName);
|
||||||
|
|
||||||
|
}
|
||||||
return paintingArea->save(fileName, fileFormat.constData());
|
return paintingArea->save(fileName, fileFormat.constData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include "IntelliInputDialog.h"
|
#include "IntelliInputDialog.h"
|
||||||
|
#include "IntelliHelper/IntelliDatamanager.h"
|
||||||
|
|
||||||
//for unit testing
|
//for unit testing
|
||||||
class UnitTest;
|
class UnitTest;
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ friend UnitTest;
|
|||||||
friend IntelliTool;
|
friend IntelliTool;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeImage(QImage*image, const QSize &newSize);
|
void resizeImage(QImage*image, const QSize &newSize);
|
||||||
|
|
||||||
|
|||||||
@@ -59,3 +59,7 @@ QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
|
|||||||
void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
|
void IntelliRasterImage::setPolygon(const std::vector<QPoint>& polygonData){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<QPoint> IntelliRasterImage::getPolygon(){
|
||||||
|
return std::vector<QPoint>();
|
||||||
|
}
|
||||||
|
|||||||
@@ -59,6 +59,12 @@ virtual IntelliImage* getDeepCopy() override;
|
|||||||
* \param polygonData - The Vertices of the Polygon. Nothing happens.
|
* \param polygonData - The Vertices of the Polygon. Nothing happens.
|
||||||
*/
|
*/
|
||||||
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;
|
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief getPolygon
|
||||||
|
* \return returns the points of the polygon
|
||||||
|
*/
|
||||||
|
virtual std::vector<QPoint> getPolygon();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -118,3 +118,7 @@ void IntelliShapedImage::setPolygon(const std::vector<QPoint>& polygonData){
|
|||||||
calculateVisiblity();
|
calculateVisiblity();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<QPoint> IntelliShapedImage::getPolygon(){
|
||||||
|
return polygonData;
|
||||||
|
}
|
||||||
|
|||||||
@@ -78,6 +78,14 @@ virtual std::vector<QPoint> getPolygonData() override {
|
|||||||
* \param polygonData - The Vertices of the Polygon. Just Planar Polygons are allowed.
|
* \param polygonData - The Vertices of the Polygon. Just Planar Polygons are allowed.
|
||||||
*/
|
*/
|
||||||
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;
|
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief getPolygon
|
||||||
|
* \return returns the data of the polygon as points
|
||||||
|
*/
|
||||||
|
virtual std::vector<QPoint> getPolygon() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
101
src/IntelliHelper/IntelliDatamanager.cpp
Normal file
101
src/IntelliHelper/IntelliDatamanager.cpp
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
#include "IntelliDatamanager.h"
|
||||||
|
#include "Layer/PaintingArea.h"
|
||||||
|
|
||||||
|
bool IntelliDatamanager::saveProject(PaintingArea* Canvas, QString filePath){
|
||||||
|
QFile openFile(filePath);
|
||||||
|
|
||||||
|
if(openFile.open(QIODevice::WriteOnly)){
|
||||||
|
|
||||||
|
QTextStream out(&openFile);
|
||||||
|
std::vector<LayerObject>* layerBundle = Canvas->getLayerBundle();
|
||||||
|
size_t numberOfLayers = layerBundle->size();
|
||||||
|
out << 7 << endl; //version tag
|
||||||
|
out << Canvas->getRenderSettings() << " ";
|
||||||
|
out << Canvas->getMaxWidth() << " " << Canvas->getMaxHeight() << endl; //dimensions of canvas
|
||||||
|
out << numberOfLayers << endl; //number of layers
|
||||||
|
for(size_t i = 0; i<numberOfLayers; i++){
|
||||||
|
int width = layerBundle->at(i).width;
|
||||||
|
int height = layerBundle->at(i).height;
|
||||||
|
out << width << endl; //width
|
||||||
|
out << height << endl; //height
|
||||||
|
out << layerBundle->at(i).widthOffset << endl; //widthOffset
|
||||||
|
out << layerBundle->at(i).heightOffset << endl; //HeightOffset
|
||||||
|
out << layerBundle->at(i).alpha << endl; //alpha of layer
|
||||||
|
if(layerBundle->at(i).image->getTypeOfImage() == ImageType::RASTERIMAGE){
|
||||||
|
out << 0 << " ";
|
||||||
|
}else{
|
||||||
|
out << 1 << " ";
|
||||||
|
}
|
||||||
|
std::vector<QPoint> points = layerBundle->at(i).image->getPolygonData();
|
||||||
|
out << points.size() << " ";
|
||||||
|
for(size_t j = 0; j<points.size(); j++){
|
||||||
|
out << points.at(j).x() << " " << points.at(j).y() << " ";
|
||||||
|
}
|
||||||
|
for(int j=0; j<height; j++){
|
||||||
|
for(int k = 0; k<width; k++){
|
||||||
|
QColor pixColor = layerBundle->at(i).image->getImageData().pixelColor(j,k);
|
||||||
|
out << pixColor.red() << " " << pixColor.green() << " " << pixColor.blue() << " " << pixColor.alpha() << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
out << "\nFormat designed and approved by IntelliPhoto Team 7. All rigths reserved.";
|
||||||
|
openFile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IntelliDatamanager::loadProject(PaintingArea* Canvas, QString filePath){
|
||||||
|
QFile openFile(filePath);
|
||||||
|
Canvas->deleteAllLayers();
|
||||||
|
if(openFile.open(QIODevice::ReadOnly)){
|
||||||
|
QTextStream in(&openFile);
|
||||||
|
|
||||||
|
float version;
|
||||||
|
int rendersetting;
|
||||||
|
int widthCanvas, heightCanvas, numberOffLayers;
|
||||||
|
in >> version;
|
||||||
|
in >> rendersetting;
|
||||||
|
in >> widthCanvas >> heightCanvas;
|
||||||
|
in >> numberOffLayers;
|
||||||
|
|
||||||
|
Canvas->setLayerDimensions(widthCanvas, heightCanvas);
|
||||||
|
for(int i=0; i<numberOffLayers; i++){
|
||||||
|
int width, height, widthOffset, heightOffset, alpha;
|
||||||
|
in >> width >> height >> widthOffset >> heightOffset >> alpha;
|
||||||
|
|
||||||
|
int typeFlag;
|
||||||
|
size_t numberOfPoints;
|
||||||
|
std::vector<QPoint> polyPoints;
|
||||||
|
|
||||||
|
in >> typeFlag >> numberOfPoints;
|
||||||
|
if(typeFlag==0){
|
||||||
|
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::RASTERIMAGE);
|
||||||
|
}else{
|
||||||
|
Canvas->addLayer(width, height, widthOffset, heightOffset, alpha, ImageType::SHAPEDIMAGE);
|
||||||
|
}
|
||||||
|
polyPoints.reserve(numberOfPoints);
|
||||||
|
for(size_t j=0; j<numberOfPoints; j++){
|
||||||
|
int x, y;
|
||||||
|
in >> x >> y;
|
||||||
|
polyPoints.push_back(QPoint(x,y));
|
||||||
|
}
|
||||||
|
Canvas->setPolygonDataToActive(polyPoints);
|
||||||
|
|
||||||
|
for(int j=0; j<height; j++){
|
||||||
|
for(int k = 0; k<width; k++){
|
||||||
|
int red, green, blue, alpha;
|
||||||
|
in >> red >> green >> blue >> alpha;
|
||||||
|
Canvas->setPixelToActive(QColor(red, green, blue, alpha), QPoint(j, k));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Canvas->setRenderSettings(static_cast<bool>(rendersetting));
|
||||||
|
openFile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
16
src/IntelliHelper/IntelliDatamanager.h
Normal file
16
src/IntelliHelper/IntelliDatamanager.h
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef INTELLIDATAMANAGER_H
|
||||||
|
#define INTELLIDATAMANAGER_H
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
class PaintingArea;
|
||||||
|
|
||||||
|
namespace IntelliDatamanager{
|
||||||
|
|
||||||
|
bool loadProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||||
|
bool saveProject(PaintingArea* Canvas, QString filePath = "unnamed.idf");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // INTELLIDATAMANAGER_H
|
||||||
@@ -22,6 +22,7 @@ SOURCES += \
|
|||||||
Image/IntelliRasterImage.cpp \
|
Image/IntelliRasterImage.cpp \
|
||||||
Image/IntelliShapedImage.cpp \
|
Image/IntelliShapedImage.cpp \
|
||||||
IntelliHelper/IntelliColorPicker.cpp \
|
IntelliHelper/IntelliColorPicker.cpp \
|
||||||
|
IntelliHelper/IntelliDatamanager.cpp \
|
||||||
IntelliHelper/IntelliRenderSettings.cpp \
|
IntelliHelper/IntelliRenderSettings.cpp \
|
||||||
IntelliHelper/IntelliToolsettings.cpp \
|
IntelliHelper/IntelliToolsettings.cpp \
|
||||||
IntelliHelper/IntelliTriangulation.cpp \
|
IntelliHelper/IntelliTriangulation.cpp \
|
||||||
@@ -43,6 +44,7 @@ HEADERS += \
|
|||||||
Image/IntelliRasterImage.h \
|
Image/IntelliRasterImage.h \
|
||||||
Image/IntelliShapedImage.h \
|
Image/IntelliShapedImage.h \
|
||||||
IntelliHelper/IntelliColorPicker.h \
|
IntelliHelper/IntelliColorPicker.h \
|
||||||
|
IntelliHelper/IntelliDatamanager.h \
|
||||||
IntelliHelper/IntelliRenderSettings.h \
|
IntelliHelper/IntelliRenderSettings.h \
|
||||||
IntelliHelper/IntelliToolsettings.h \
|
IntelliHelper/IntelliToolsettings.h \
|
||||||
IntelliHelper/IntelliTriangulation.h \
|
IntelliHelper/IntelliTriangulation.h \
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "Tool/IntelliToolRectangle.h"
|
#include "Tool/IntelliToolRectangle.h"
|
||||||
#include "Tool/IntelliToolFloodFill.h"
|
#include "Tool/IntelliToolFloodFill.h"
|
||||||
#include "Tool/IntelliToolPolygon.h"
|
#include "Tool/IntelliToolPolygon.h"
|
||||||
|
#include "GUI/IntelliPhotoGui.h"
|
||||||
|
|
||||||
LayerObject::LayerObject(){
|
LayerObject::LayerObject(){
|
||||||
|
|
||||||
@@ -64,6 +65,10 @@ void PaintingArea::setRenderSettings(bool isFastRenderingOn){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PaintingArea::getRenderSettings(){
|
||||||
|
return this->renderSettings.isFastRenderering();
|
||||||
|
}
|
||||||
|
|
||||||
void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
||||||
//set standart parameter
|
//set standart parameter
|
||||||
this->maxWidth = maxWidth;
|
this->maxWidth = maxWidth;
|
||||||
@@ -75,19 +80,27 @@ void PaintingArea::setLayerDimensions(int maxWidth, int maxHeight){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
|
void PaintingArea::setPixelToActive(QColor color, QPoint point){
|
||||||
|
layerBundle[static_cast<size_t>(activeLayer)].image->drawPixel(point, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PaintingArea::setPolygonDataToActive(std::vector<QPoint> points){
|
||||||
|
layerBundle[static_cast<size_t>(activeLayer)].image->setPolygon(points);
|
||||||
|
}
|
||||||
|
|
||||||
|
int PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset,int alpha, ImageType type){
|
||||||
LayerObject newLayer;
|
LayerObject newLayer;
|
||||||
updateTools();
|
updateTools();
|
||||||
newLayer.width = width;
|
newLayer.width = width;
|
||||||
newLayer.height = height;
|
newLayer.height = height;
|
||||||
newLayer.widthOffset = widthOffset;
|
newLayer.widthOffset = widthOffset;
|
||||||
newLayer.heightOffset = heightOffset;
|
newLayer.heightOffset = heightOffset;
|
||||||
|
newLayer.alpha = alpha;
|
||||||
if(type==ImageType::RASTERIMAGE) {
|
if(type==ImageType::RASTERIMAGE) {
|
||||||
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
|
newLayer.image = new IntelliRasterImage(width,height,renderSettings.isFastRenderering());
|
||||||
}else if(type==ImageType::SHAPEDIMAGE) {
|
}else if(type==ImageType::SHAPEDIMAGE) {
|
||||||
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
|
newLayer.image = new IntelliShapedImage(width, height, renderSettings.isFastRenderering());
|
||||||
}
|
}
|
||||||
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;
|
||||||
historyadd();
|
historyadd();
|
||||||
@@ -155,6 +168,13 @@ bool PaintingArea::open(const QString &filePath){
|
|||||||
return open;
|
return open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintingArea::deleteAllLayers(){
|
||||||
|
for(auto layer: layerBundle){
|
||||||
|
delete layer.image;
|
||||||
|
}
|
||||||
|
layerBundle.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Save the current image
|
// Save the current image
|
||||||
bool PaintingArea::save(const QString &filePath, const char*fileFormat){
|
bool PaintingArea::save(const QString &filePath, const char*fileFormat){
|
||||||
if(layerBundle.size()==0) {
|
if(layerBundle.size()==0) {
|
||||||
@@ -455,6 +475,10 @@ QImage PaintingArea::getImageDataOfActiveLayer(){
|
|||||||
return returnImage;
|
return returnImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<LayerObject>* PaintingArea::getLayerBundle(){
|
||||||
|
return &layerBundle;
|
||||||
|
}
|
||||||
|
|
||||||
void PaintingArea::updateTools(){
|
void PaintingArea::updateTools(){
|
||||||
if(Tool!=nullptr) {
|
if(Tool!=nullptr) {
|
||||||
if(Tool->getIsDrawing()) {
|
if(Tool->getIsDrawing()) {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@
|
|||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "GUI/IntelliPhotoGui.h"
|
|
||||||
#include "Image/IntelliImage.h"
|
#include "Image/IntelliImage.h"
|
||||||
#include "Image/IntelliRasterImage.h"
|
#include "Image/IntelliRasterImage.h"
|
||||||
#include "Image/IntelliShapedImage.h"
|
#include "Image/IntelliShapedImage.h"
|
||||||
@@ -16,7 +15,7 @@
|
|||||||
|
|
||||||
//for unit testing
|
//for unit testing
|
||||||
class UnitTest;
|
class UnitTest;
|
||||||
|
class IntelliPhotoGui;
|
||||||
/*!
|
/*!
|
||||||
* \brief The LayerObject struct holds all the information needed to construct a layer
|
* \brief The LayerObject struct holds all the information needed to construct a layer
|
||||||
*/
|
*/
|
||||||
@@ -83,6 +82,12 @@ PaintingArea(int maxWidth = 600, int maxHeight = 600, QWidget*parent = nullptr);
|
|||||||
*/
|
*/
|
||||||
void setRenderSettings(bool isFastRenderingOn);
|
void setRenderSettings(bool isFastRenderingOn);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief getRenderSettings updates all Images to the new Rendersetting.
|
||||||
|
* \param isFastRenderingOn is the new given flag for the FastRenderer.
|
||||||
|
*/
|
||||||
|
bool getRenderSettings();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The open method is used for loading a picture into the current layer.
|
* \brief The open method is used for loading a picture into the current layer.
|
||||||
* \param filePath - Path and Name which are used to determine where the to-be-opened file is stored.
|
* \param filePath - Path and Name which are used to determine where the to-be-opened file is stored.
|
||||||
@@ -97,16 +102,21 @@ bool open(const QString &filePath);
|
|||||||
*/
|
*/
|
||||||
bool save(const QString &filePath, const char*fileFormat);
|
bool save(const QString &filePath, const char*fileFormat);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief deleteAllLayers deletes all layers
|
||||||
|
*/
|
||||||
|
void deleteAllLayers();
|
||||||
/*!
|
/*!
|
||||||
* \brief The addLayer adds a layer to the current project/ painting area
|
* \brief The addLayer adds a layer to the current project/ painting area
|
||||||
* \param width - Width of the layer in pixles
|
* \param width - Width of the layer in pixles
|
||||||
* \param height - Height of the layer in pixles
|
* \param height - Height of the layer in pixles
|
||||||
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
* \param widthOffset - Offset of the layer measured to the left border of the painting area in pixles
|
||||||
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
* \param heightOffset - Offset of the layer measured to the top border of the painting area in pixles
|
||||||
|
* \param alpha - Transparence of the layer
|
||||||
* \param type - Defining the ImageType of the new layer
|
* \param type - Defining the ImageType of the new layer
|
||||||
* \return Returns the number of layers in the project
|
* \return Returns the number of layers in the project
|
||||||
*/
|
*/
|
||||||
int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, ImageType type = ImageType::RASTERIMAGE);
|
int addLayer(int width, int height, int widthOffset = 0, int heightOffset = 0, int alpha=255, ImageType type = ImageType::RASTERIMAGE);
|
||||||
/*!
|
/*!
|
||||||
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
|
* \brief The addLayerAt adds a layer to the current project/ painting area at a specific position in the layer stack
|
||||||
* \param idx - Index of the position the new layer should be added
|
* \param idx - Index of the position the new layer should be added
|
||||||
@@ -202,12 +212,23 @@ IntelliImage* getImageOfActiveLayer();
|
|||||||
*/
|
*/
|
||||||
QImage getImageDataOfActiveLayer();
|
QImage getImageDataOfActiveLayer();
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief getLayerBundle returns the real active layerbundle (care!)
|
||||||
|
* \return the reference of the currentLayerBundle
|
||||||
|
*/
|
||||||
|
std::vector<LayerObject>* getLayerBundle();
|
||||||
|
|
||||||
IntelliToolsettings Toolsettings;
|
IntelliToolsettings Toolsettings;
|
||||||
IntelliColorPicker colorPicker;
|
IntelliColorPicker colorPicker;
|
||||||
|
|
||||||
void historyGoBack();
|
void historyGoBack();
|
||||||
void historyGoForward();
|
void historyGoForward();
|
||||||
|
|
||||||
|
void setLayerDimensions(int maxWidth, int maxHeight);
|
||||||
|
|
||||||
|
void setPixelToActive(QColor color, QPoint point);
|
||||||
|
|
||||||
|
void setPolygonDataToActive(std::vector<QPoint> points);
|
||||||
public slots:
|
public slots:
|
||||||
/*!
|
/*!
|
||||||
* \brief The slotActivateLayer method handles the event of selecting one layer as active
|
* \brief The slotActivateLayer method handles the event of selecting one layer as active
|
||||||
@@ -229,7 +250,6 @@ void wheelEvent(QWheelEvent*event) override;
|
|||||||
void paintEvent(QPaintEvent*event) override;
|
void paintEvent(QPaintEvent*event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setLayerDimensions(int maxWidth, int maxHeight);
|
|
||||||
void selectLayerUp();
|
void selectLayerUp();
|
||||||
void selectLayerDown();
|
void selectLayerDown();
|
||||||
IntelliTool* copyActiveTool();
|
IntelliTool* copyActiveTool();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "IntelliTool.h"
|
#include "IntelliTool.h"
|
||||||
#include "Layer/PaintingArea.h"
|
#include "Layer/PaintingArea.h"
|
||||||
|
#include "GUI/IntelliPhotoGui.h"
|
||||||
|
|
||||||
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
|
IntelliTool::IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker, IntelliToolsettings* Toolsettings){
|
||||||
this->Area = Area;
|
this->Area = Area;
|
||||||
|
|||||||
Reference in New Issue
Block a user