Merge branch 'Dev' into 'MuckeMachtSachen'

# Conflicts:
#   IntelliPhoto/Painting/GUI/IntelliPhotoGui.h
#   IntelliPhoto/Painting/Image/IntelliShapedImage.cpp
#   IntelliPhoto/Painting/IntelliPhoto.pro.user
#   IntelliPhoto/Painting/Layer/PaintingArea.cpp
#   IntelliPhoto/Painting/Layer/PaintingArea.h
This commit is contained in:
Jonas Mucke
2019-12-05 13:47:52 +00:00
13 changed files with 66 additions and 448 deletions

11
.gitignore vendored
View File

@@ -1,9 +1,2 @@
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpcvzqoi
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpu6gfxp
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpqakvqm
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpcvzqoi
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
# Ignoring build files
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/

View File

@@ -1,9 +0,0 @@
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpcvzqoi
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpu6gfxp
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpqakvqm
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmpcvzqoi
IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/usersjonasappdatalocaltemptmp0l4rts

View File

@@ -61,12 +61,14 @@ void IntelliPhotoGui::open()
// Called when the user clicks Save As in the menu
void IntelliPhotoGui::save()
{
// A QAction represents the action of the user clicking
QAction *action = qobject_cast<QAction *>(sender());
// Stores the array of bytes of the users data
QByteArray fileFormat = action->data().toByteArray();
// Pass it to be saved
saveFile(fileFormat);
}
@@ -216,9 +218,21 @@ void IntelliPhotoGui::createActions()
saveAsActs.append(action);
}
QAction *action = new QAction("PNG-8", this);
// Set an action for each file format
action->setData("PNG");
// When clicked call IntelliPhotoGui::save()
connect(action, SIGNAL(triggered()), this, SLOT(save()));
// Attach each file format option menu item to Save As
saveAsActs.append(action);
// Create exit action and tie to IntelliPhotoGui::close()
exitAct = new QAction(tr("&Exit"), this);
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -392,6 +406,10 @@ bool IntelliPhotoGui::saveFile(const QByteArray &fileFormat)
// Define path, name and default file type
QString initialPath = QDir::currentPath() + "/untitled." + fileFormat;
// Get selected file from dialog
// Add the proper file formats and extensions
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),

View File

@@ -19,10 +19,8 @@ bool IntelliImage::loadImage(const QString &fileName){
if (!loadedImage.load(fileName))
return false;
// scaled Image to size of Layer
// loadedImage = loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
imageData = loadedImage.convertToFormat(QImage::Format_ARGB32);
loadedImage =loadedImage.scaled(imageData.size(),Qt::IgnoreAspectRatio);
imageData= loadedImage.convertToFormat(QImage::Format_ARGB32);
return true;
}

View File

@@ -29,8 +29,8 @@ public:
virtual void floodFill(const QColor& color);
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha)=0;
virtual QImage getDisplayable(int alpha=255)=0;
virtual QImage getDisplayable(const QSize& displaySize)=0;
virtual QImage getDisplayable()=0;
//returns the filtered output

View File

@@ -12,19 +12,12 @@ IntelliRasterImage::~IntelliRasterImage(){
}
QImage IntelliRasterImage::getDisplayable(int alpha){
return getDisplayable(imageData.size(), alpha);
QImage IntelliRasterImage::getDisplayable(){
return getDisplayable(imageData.size());
}
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){
QImage IntelliRasterImage::getDisplayable(const QSize& displaySize){
QImage copy = imageData;
for(int y = 0; y<copy.height(); y++){
for(int x = 0; x<copy.width(); x++){
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y, clr);
}
}
return copy.scaled(displaySize,Qt::IgnoreAspectRatio);
}

View File

@@ -10,8 +10,8 @@ public:
virtual ~IntelliRasterImage() override;
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize,int alpha) override;
virtual QImage getDisplayable(int alpha=255) override;
virtual QImage getDisplayable(const QSize& displaySize) override;
virtual QImage getDisplayable() override;
//sets the data for the visible image

View File

@@ -12,7 +12,7 @@ IntelliShapedImage::~IntelliShapedImage(){
}
QImage IntelliShapedImage::getDisplayable(int alpha){
QImage IntelliShapedImage::getDisplayable(){
return getDisplayable(imageData.size());
}
@@ -49,10 +49,6 @@ QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){
QColor tmpColor(0,0,0);
tmpColor.setAlpha(0);
copy.setPixelColor(startPoint,tmpColor);
}else{
QColor clr = copy.pixelColor(x,y);
clr.setAlpha(alpha);
copy.setPixelColor(x,y,clr);
}
}
}

View File

@@ -12,8 +12,8 @@ public:
virtual ~IntelliShapedImage() override;
//returns the filtered output
virtual QImage getDisplayable(const QSize& displaySize, int alpha=255) override;
virtual QImage getDisplayable(int alpha=255) override;
virtual QImage getDisplayable(const QSize& displaySize) override;
virtual QImage getDisplayable() override;
//sets the data for the visible image
virtual void setPolygon(const std::vector<QPoint>& polygonData) override;

View File

@@ -1,337 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-12-03T16:32:34. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{2eff11b9-2504-4003-b4ce-30c119b76df9}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.12.5 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.12.5 MSVC2017 64bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5125.win64_msvc2017_64_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Erstellen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Bereinigen</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deployment-Konfiguration</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">IntelliPhoto</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/Painting/IntelliPhoto.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.10.2, 2019-12-03T16:12:45. -->
<!-- Written by QtCreator 4.10.2, 2019-11-28T16:37:27. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>

View File

@@ -1,17 +1,25 @@
// ---------- PaintingArea.cpp ----------
#include <QtWidgets>
#include <QRect>
#include<QRect>
#include "PaintingArea.h"
#include "Image/IntelliRasterImage.h"
#include "Image/IntelliShapedImage.h"
#include <vector>
#include <QPoint>
#include<vector>
#include<QPoint>
PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
:QWidget(parent){
this->setUp(maxWidth, maxHeight);
PaintingArea::PaintingArea(QWidget *parent)
: QWidget(parent)
{
//create standart image
this->image = new IntelliRasterImage(400,400);
std::vector<QPoint> poly;
poly.push_back(QPoint(200,0));
poly.push_back(QPoint(400,300));
poly.push_back(QPoint(0,300));
poly.push_back(QPoint(200,0));
image->setPolygon(poly);
//tetsing
this->addLayer(200,200,0,0,ImageType::Shaped_Image);
@@ -29,17 +37,7 @@ PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent)
activeLayer=1;
}
void PaintingArea::setUp(int maxWidth, int maxHeight){
//set standart parameter
this->maxWidth = maxWidth;
this->maxHeight = maxHeight;
Canvas = new QImage(maxWidth,maxHeight, QImage::Format_ARGB32);
Canvas->fill(Qt::GlobalColor::white);
void PaintingArea::setUp(){
// Roots the widget to the top left even if resized
setAttribute(Qt::WA_StaticContents);
@@ -47,16 +45,13 @@ void PaintingArea::setUp(int maxWidth, int maxHeight){
scribbling = false;
myPenWidth = 1;
myPenColor = Qt::blue;
}
void PaintingArea::addLayer(int width, int height, int widthOffset, int heightOffset, ImageType type){
LayerObject newLayer;
newLayer.width = width;
newLayer.height = height;
newLayer.widthOffset = widthOffset;
newLayer.heightOffset = heightOffset;
PaintingArea::PaintingArea(int width, int height, ImageType type, QWidget *parent)
: QWidget(parent){
if(type==ImageType::Raster_Image){
newLayer.image = new IntelliRasterImage(width,height);
this->image = new IntelliRasterImage(width, height);
}else if(type==ImageType::Shaped_Image){
newLayer.image = new IntelliShapedImage(width, height);
}
@@ -72,19 +67,9 @@ void PaintingArea::deleteLayer(int index){
activeLayer--;
}
}
this->setUp();
}
void PaintingArea::setLayerToActive(int index) {
if(index<layerStructure.size()){
this->activeLayer=index;
}
}
void PaintingArea::setAlphaToLayer(int index, int alpha){
if(index<layerStructure.size()){
layerStructure[index].alpha=alpha;
}
}
QPixmap PaintingArea::getAsPixmap(){
assembleLayers();
@@ -94,11 +79,7 @@ QPixmap PaintingArea::getAsPixmap(){
// Used to load the image and place it in the widget
bool PaintingArea::openImage(const QString &fileName)
{
if(this->activeLayer==-1){
return false;
}
IntelliImage* active = layerStructure[activeLayer].image;
bool open = active->loadImage(fileName);
bool open = image->loadImage(fileName);
update();
return open;
}
@@ -206,7 +187,6 @@ void PaintingArea::mousePressEvent(QMouseEvent *event)
// from the last position to the current
void PaintingArea::mouseMoveEvent(QMouseEvent *event)
{
if ((event->buttons() & Qt::LeftButton) && scribbling){
if(this->activeLayer==-1){
return;
@@ -258,26 +238,17 @@ void PaintingArea::paintEvent(QPaintEvent *event)
// to cut down on the need to resize the image
void PaintingArea::resizeEvent(QResizeEvent *event)
{
if(this->activeLayer==-1){
return;
}
LayerObject active = layerStructure[activeLayer];
QPainter painter(this);
QRect dirtyRec(QPoint(0,0), event->size());
painter.drawImage(dirtyRec, active.image->getDisplayable(event->size(), active.alpha), dirtyRec);
painter.drawImage(dirtyRec, image->getDisplayable(event->size()), dirtyRec);
update();
//QWidget::resizeEvent(event);
}
void PaintingArea::drawLineTo(const QPoint &endPoint)
{
//// Used to draw on the widget
if(this->activeLayer==-1){
return;
}
LayerObject active = layerStructure[activeLayer];
active.image->drawLine(lastPoint, endPoint,myPenColor, myPenWidth);
// Used to draw on the widget
image->drawLine(lastPoint, endPoint,myPenColor, myPenWidth);
lastPoint = endPoint;
update();
}

View File

@@ -7,7 +7,6 @@
#include"Image/IntelliImage.h"
#include <QPoint>
#include <QWidget>
#include <QList>
class PaintingArea : public QWidget
{
@@ -17,24 +16,19 @@ class PaintingArea : public QWidget
Q_OBJECT
public:
PaintingArea(int maxWidth=1000, int maxHeight=800, QWidget *parent = nullptr);
//create raster image 400*200
PaintingArea(QWidget *parent = nullptr);
PaintingArea(int width, int height, ImageType type, QWidget *parent = nullptr);
// Handles all events
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
void addLayer(int width, int height, int widthOffset=0, int heightOffset=0, ImageType type = ImageType::Raster_Image);
void deleteLayer(int index);
void setLayerToActive(int index);
void setAlphaToLayer(int index, int alpha);
void setPenColor(const QColor &newColor);
void setPenWidth(int newWidth);
// Has the image been modified since last save
bool isModified() const { return modified; }
void setPenColor(const QColor &newColor);
QColor penColor() const { return myPenColor; }
void setPenWidth(int newWidth);
int penWidth() const { return myPenWidth; }
@@ -53,7 +47,7 @@ public slots:
void getMoveLayerUp();
void getMoveLayerDown();
//void setUp helper for konstruktor
void setUp(int maxWidth, int maxHeight);
void setUp();
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
@@ -101,6 +95,7 @@ private:
QColor myPenColor;
// Stores the image being drawn
IntelliImage* image;
// Stores the location at the current mouse event
QPoint lastPoint;