diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eee3c07 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# Build folder +IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug/ + +# macOS Environment Files +.DS_STORE diff --git a/Abgabe/Aufgabe 1/Req0001/Req_0001A.txt b/Abgabe/Aufgabe 1/Req0001/Req_0001A.txt deleted file mode 100644 index ce4e8a4..0000000 --- a/Abgabe/Aufgabe 1/Req0001/Req_0001A.txt +++ /dev/null @@ -1,58 +0,0 @@ -Req-ID: - 0001A -Req-Type: - Nicht-Funktional -Events/UCs: - -Speicherung eines Bildes - -Pixel wird mit einem Byte dargestellt - -Overhead für Metainformationen erlaubt - -Keine seperate abhandlung von "RasterImage" und "ShapedImage" -Description: - -Ein Bild wird mit maximal einem Byte pro Pixel kodiert - -Repräsentation im folgenden: - 0b0000'0000, wobei die 0 nach dem Prefix 0b als Bit 7 Indiziert ist, und jedes rechtere Bit - davon um eins Dekrementiert Indiziert wird - -Minimale RGB-A Darstellung des Bildes mittel einem Byte - -Codierungsmöglichkeit nach folgendem Schema: - -Bit 7,6 werden Benutz um den Alpha-Kanal zu codieren: - -0b00 -> Bit ist 100% Transparent (Transparent) - -0b01 -> Bit ist 66% Transparent - -0b10 -> Bit ist 33% Transparent - -0b11 -> Bit ist 0% Transparent - -Bit 5,4 werden Benutz um den Rot-Kanal zu codieren: - -0b00 -> Bit ist 0% Rot (Schwarz) - -0b01 -> Bit ist 33% Rot - -0b10 -> Bit ist 66% Rot - -0b11 -> Bit ist 100% Rot (Rot) - -Bit 3,2 werden Benutz um den Grün-Kanal zu codieren: - -0b00 -> Bit ist 0% Grün (Schwarz) - -0b01 -> Bit ist 33% Grün - -0b10 -> Bit ist 66% Grün - -0b11 -> Bit ist 100% Grün (Grün) - -Bit 1,0 werden Benutz um den Blau-Kanal zu codieren: - -0b00 -> Bit ist 0% Blau (Schwarz) - -0b01 -> Bit ist 33% Blau - -0b10 -> Bit ist 66% Blau - -0b11 -> Bit ist 100% Blau (Blau) - Definitionen der benutzen Farben nach RGB-A Modell: - Schwarz (0b0000'0000, 0b0000'0000, 0b0000'0000, 0b1111'1111) - Rot (0b1111'1111, 0b0000'0000, 0b0000'0000, 0b1111'1111) - Grün (0b0000'0000, 0b1111'1111, 0b0000'0000, 0b1111'1111) - Blau (0b0000'0000, 0b0000'0000, 0b1111'1111, 0b1111'1111) - Transparent (0b0000'0000, 0b0000'0000, 0b0000'0000, 0b0000'0000) - -verschiedene Transparenzstufen, bis auf 0b11, werden als einzelne Farbstufen gezählt: 2^(8)-1 verschiede Farbstufen -Originator: - Jonas Mucke -Fit Criterion: - -Darstellung von mindestens 250 paarweise verschiedenen Farbstufen - -Darstellung einen transparenten Bits (Alpha Kanal = 0b0000'0000) - -Verarbeitungsmöglichkeit für 2^10 Pixel in unter 0.1 Sekunde beim Einlesen und Speichern -Priority: - 100 -Support Material: - Ubungsblat_01.pdf -Conflicts: - Noch keine Einigung auf Farbkodierung (0001A-0001C)-> Rücksprache mit dem Kunden - (Ein Byte deckt einen sehr kleinen Farbbereich ab und ist nicht sehr elegant -> Rücksprache mit dem Kunden ob 4 Byte akzeptabel wären) -History: - -Erstellt am 30.10.2019 um 21:59, von Jonas Mucke diff --git a/Abgabe/Aufgabe 1/Req0001/Req_0001B.txt b/Abgabe/Aufgabe 1/Req0001/Req_0001B.txt deleted file mode 100644 index 906b810..0000000 --- a/Abgabe/Aufgabe 1/Req0001/Req_0001B.txt +++ /dev/null @@ -1,35 +0,0 @@ -Req-ID: - 0001B -Req-Type: - Nicht-Funktional -Events/UCs: - -Speicherung eines Bildes - -Pixel wird mit einem Byte dargestellt - -Overhead für Metainformationen erlaubt - -Keine seperate abhandlung von "RasterImage" und "ShapedImage" -Description: - -Ein Bild wird mit maximal einem Byte pro Pixel kodiert - -Repräsentation im folgenden: - 0b0000'0000, wobei die 0 nach dem Prefix 0b als Bit 7 Indiziert ist, und jedes rechtere Bit - davon um eins Dekrementiert Indiziert wird - -Codierungsmöglichkeit nach folgendem Schema: - -0b0000'0000, wird als Transparents-Codierung definiert - -Alle weiteren Binären Codierung werden per Hand, in Abstimmung mit dem Kunden und dem Team, - einer Farbe zugeordnet -> 2^(8)-1 mögliche Farben + Transparenz - Definitionen der benutzen Farben nach RGB-A Modell: - Transparent (0b0000'0000, 0b0000'0000, 0b0000'0000, 0b0000'0000) -Originator: - Jonas Mucke -Fit Criterion: - -Darstellung von mindestens 250 paarweise verschiedenen Farbstufen - -Darstellung einen transparenten Bits (Alpha Kanal = 1) - -Verarbeitungsmöglichkeit für 2^10 Pixel in unter 0.1 Sekunde beim Einlesen und Speichern -Priority: - 100 -Support Material: - Ubungsblat_01.pdf -Conflicts: - Noch keine Einigung auf Farbkodierung (0001A-0001C)-> Rücksprache mit dem Kunden - (Ein Byte deckt einen sehr kleinen Farbbereich ab und ist nicht sehr elegant -> Rücksprache mit dem Kunden ob 4 Byte akzeptabel wären) -History: - -Erstellt am 30.10.2019 um 21:58, von Jonas Mucke diff --git a/Abgabe/Aufgabe 1/Req0001/Req_0001C.txt b/Abgabe/Aufgabe 1/Req0001/Req_0001C.txt deleted file mode 100644 index b847c41..0000000 --- a/Abgabe/Aufgabe 1/Req0001/Req_0001C.txt +++ /dev/null @@ -1,64 +0,0 @@ -Req-ID: - 0001C -Req-Type: - Nicht-Funktional -Events/UCs: - -Speicherung eines Bildes - -Pixel wird mit einem Byte dargestellt - -Overhead für Metainformationen erlaubt - -Keine seperate abhandlung von "RasterImage" und "ShapedImage" -Description: - -Ein Bild wird mit maximal einem Byte pro Pixel kodiert - -Repräsentation im folgenden: - 0b0000'0000, wobei die 0 nach dem Prefix 0b als Bit 7 Indiziert ist, und jedes rechtere Bit - davon um eins Dekrementiert Indiziert wird - -Die Bits 7,6 werden benutzt um einen Farbchannel zu setzen. Bei einem Farbchannel handelt es sich um einen - Schalter, welcher zwischen den Channeln "Rot", "Grün", "Blau", "Grau/Alpha" Handelt. - Wenn ein Channel gesetzt ist, für ein Pixel, so wird dieses Pixel nur mittels einer Farbstufe dieses Channels - Dargestellt. - -Codierungsmöglichkeit nach folgendem Schema: - -0b00XX'XXXX entspricht dem "Grau/Alpha" Channel - 0b0000'0000 entspricht dem Transparenzwert 100% (Transparent) - 0b0000'0001 enstpricht den Farbwert Schwarz (Schwarz) - 0b0011'1111 enstpricht dem Farbwert Weiß (Weiß) - Dazwischen exestiert eine uniform partitionierte Farbkurve - -0b01XX'XXXX entspricht dem "Rot" Channel: - 0b0111'1111 entspricht dem intensivstem Rot(Rot) - 0b0100'0000 enstpricht dem blasesten Rot(Schwarz-Rot) - Dazwischen exestiert eine uniform partitionierte Farbkurve - -0b10XX'XXXX entspricht dem "Grün" Channel: - 0b1011'1111 entspricht dem intensivstem Grün (Grün) - 0b1000'0000 enstpricht dem blasesten Grün(Schwarz-Grün) - Dazwischen exestiert eine uniform partitionierte Farbkurve - -0b11XX'XXXX entspricht dem "Blau" Channel: - 0b1111'1111 entspricht dem intensivstem Blau (Blau) - 0b1100'0000 enstpricht dem blasesten Blau(Schwarz-Blau) - Dazwischen exestiert eine uniform partitionierte Farbkurve - Definitionen der benutzen Farben nach RGB-A Modell: - Weiß (0b1111'1111, 0b1111'1111, 0b1111'1111, 0b1111'1111) - Schwarz (0b0000'0000, 0b0000'0000, 0b0000'0000, 0b1111'1111) - Rot (0b1111'1111, 0b0000'0000, 0b0000'0000, 0b1111'1111) - Grün (0b0000'0000, 0b1111'1111, 0b0000'0000, 0b1111'1111) - Blau (0b0000'0000, 0b0000'0000, 0b1111'1111, 0b1111'1111) - (Schwarz-Rot) (0b0000'0001, 0b0000'0000, 0b0000'0000, 0b1111'1111) - (Schwarz-Grün) (0b0000'0000, 0b0000'0001, 0b0000'0000, 0b1111'1111) - (Schwarz-Blau) (0b0000'0000, 0b0000'0000, 0b0000'0001, 0b1111'1111) - Transparent (0b0000'0000, 0b0000'0000, 0b0000'0000, 0b0000'0000) - -Nach diesem Prinzip können nur die Grundfarben der Additiven Farbdarstellung projeziert werden, - dies hat ein sehr bunt beschränktes Farbshema zur folgendem - -Es können insgesamt [3*2^(6)]+[2^(6)-1] = 2^(8)-1 Farbstufen dargestellt werden + Transparenz -Originator: - Jonas Mucke -Fit Criterion: - -Darstellung von mindestens 250 paarweise verschiedenen Farbstufen - -Darstellung einen transparenten Bits (Alpha Kanal = 1) - -Verarbeitungsmöglichkeit für 2^10 Pixel in unter 0.1 Sekunde beim Einlesen und Speichern -Priority: - 100 -Support Material: - Ubungsblat_01.pdf -Conflicts: - Noch keine Einigung auf Farbkodierung (0001A-0001C)-> Rücksprache mit dem Kunden - (Ein Byte deckt einen sehr kleinen Farbbereich ab und ist nicht sehr elegant -> Rücksprache mit dem Kunden ob 4 Byte akzeptabel wären) -History: - -Erstellt am 30.10.2019 um 22:04, von Jonas Mucke diff --git a/Abgabe/Aufgabe 1/Req0002/Req_0002.txt b/Abgabe/Aufgabe 1/Req0002/Req_0002.txt deleted file mode 100644 index dc98763..0000000 --- a/Abgabe/Aufgabe 1/Req0002/Req_0002.txt +++ /dev/null @@ -1,64 +0,0 @@ -Req-ID: - 0002 -Req-Type: - Funktional -Events/UCs: - -Bearbeitung des Bildes mit einer Betriebssystem unterstützen Eingabemöglichkeit, zum Beispiel Maus oder Stift bzw. Ähnliche - -Bearbeitung mittels verschiedener Zeichen-Tools - -Freiwählbare Farbe aus dem möglichen Farbbereich -Description: - -Ein Farbwert, auch Transparent, welcher durch die genutzte Codierung (siehe Req_0001) darstellbar sein. Dies soll mittels Tools - gesetzt werden können, wobei diese spezifizieren was "gesetzt" bedeutet. - -Tools: - Pinsel: - -Der Pinsel ist ein Tool, welches um seinen Mittelpunkt alles in einem gewissen Pixelradius einfärbt. - Der Pixelradius geht dabei von 1-Pixel bis zu 10-Pixel. - Formen: - -Linie: - Das Tool Formen (Linie), soll es einem ermöglichen eine Linie in der gewählten Farbe zwischen 2 Punkten zu - ziehen. Dabei wird am ersten Punkt angesetzt und zum Zielpunkt gezogen, dabei verändert sich die Linie live. - Sobald das Eingabegerät getogglet wird, so wird die aktuelle Stelle als Endpunkt angenommen. Zwischen - Start und Endpunkt wird die Linie gezeichnet. - Es exestieren verschiedene Linien-Formen: - -durchgezogene Linie (eine Linie ohne Lücken) - -gestrichelte Linie (auf der Linie werden nur Striche in regelmäßigen Abständen gezeichnet) - -gepunktete Linie (auf der Linie wird punktweise zwischen Farbig und Transparent alterniert) - Die Linie kann mittels dem Breite-Attribut verändert werden (Breite zwischen 1 und 10 Pixel) - -Rechteck: - Das Tool Formen (Rechteck), soll es einem ermöglichen ein Rechteck in ein einer gewählten Farbe aufzuspannen. - Dabei wird am ersten Punkt angesetzt und zum Zielpunkt gezogen. Dabei verändert sich das Rechteck live. - Sobald das Eingabegerät getogglet wird, so wird die aktuelle Stelle als Endpunkt angenommen. Zwiscehn Start und Endpunkt - wird das Rechteck aufgespannt. - Das Rechteck besitzt 2 Farbattribute, den Rand und die Füllung. Der Rand ist um das Rechteck gesetzt und kann - im Bezug auf Breite und Farbe eingesetellt werden. Die Füllung ist innerhalb der Fläche, welcher vom Rand aufgespannt wird, - und kann im Bezug auf die Farbe eingestellt werden. - -Konvexe Form: - Das Tool Formen (Konvex), soll einem ermöglichen beliebige, konvexe Formen zu erstellen. - Dabei werden Punkte gesetzt, welche durch toggeln des Eingabegeräts, an der Stelle des Cursors gesetzt werden. - Sollte ein Punkt im Radius von 10 Pixel zum Startpunkt sein, so wird die Erstellung abgeschlossen. Danach werden Linien - zwischen den gesetzten Punkten (in korrekter Reihenfolge) gezeichnet und der Zwischenraum gefüllt. - Dabei besitzt die konvexe Form 2 Farbattribute, den Rand und die Füllung. Der Rand ist um die konvexe Form - gesetzt und kann im Bezug auf Breite und Farbe eingesetellt werden. Die Füllung ist innerhalb der Fläche, welche durch den Rand - aufgespannt wird, und kann im Bezug auf die Farbe eingestellt werden. - FloodFill: - -Das Floodfill Tool, bei diesem wird ein Pixel ausgewählt. Alle Pixel die mit diesem Pixel in einer Äquivalenzklasse - im Bezug auf Farbe und Nachbarschafts-Relation stehen, werden in die gewählte Farbe eingefärbt. - Einfarbig: - -Das Einfarbig Tool färbt das gesamte Bild in die gewählte Farbe ein. - Reverse: - -Der letzte State des Bildes wird wieder hergestellt. (Speicherung von mindestens 10 alten Zuständen). -Originator: - Jonas Mucke -Fit Criterion: - -Das Setzten eines Pixels, in einer beliebigen Farbe, funktioniert in 99,9% in unter 0.01 Sekunden. - -Der Vollständige Farbbreich ist frei wählbar. - -Es müssen mindestens 3 Tools benutzbar sein, das bedeutet eine 99,9% richtiges Verhalten in unter 0.1 Sekunden. - -Tools besitzen in 100% der Fälle das gewünschte Verhalten -Priority: - 80 -Support Material: - Ubungsblat_01.pdf -Conflicts: - -keine Bekannten Konflikte(stand: 30.10.2019 22:10) -History: - -Erstellt am 30.10.2019 um 22:10, von Jonas Mucke diff --git a/Abgabe/Aufgabe 2/Klassen_Verantwortlichkeiten_und_Kollaborationen.txt b/Abgabe/Aufgabe 2/Klassen_Verantwortlichkeiten_und_Kollaborationen.txt deleted file mode 100644 index 6c77ca5..0000000 --- a/Abgabe/Aufgabe 2/Klassen_Verantwortlichkeiten_und_Kollaborationen.txt +++ /dev/null @@ -1,303 +0,0 @@ -Klasse: Bild (abstrakt) - Vererbung: - - - Verantwortlichkeiten: - - Speicherung der Daten in einem 2d-Array - - Speicherung der Farbdaten jedes einzelnen Pixels - Kollaborationen: - - Der Anwender will ein Bild öffnen und speichern können, ohne sich darüber Gedanken machen zu müssen - -Klasse: Bilddimensionen - Vererbung: - - Bild - Verantwortlichkeiten: - - Wissen über die Größe des Bildes - Kollaborationen: - - Nutzer kann die Anzahl der Pixel in x und y Richtung abfragen - -Klasse: RasterImage - Vererbung: - - Bild - Verantwortlichkeiten: - - Darstellung des gezeichneten Bildes - - Speicherung der Daten in einem 2d-Array - - Speicherung der Farbdaten jedes einzelnen Pixels (je ein Bit pro Pixel) - Kollaborationen: - - Der Anwender will ein Bild öffnen, bearbeiten und speichern können, ohne sich darüber Gedanken machen zu müssen - -Klasse: ShapedImage - Vererbung: - - RasterImage - Verantwortlichkeiten: - - Speicherung der Daten in einem 2d-Array - - Speicherung der Farbdaten jedes einzelnen Pixels -> Transparenz - - Speicherung der Polygondaten - - Darstellung der Transparenz außerhalb des Polygons und des Bildes innerhalb des Polygons - Kollaborationen: - - Der Anwender will ein Bild öffnen, bearbeiten und speichern können, ohne sich darüber Gedanken machen zu müssen - -Klasse: Tool (abstrakt) - Vererbung: - - - Verantwortlichkeiten: - - Name, Beschreibung, Tooltip und Icon des Tools speichern - - Veränderung der Pixeldaten des Bildes - Kollaborationen: - - Der Anwender will ein Bild bearbeiten können - -Klasse: Set-Color-Tool (abstrakt) - Vererbung: - - Tool - Verantwortlichkeiten: - - Verwalten der Farbcodierung und deren Darstellung - - Bearbeiten des Bildes durch Verändern von Farbcodes an bestimmten Pixeln - - Darstellung der Farbpallette - Kollaborationen: - - Der Anwender möchte das Bild farblich gezielt verändern - - Der Anwender möchte die Farbwerte der einzelnen Pixel abfragen - -Klasse: Un-/Redo-Tool - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - 20 Operationen speichern - - die letzten (bis zu 10) Änderungen rückgängig machen - - die letzten (bis zu 10) Undo-Aufforderungen rückgängig machen - - sobald gezeichnet wird, werden alle Redo-Einträge gelöscht - Kollaborationen: - - Der Anwender möchte eine Tool Änderung rückgängig machen - - Der Anwender möchte eine Undo Aktivität rückgängig machen - -Klasse: Dreh-Tool - Vererbung: - - Tool - Verantwortlichkeiten: - - Rotation des angezeigten Bildes - - Ändern der Farbwerte, so dass sie mit dem rotierten Bild übereinstimmen - Kollaborationen: - - Möglichkeit für den Nutzer das Bild zu drehen - - Der Anwender möchte das Bild gedreht speichern - -Klasse: Size-Tool - Vererbung: - - Tool - Verantwortlichkeiten: - - Vergrößerung des Bildes (Werte) - - Verkleinerung des Bildes (Werte) - - Skalieren - Kollaborationen: - - Der Anwender möchte die Auflösung des Bildes vergrößern - - Der Anwender möchte die Auflösung des Bildes verkleinern - - -Klasse: Merge-Tool - Vererbung: - - Tool - Verantwortlichkeiten: - - Das Zusammenfügen zweier Bilder in eine neue Datei (Abspeichern der neuen Farbwerte) - - Das Zusammenfügen übereinander oder nebeneinander (wenn Alpha-Kanal vorhanden) - Kollaborationen: - - Der Anwender möchte ein Bild neben einem anderen Bild speichern - - Der Anwender möchte ein Bild über einem anderen speichern - -Klass: View-Tool(abstrakt) - Vererbung: - -Tool - Verantwortlichkeiten: - -Verändern der Ansicht des Bilder - Kollaborationen: - -Der User möchte das Bild anders Anzeigen lassen - -Klasse: Zoom-Tool - Vererbung: - - View-Tool - Verantwortlichkeiten: - - Vergrößerung des Bildes (Ansicht) - - Verkleinerung des Bildes (Ansicht) - - Zoomen - Kollaborationen: - - Der Anwender möchte in ein Bild zoomen - - Der Anwender möchte aus dem Bild heraus zoomen - -Klasse: Merge-View-Tool - Vererbung: - - View-Tool - Verantwortlichkeiten: - - Das Anzeigen zweier Bilder in der Datei - Kollaborationen: - - Der Anwender möchte ein Bild neben einem anderen Bild anzeigen - - Der Anwender möchte ein Bild über einem anderen anzeigen lassen - -Klasse: Pen-Tool - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - Speicherung des eingestellten Radius - - Setzen von Pixelwerten um die Cursor-Stelle in einen auswählbaren Radius in einer auswählbaren Farbe - Kollaborationen: - - Der Anwender möchte Freihand in einer freiwählbaren Farbe in einem freiwählbaren Radius zeichnen, ohne Beschränkung innerhalb des Bildes - -Klasse: FloodFill-Tool - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - alle Pixel in einer Äquivalenzklasse zum aktuellen Pixel in eine freiwählbare Farbe einfärben - Kollaborationen: - - Der Anwender möchte eine Fläche einer Farbe komplett umfärben - -Klasse: Plain-Tool - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - alle Pixel des Bildes in eine Farbe ändern - Kollaborationen: - - Der Anwender möchte das Bild einfarbig einfärben - -Klasse: Formen-Tool (abstrakt) - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - Zeichnen eines geometrischen Primitives - - vereinheitlichte Darstellung der Formauswahl und Ränder - Kollaborationen: - - Der Anwender möchte ein/e Rechteck/Linie oder eine konvexe Form zeichnen - -Klasse: Linien-Tool - Vererbung: - - Formen-Tool - Verantwortlichkeiten: - - Zeichnen einer Linie in einer wählbaren Dicke und Farbe - - Die Linie kann durchgängig, gestrichelt oder gepunktet gezeichnet werden - Kollaborationen: - - Der Anwender möchte eine durchgezogene Linie zeichnen - - Der Anwender möchte eine gestrichelte Linie zeichnen - - Der Anwender möchte eine gepunktete Linie zeichnen - -Klasse: Rechteck-Tool - Vererbung: - - Formen-Tool - Verantwortlichkeiten: - - Aufspannen eines Rechtecks zwischen zwei Punkten, der Rand und die Fläche sind in der Farbe frei wählbar, - diese Wählbarkeit ist separat vom anderen Zustand möglich - - Der Rand kann in der Dicke eingestellt werden - Kollaborationen: - - Der Anwender möchte ein Rechteck zeichnen, die innere Fläche soll Transparenz speichern - - Der Anwender möchte ein Rechteck zeichnen, die innere Fläche soll eine Farbe haben, der Rand soll eine gewisse Breite und Farbe haben - -Klasse: Konvexe-Form-Tool - Vererbung: - - Formen-Tool - Verantwortlichkeiten: - - Aufspannen einer konvexen Form mittels Punkten (max 100) - - Die konvexe Form hat einen Rand und eine interne Fläche, deren Farbe separat gewählt werden kann - - Der Rand kann im Bezug auf seine Dicke eingestellt werden - Kollaborationen: - - Der Anwender möchte ein n-Eck zeichnen, dazu berührt er auf dem Bildschirm n-Punkte und am Schluss den Anfangspunkt (10pxl Radius?) - - In der berührten Reihenfolge werden Linien gezogen, die die Form aufspannen und je nach Einstellungen wird der Rand und die interne Fläche dargestellt - -Klasse: Polygon-Form-Tool - Vererbung: - - Formen-Tool - Verantwortlichkeiten: - - Aufspannen eines Polygons über das Bild - - Das Polygon hat einen Rand und eine interne Fläche, deren Farbe separat gewählt werden kann - - Der Rand kann im Bezug auf seine Dicke eingestellt werden - Kollaborationen: - - Der Anwender möchte ein Polygon zeichnen - -Klasse: Kreis-Tool - Vererbung: - - Set-Color-Tool - Verantwortlichkeiten: - - Erstellen einer Kreisform in dem man den Mittelpunkt bestimmt und zwei Radien festlegen kann (NS und WO Radius) - - Die Dicke des Randes des Kreises ist freiwählbar, sowie die Art des Randes (Gepunktet, etc.), genauso wie die Farbe des Kreises und des Randes - Kollaborationen: - - Der Anwender möchte einen beliebigen Kreis und eine beliebige Ellipse zeichnen können - -Klasse: Selection-Tool(abstrakt) - Vererbung: - -Tool - Verantwortlichkeiten: - -Auswählen von einem Bereich(beliebiger Bereich) - Kollaborationen: - - Der Anwender möchte ein Bereich Auswählen (quadratisch) - -Klasse: Cut-Tool - Vererbung: - -Selection-Tool - Verantwortlichkeiten: - -Auswählen von Bildern und das ausschneiden dieser - Kollaborationen - - Der Anwender möchte ein Bild auswählen und bewegen oder löschen - -Klasse: Korrektur-Tool(abstrakt) - Vererbung: - -Tool - Verantwortlichkeiten: - -Verändern von Bild Daten (Korrektur) - Kollaborationen: - -Der Anwender möchte ein Bild verändern und dies mit Korrektur - -Klasse: Helligkeits-Tool - Vererbung: - Korrektur-Tool - Verantwortlichkeiten - Verändert die Helligkeits Werte - Kollaboration: - Der Anwender möchte das Bild verdunkeln oder aufhellen - -Klasse: Farbton-Tool - Vererbung: - Korrektur-Tool - Verantwortlichkeiten: - Verändert die Sättigung von Farbdaten - Kollaborationen: - Der User möchte ein Bild sättigen oder verblassen - -Klasse: Gradations-Tool - Vererbung: - Korrektur-Tool: - Verantwortlichkeiten: - Setzen einer Gradationskurve - Kollaboration: - Der User möchte eine Gradationskurve eines Farbschemas Erstellen - -Klasse: 3D-Objekt - Vererbung: - - - Verantwortlichkeiten: - -Wissen über die Vertices und das Managen dieser - Kollaborationen: - -Der User möchte ein 3D Objekt laden - -Klassen: 3D-Inspector - Vererbung: - - - Verantwortlichkeiten: - -Darstellen eines 3D Objekts und der Projezierung (RayTracer) - Kollaborationen: - -Der User möchte ein 3D Objekt auf das Layer projezieren - -Klasse: Layer - Vererbung: - - - Verantwortlichkeiten: - -Darstellung eines Bildes und Sichtbarkeit auf sich selbst - Kollaborationen: - -Der User möchte ein Bild auf einem Layer darstellen - -Klasse: Layer-Manager - Vererbung: - - - Verantwortlichkeiten: - -Sichtbarkeit und Darstellung der Bilder auf verschiedenen Layern - -Projektion auf ein Bild - Kollaborationen: - -Der User möchte ein Layer über das andere schieben - -Der User möchte die Layer löschen - -neues Layer erstellen - - - - - \ No newline at end of file diff --git a/Abgabe/Aufgabe 3/UML.pdf b/Abgabe/Aufgabe 3/UML.pdf deleted file mode 100644 index e379a3e..0000000 Binary files a/Abgabe/Aufgabe 3/UML.pdf and /dev/null differ diff --git a/Abgabe/Aufgabe 3/UML.uxf b/Abgabe/Aufgabe 3/UML.uxf deleted file mode 100644 index 2ccb1a4..0000000 --- a/Abgabe/Aufgabe 3/UML.uxf +++ /dev/null @@ -1,757 +0,0 @@ - - - 9 - - UMLClass - - 2106 - 171 - 171 - 81 - - /*Image*/ --- -+pixel_data: byte[][] -+size: Vector2 --- -+clear_image(Color) - - - - UMLClass - - 2115 - 450 - 162 - 36 - - *RasterImage* --- --- - - - - UMLClass - - 2106 - 702 - 189 - 99 - - *ShapedImage* --- --polygon_data: byte[][] --- -+create_vertex(Vector2) -+remove_vertex(Vector2) -+clear_polygon() - - - - UMLClass - - 450 - 171 - 261 - 171 - - /*Tool*/ --- -+effected_area_border_color: Color -+effected_area_border_radius: int -+effected_area_border_line_type: LineType -+name: String -+icon: Sprite -+tooltip: String -+description: String -... --- -/+handleImageClick(Vector2): void/ - - - - Relation - - 2187 - 243 - 27 - 225 - - lt=<<- - 10.0;10.0;10.0;230.0 - - - Relation - - 2187 - 477 - 27 - 243 - - lt=<<- - 10.0;10.0;10.0;250.0 - - - UMLClass - - 468 - 450 - 225 - 153 - - /*SetColorTool*/ --- -+colors: Color[255] -+selected_colors: Color[2] --- -+renderColorPalette(): void -+setMainColor(Color): void -+setSecondaryColor(Color): void -+getMainColor(): Color -+getSecondaryColor(): Color - - - - UMLClass - - 0 - 450 - 225 - 117 - - *HistoryTool* --- --history: HistoryAction[20] --current_location: int --- -+undo(): bool -+redo(): bool -+clearRedo(): void -+addUndo(HistoryAction): void - - - - UMLClass - - 945 - 171 - 216 - 117 - - <<Enumeration>> -*LineType* --- - Solid - Dotted - Dashed - LongDash - ... - - - - Relation - - 99 - 558 - 27 - 162 - - lt=<<<<- - 10.0;10.0;10.0;160.0 - - - UMLClass - - 0 - 702 - 225 - 45 - - *HistoryAction* --- -+string action_data[] --- - - - - UMLClass - - 0 - 864 - 225 - 99 - - <<Enumeration>> -*HistoryActionType* --- - ColorChange - Deletion - PolygonVertex - .... - - - - Relation - - 99 - 738 - 99 - 144 - - lt=<- -+action_type - 10.0;140.0;10.0;10.0 - - - UMLClass - - 468 - 702 - 225 - 45 - - *FloodFillTool* --- --- -+handleImageClick(Vector2): void - - - - UMLClass - - 234 - 702 - 225 - 45 - - *PlainTool* --- --- -+handleImageClick(Vector2): void - - - - UMLClass - - 702 - 702 - 225 - 90 - - /*FormsTool*/ --- -+edge_display_line_type: LineType -+edge_display_color: Color -+edge_display_thickness: int --- - - - - UMLClass - - 936 - 702 - 225 - 63 - - *PenTool* --- --radius: int --- -+handleImageClick(Vector2): void - - - - UMLClass - - 702 - 864 - 225 - 90 - - *RectangleTool* --- -+edge_thickness: int -+edge_line_type: LineType --- -+handleImageClick(Vector2): void - - - - UMLClass - - 1179 - 864 - 216 - 72 - - *LineTool* --- -+thickness: int -+line_type: LineType --- -+handleImageClick(Vector2): void - - - - UMLClass - - 936 - 864 - 234 - 90 - - *ConvexFormsTool* --- -+edge_thickness: int -+edge_line_type: LineType --- -+handleImageClick(Vector2): void - - - - UMLClass - - 468 - 864 - 225 - 90 - - *PolygonTool* --- -+edge_thickness: int -+edge_line_type: LineType --- -+handleImageClick(Vector2): void - - - - Relation - - 648 - 594 - 423 - 126 - - lt=<<- - 10.0;10.0;450.0;120.0 - - - Relation - - 612 - 594 - 225 - 126 - - lt=<<- - 10.0;10.0;230.0;120.0 - - - Relation - - 567 - 594 - 27 - 126 - - lt=<<- - 10.0;10.0;10.0;120.0 - - - Relation - - 333 - 594 - 225 - 126 - - lt=<<- - 230.0;10.0;10.0;120.0 - - - Relation - - 576 - 333 - 27 - 135 - - lt=<<- - 10.0;10.0;10.0;130.0 - - - Relation - - 837 - 783 - 225 - 99 - - lt=<<- - 10.0;10.0;230.0;90.0 - - - Relation - - 810 - 774 - 27 - 108 - - lt=<<- - 10.0;10.0;10.0;100.0 - - - Relation - - 882 - 783 - 423 - 99 - - lt=<<- - 10.0;10.0;450.0;90.0 - - - Relation - - 558 - 783 - 252 - 99 - - lt=<<- - 260.0;10.0;10.0;90.0 - - - Relation - - 99 - 333 - 414 - 135 - - lt=<<- - 440.0;10.0;10.0;130.0 - - - UMLClass - - 234 - 864 - 225 - 81 - - *CircleTool* --- -+edge_thickness: int -+edge_line_type: LineType --- -+handleImageClick(Vector2): void - - - - Relation - - 324 - 783 - 459 - 99 - - lt=<<- - 490.0;10.0;10.0;90.0 - - - UMLClass - - 234 - 450 - 225 - 63 - - *MergeTool* --- -+import_file: DataStream<File> --- -+handleImageClick(Vector2): void - - - - UMLClass - - 702 - 450 - 225 - 45 - - *RotateTool* --- --- -+handleImageClick(Vector2): void - - - - UMLClass - - 936 - 450 - 225 - 45 - - *ResizeTool* --- --- -+handleImageClick(Vector2): void - - - - Relation - - 621 - 333 - 216 - 135 - - lt=<<- - 10.0;10.0;220.0;130.0 - - - Relation - - 666 - 333 - 405 - 135 - - lt=<<- - 10.0;10.0;430.0;130.0 - - - Relation - - 333 - 333 - 225 - 135 - - lt=<<- - 230.0;10.0;10.0;130.0 - - - UMLClass - - 1170 - 450 - 225 - 54 - - *SelectionTool* --- -+pos1: int -+pos2: int --- - - - - - Relation - - 684 - 333 - 630 - 135 - - lt=<<- - 10.0;10.0;680.0;130.0 - - - UMLClass - - 1170 - 702 - 225 - 36 - - *CutTool* --- --- - - - - - Relation - - 1278 - 495 - 27 - 225 - - lt=<<- - 10.0;10.0;10.0;230.0 - - - UMLClass - - 1404 - 450 - 225 - 90 - - *KorrekturTool* --- -+Value: int --- -+increse(Value) -+decrese(Value) - - - - Relation - - 702 - 333 - 837 - 135 - - lt=<<- - 10.0;10.0;910.0;130.0 - - - UMLClass - - 1404 - 702 - 225 - 36 - - *HelligkeitsTool* --- --- - - - - Relation - - 1512 - 531 - 27 - 189 - - lt=<<- - 10.0;10.0;10.0;190.0 - - - UMLClass - - 1638 - 702 - 225 - 36 - - *FarbtonTool* --- --- - - - - - Relation - - 1539 - 531 - 234 - 189 - - lt=<<- - 10.0;10.0;240.0;190.0 - - - UMLClass - - 1872 - 702 - 225 - 54 - - *GradationsTool* --- --- -+generate_gradient(): void - - - - Relation - - 1575 - 531 - 432 - 189 - - lt=<<- - 10.0;10.0;460.0;190.0 - - - UMLClass - - 1170 - 171 - 225 - 72 - - *3D-object* --- -+vertices --- -+load_3D(Object): void - - - - - UMLClass - - 1404 - 171 - 225 - 54 - - *3D-inspector* --- --- -+generate_3D(): void - - - - - UMLClass - - 1872 - 171 - 225 - 81 - - *Layer-Manager* --- --- -+generate_layer(): void -+delete_layer(int): void -+overlab_layer(): void - - - - - UMLClass - - 1638 - 171 - 225 - 54 - - *Layer* --- --- -+display_layer(): void - - - - diff --git a/Abgabe/Aufgabe 3/Use_case.pdf b/Abgabe/Aufgabe 3/Use_case.pdf deleted file mode 100644 index cffc003..0000000 Binary files a/Abgabe/Aufgabe 3/Use_case.pdf and /dev/null differ diff --git a/Abgabe/Aufgabe 3/Use_case.uxf b/Abgabe/Aufgabe 3/Use_case.uxf deleted file mode 100644 index 251c8b9..0000000 --- a/Abgabe/Aufgabe 3/Use_case.uxf +++ /dev/null @@ -1,405 +0,0 @@ - - - 17 - - UMLActor - - 17 - 459 - 170 - 187 - - 3D-Künstler -bg=green - - - - UMLActor - - 68 - 714 - 136 - 187 - - Einsteiger -bg=red - - - - UMLUseCase - - 646 - 391 - 204 - 119 - - Zusammenfügen -von Bildern -bg=red - - - - UMLUseCase - - 646 - 527 - 204 - 119 - - Ändern der -Bilderauflösung -bg=red - - - - UMLUseCase - - 646 - 663 - 204 - 119 - - Drehen von -Bildern -bg=red - - - - UMLUseCase - - 646 - 969 - 204 - 119 - - Retuschieren -der Bilder -bg=magenta - - - - UMLActor - - 51 - 1037 - 170 - 187 - - Casual User -bg=red - - - - Relation - - 119 - 442 - 561 - 306 - - - 310.0;10.0;10.0;160.0 - - - Relation - - 119 - 561 - 561 - 187 - - - 310.0;10.0;10.0;90.0 - - - Relation - - 119 - 680 - 561 - 68 - - - 310.0;20.0;10.0;20.0 - - - Relation - - 119 - 442 - 561 - 629 - - - 310.0;10.0;10.0;350.0 - - - Relation - - 119 - 561 - 561 - 510 - - - 310.0;10.0;10.0;280.0 - - - Relation - - 119 - 697 - 561 - 374 - - - 310.0;10.0;10.0;200.0 - - - Relation - - 119 - 986 - 561 - 85 - - - 310.0;20.0;10.0;30.0 - - - Relation - - 136 - 1003 - 544 - 408 - - - 300.0;10.0;10.0;220.0 - - - UMLUseCase - - 646 - 1394 - 204 - 119 - - Korrektur- -werkzeuge -bg=blue - - - - UMLNote - - 629 - 1547 - 238 - 119 - - Helligkeit/Kontrast -Farbton/Sättigung -Gradationskurven -bg=blue - - - - Relation - - 136 - 1360 - 544 - 119 - - - 300.0;50.0;10.0;10.0 - - - Relation - - 731 - 1496 - 51 - 85 - - - 10.0;10.0;10.0;30.0 - - - UMLUseCase - - 646 - 1122 - 204 - 119 - - Pinsel -bg=blue - - - - UMLUseCase - - 646 - 1258 - 204 - 119 - - Auswahl- -werkzeuge -bg=blue - - - - Relation - - 136 - 1292 - 544 - 119 - - - 300.0;10.0;10.0;50.0 - - - Relation - - 136 - 1156 - 544 - 255 - - - 300.0;10.0;10.0;130.0 - - - UMLActor - - 0 - 1377 - 306 - 187 - - Freiberufliche Fotografen -bg=blue - - - - UMLUseCase - - 646 - 816 - 204 - 119 - - Layerstruktur -bg=dark_gray - - - - Relation - - 85 - 272 - 595 - 221 - - - 330.0;10.0;10.0;110.0 - - - UMLUseCase - - 646 - 238 - 204 - 119 - - Schnittstelle -für 3D-Modelle -bg=green - - - - Relation - - 85 - 136 - 595 - 357 - - - 330.0;10.0;10.0;190.0 - - - UMLUseCase - - 646 - 102 - 204 - 119 - - Erzeugen von -3D-Objekten -bg=green - - - - Relation - - 136 - 867 - 544 - 544 - - - 300.0;10.0;10.0;300.0 - - - Relation - - 119 - 867 - 561 - 204 - - - 310.0;10.0;10.0;100.0 - - - Relation - - 119 - 697 - 561 - 221 - - - 310.0;110.0;10.0;10.0 - - - Relation - - 85 - 442 - 595 - 476 - - - 330.0;260.0;10.0;10.0 - - - UMLClass - - 527 - 0 - 459 - 1836 - - lw=2 -IntelliPhoto Benchmark 1.0 -bg=gray - - - diff --git a/Examples/biggest_flex_featureimage.jpg b/Examples/biggest_flex_featureimage.jpg new file mode 100644 index 0000000..e830e0a Binary files /dev/null and b/Examples/biggest_flex_featureimage.jpg differ diff --git a/Examples/farbkreis_featuredimage.png b/Examples/farbkreis_featuredimage.png new file mode 100644 index 0000000..10e2872 Binary files /dev/null and b/Examples/farbkreis_featuredimage.png differ diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp new file mode 100644 index 0000000..1c13e71 --- /dev/null +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.cpp @@ -0,0 +1,423 @@ +// ---------- IntelliPhotoGui.cpp ---------- + +#include +#include + +#include "IntelliPhotoGui.h" +#include "Layer/PaintingArea.h" + +// IntelliPhotoGui constructor +IntelliPhotoGui::IntelliPhotoGui() +{ + //create Gui elemnts and lay them out + createGui(); + // Create actions + createActions(); + //create Menus + createMenus(); + //set style of the gui + setIntelliStyle(); + + // Size the app + resize(500, 500); +} + + +// User tried to close the app +void IntelliPhotoGui::closeEvent(QCloseEvent *event) +{ + // If they try to close maybeSave() returns true + // if no changes have been made and the app closes + if (maybeSave()) { + event->accept(); + } else { + + // If there have been changes ignore the event + event->ignore(); + } +} + +// Check if the current image has been changed and then +// open a dialog to open a file +void IntelliPhotoGui::open() +{ + // Check if changes have been made since last save + // maybeSave() returns true if no changes have been made + if (maybeSave()) { + + // Get the file to open from a dialog + // tr sets the window title to Open File + // QDir opens the current dirctory + QString fileName = QFileDialog::getOpenFileName(this, + tr("Open File"), QDir::currentPath()); + + // If we have a file name load the image and place + // it in the paintingArea + if (!fileName.isEmpty()) + paintingArea->openImage(fileName); + } +} + +// 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(sender()); + + // Stores the array of bytes of the users data + QByteArray fileFormat = action->data().toByteArray(); + + // Pass it to be saved + saveFile(fileFormat); +} + +// Opens a dialog to change the pen color +void IntelliPhotoGui::penColor() +{ + // Store the chosen color from the dialog + QColor newColor = QColorDialog::getColor(paintingArea->penColor()); + + // If a valid color set it + if (newColor.isValid()) + paintingArea->setPenColor(newColor); +} + +// Opens a dialog that allows the user to change the pen width +void IntelliPhotoGui::penWidth() +{ + // Stores button value + bool ok; + + // tr("Painting") is the title + // the next tr is the text to display + // Get the current pen width + // Define the min, max, step and ok button + int newWidth = QInputDialog::getInt(this, tr("Painting"), + tr("Select pen width:"), + paintingArea->penWidth(), + 1, 500, 1, &ok); + // Change the pen width + if (ok) + paintingArea->setPenWidth(newWidth); +} + +// Open an about dialog +void IntelliPhotoGui::about() +{ + // Window title and text to display + QMessageBox::about(this, tr("About Painting"), + tr("

IntelliPhoto Some nice ass looking software

")); +} + +void IntelliPhotoGui::onSetAlpha(){ + int a = this->setAlphaEdit->text().toInt(); + emit this->sendAlpha(a); +} + +void IntelliPhotoGui::onMoveUp(){ + int a = 5; + emit this->moveUp(a); +} + +void IntelliPhotoGui::onMoveDown(){ + int a = 5; + emit this->moveDown(a); +} + +void IntelliPhotoGui::onMoveLeft(){ + int a = 5; + emit this->moveLeft(a); +} + +void IntelliPhotoGui::onMoveRight(){ + int a = 5; + emit this->moveRight(a); +} + +void IntelliPhotoGui::onMoveLayerUp(){ + emit this->moveLayerUp(); +} + +void IntelliPhotoGui::onMoveLayerDown(){ + emit this->moveLayerDown(); +} + +void IntelliPhotoGui::onClearedPressed(){ + int r = this->RedEdit->text().toInt(); + int g = this->GreenEdit->text().toInt(); + int b = this->BlueEdit->text().toInt(); + emit this->sendClearColor(r,g,b); +} + +void IntelliPhotoGui::onActivePressed(){ + int a = this->selectActiveEdit->text().toInt(); + emit this->sendActiveLayer(a); +}; + + + +// Define menu actions that call functions +void IntelliPhotoGui::createActions() +{ + //connect signal and slots of gui element + connect(this->clearButton, SIGNAL(clicked()), this, SLOT(onClearedPressed())); + connect(this, SIGNAL(sendClearColor(int,int,int)), paintingArea, SLOT(clearImage(int, int, int))); + + connect(this->selectActiveButton, SIGNAL(clicked()), this, SLOT(onActivePressed())); + connect(this, SIGNAL(sendActiveLayer(int)),paintingArea, SLOT(activate(int))); + + connect(this->setAlphaButton, SIGNAL(clicked()), this, SLOT(onSetAlpha())); + connect(this, SIGNAL(sendAlpha(int)), paintingArea, SLOT(setAlpha(int))); + + connect(this->moveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveUp())); + connect(this, SIGNAL(moveUp(int)), paintingArea, SLOT(getMoveUp(int))); + + connect(this->moveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveDown())); + connect(this, SIGNAL(moveDown(int)), paintingArea, SLOT(getMoveDown(int))); + + connect(this->moveActiveLeftButton, SIGNAL(clicked()), this, SLOT(onMoveLeft())); + connect(this, SIGNAL(moveLeft(int)), paintingArea, SLOT(getMoveLeft(int))); + + connect(this->moveActiveRightButton, SIGNAL(clicked()), this, SLOT(onMoveRight())); + connect(this, SIGNAL(moveRight(int)), paintingArea, SLOT(getMoveRight(int))); + + connect(this->layerMoveActiveDownButton, SIGNAL(clicked()), this, SLOT(onMoveLayerDown())); + connect(this, SIGNAL(moveLayerDown()), paintingArea, SLOT(getMoveLayerDown())); + + connect(this->layerMoveActiveUpButton, SIGNAL(clicked()), this, SLOT(onMoveLayerUp())); + connect(this, SIGNAL(moveLayerUp()), paintingArea, SLOT(getMoveLayerUp())); + + + + // Create the action tied to the menu + openAct = new QAction(tr("&Open..."), this); + + // Define the associated shortcut key + openAct->setShortcuts(QKeySequence::Open); + + // Tie the action to IntelliPhotoGui::open() + connect(openAct, SIGNAL(triggered()), this, SLOT(open())); + + // Get a list of the supported file formats + // QImageWriter is used to write images to files + foreach (QByteArray format, QImageWriter::supportedImageFormats()) { + QString text = tr("%1...").arg(QString(format).toUpper()); + + // Create an action for each file format + QAction *action = new QAction(text, this); + + // Set an action for each file format + action->setData(format); + + // 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); + } + + 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->setShortcuts(QKeySequence::Quit); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + + // Create pen color action and tie to IntelliPhotoGui::penColor() + penColorAct = new QAction(tr("&Pen Color..."), this); + connect(penColorAct, SIGNAL(triggered()), this, SLOT(penColor())); + + // Create pen width action and tie to IntelliPhotoGui::penWidth() + penWidthAct = new QAction(tr("Pen &Width..."), this); + connect(penWidthAct, SIGNAL(triggered()), this, SLOT(penWidth())); + + // Create clear screen action and tie to IntelliPhotoGui::clearImage() + clearScreenAct = new QAction(tr("&Clear Screen"), this); + clearScreenAct->setShortcut(tr("Ctrl+L")); + connect(clearScreenAct, SIGNAL(triggered()), + paintingArea, SLOT(clearImage())); + + // Create about action and tie to IntelliPhotoGui::about() + aboutAct = new QAction(tr("&About"), this); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); + + // Create about Qt action and tie to IntelliPhotoGui::aboutQt() + aboutQtAct = new QAction(tr("About &Qt"), this); + connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +} + +// Create the menubar +void IntelliPhotoGui::createMenus() +{ + // Create Save As option and the list of file types + saveAsMenu = new QMenu(tr("&Save As"), this); + foreach (QAction *action, saveAsActs) + saveAsMenu->addAction(action); + + + // Attach all actions to File + fileMenu = new QMenu(tr("&File"), this); + fileMenu->addAction(openAct); + fileMenu->addMenu(saveAsMenu); + fileMenu->addSeparator(); + fileMenu->addAction(exitAct); + + // Attach all actions to Options + optionMenu = new QMenu(tr("&Options"), this); + optionMenu->addAction(penColorAct); + optionMenu->addAction(penWidthAct); + optionMenu->addSeparator(); + optionMenu->addAction(clearScreenAct); + + // Attach all actions to Help + helpMenu = new QMenu(tr("&Help"), this); + helpMenu->addAction(aboutAct); + helpMenu->addAction(aboutQtAct); + + // Add menu items to the menubar + menuBar()->addMenu(fileMenu); + menuBar()->addMenu(optionMenu); + menuBar()->addMenu(helpMenu); +} + +void IntelliPhotoGui::createGui(){ + //create a central widget to work on + centralGuiWidget = new QWidget(this); + setCentralWidget(centralGuiWidget); + + //create the grid for the layout + mainLayout = new QGridLayout(centralGuiWidget); + centralGuiWidget->setLayout(mainLayout); + + //create Gui elements + clearButton = new QPushButton("set Color"); + paintingArea = new PaintingArea(); + + + RedLabel = new QLabel("Red:"); + GreenLabel = new QLabel("Green"); + BlueLabel = new QLabel("Blue:"); + RedEdit = new QLineEdit("255"); + GreenEdit = new QLineEdit("255"); + BlueEdit = new QLineEdit("255"); + RedEdit->setMaximumSize(150,20); + GreenEdit->setMaximumSize(150,20); + BlueEdit->setMaximumSize(150,20); + + selectActiveButton = new QPushButton("select Active"); + selectActiveLabel = new QLabel("Active:"); + selectActiveEdit = new QLineEdit("0"); + selectActiveLabel->setMaximumSize(150,20); + selectActiveEdit->setMaximumSize(150,20); + + setAlphaButton = new QPushButton("set Alpha"); + setAlphaLabel = new QLabel("Alpha:"); + setAlphaEdit = new QLineEdit("255"); + setAlphaEdit->setMaximumSize(150,20); + + moveActiveUpButton = new QPushButton("move 5 Up"); + moveActiveDownButton = new QPushButton("move 5 Down"); + moveActiveLeftButton = new QPushButton("move 5 Left"); + moveActiveRightButton = new QPushButton("move 5 Right"); + + layerMoveActiveDownButton = new QPushButton("Active Layer Down"); + layerMoveActiveUpButton = new QPushButton("Active Layer Up"); + + //set gui elemtns position + mainLayout->addWidget(clearButton,0,25,1,1); + mainLayout->addWidget(paintingArea,0,0,25,25); + + mainLayout->addWidget(RedLabel,1,25,1,1); + mainLayout->addWidget(RedEdit,2,25,1,1); + mainLayout->addWidget(GreenLabel,3,25,1,1); + mainLayout->addWidget(GreenEdit,4,25,1,1); + mainLayout->addWidget(BlueLabel,5,25,1,1); + mainLayout->addWidget(BlueEdit,6,25,1,1); + + mainLayout->addWidget(selectActiveButton,7,25,1,1); + mainLayout->addWidget(selectActiveLabel,8,25,1,1); + mainLayout->addWidget(selectActiveEdit,9,25,1,1); + + mainLayout->addWidget(setAlphaButton,10,25,1,1); + mainLayout->addWidget(setAlphaLabel,11,25,1,1); + mainLayout->addWidget(setAlphaEdit,12,25,1,1); + + mainLayout->addWidget(moveActiveUpButton,13,25,1,1); + mainLayout->addWidget(moveActiveDownButton,14,25,1,1); + mainLayout->addWidget(moveActiveLeftButton,15,25,1,1); + mainLayout->addWidget(moveActiveRightButton,16,25,1,1); + + mainLayout->addWidget(layerMoveActiveDownButton,17,25,1,1); + mainLayout->addWidget(layerMoveActiveUpButton,18,25,1,1); + + +} + +void IntelliPhotoGui::setIntelliStyle(){ + // Set the title + setWindowTitle("IntelliPhoto Prototype"); + //set style sheet + this->setStyleSheet("background-color:rgb(64,64,64)"); + this->centralGuiWidget->setStyleSheet("color:rgb(255,255,255)"); + this->menuBar()->setStyleSheet("color:rgb(255,255,255)"); +} + +bool IntelliPhotoGui::maybeSave() +{ + // Check for changes since last save + if (paintingArea->isModified()) { + QMessageBox::StandardButton ret; + + // Painting is the title + // Add text and the buttons + ret = QMessageBox::warning(this, tr("Painting"), + tr("The image has been modified.\n" + "Do you want to save your changes?"), + QMessageBox::Save | QMessageBox::Discard + | QMessageBox::Cancel); + + // If save button clicked call for file to be saved + if (ret == QMessageBox::Save) { + return saveFile("png"); + + // If cancel do nothing + } else if (ret == QMessageBox::Cancel) { + return false; + } + } + return true; +} + +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"), + initialPath, + tr("%1 Files (*.%2);;All Files (*)") + .arg(QString::fromLatin1(fileFormat.toUpper())) + .arg(QString::fromLatin1(fileFormat))); + + // If no file do nothing + if (fileName.isEmpty()) { + return false; + } else { + + // Call for the file to be saved + return paintingArea->saveImage(fileName, fileFormat.constData()); + } +} + diff --git a/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h new file mode 100644 index 0000000..79f2cf9 --- /dev/null +++ b/IntelliPhoto/Painting/GUI/IntelliPhotoGui.h @@ -0,0 +1,125 @@ +#ifndef IntelliPhotoGui_H +#define IntelliPhotoGui_H + +#include +#include +#include +#include +#include +#include +#include + +// PaintingArea used to paint the image +class PaintingArea; + +class IntelliPhotoGui : public QMainWindow +{ + // Declares our class as a QObject which is the base class + // for all Qt objects + // QObjects handle events + Q_OBJECT +signals: + void sendClearColor(int r, int g, int b); + void sendActiveLayer(int a); + void sendAlpha(int a); + void moveUp(int a); + void moveDown(int a); + void moveRight(int a); + void moveLeft(int a); + void moveLayerUp(); + void moveLayerDown(); + +public: + IntelliPhotoGui(); +protected: + // Function used to close an event + void closeEvent(QCloseEvent *event) override; + +// The events that can be triggered +private slots: + void open(); + void save(); + void penColor(); + void penWidth(); + void about(); + + void onClearedPressed(); + void onActivePressed(); + void onSetAlpha(); + void onMoveUp(); + void onMoveDown(); + void onMoveLeft(); + void onMoveRight(); + void onMoveLayerUp(); + void onMoveLayerDown(); + +private: + // Will tie user actions to functions + void createActions(); + void createMenus(); + + //setup GUI elements + void createGui(); + + //set style of the GUI + void setIntelliStyle(); + + // Will check if changes have occurred since last save + bool maybeSave(); + + // Opens the Save dialog and saves + bool saveFile(const QByteArray &fileFormat); + + // What we'll draw on + PaintingArea *paintingArea; + + // The menu widgets + QMenu *saveAsMenu; + QMenu *fileMenu; + QMenu *optionMenu; + QMenu *helpMenu; + + + // All the actions that can occur + QAction *openAct; + + // Actions tied to specific file formats + QList saveAsActs; + QAction *exitAct; + QAction *penColorAct; + QAction *penWidthAct; + QAction *clearScreenAct; + QAction *aboutAct; + QAction *aboutQtAct; + + //main GUI elements + QWidget* centralGuiWidget; + QGridLayout *mainLayout; + QPushButton *clearButton; + + QLabel *RedLabel; + QLabel *GreenLabel; + QLabel *BlueLabel; + QLineEdit *RedEdit; + QLineEdit *GreenEdit; + QLineEdit *BlueEdit; + + QPushButton *selectActiveButton; + QLabel *selectActiveLabel; + QLineEdit *selectActiveEdit; + + QPushButton *setAlphaButton; + QLabel *setAlphaLabel; + QLineEdit *setAlphaEdit; + + QPushButton *moveActiveUpButton; + QPushButton *moveActiveDownButton; + QPushButton *moveActiveLeftButton; + QPushButton *moveActiveRightButton; + + QPushButton *layerMoveActiveDownButton; + QPushButton *layerMoveActiveUpButton; + +}; + +#endif diff --git a/IntelliPhoto/Painting/Image/IntelliImage.cpp b/IntelliPhoto/Painting/Image/IntelliImage.cpp new file mode 100644 index 0000000..879e8c7 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliImage.cpp @@ -0,0 +1,81 @@ +#include"Image/IntelliImage.h" +#include +#include + +IntelliImage::IntelliImage(int weight, int height) + :imageData(QSize(weight, height), QImage::Format_ARGB32){ + imageData.fill(QColor(255,255,255,255)); +} + +IntelliImage::~IntelliImage(){ + +} + +bool IntelliImage::loadImage(const QString &fileName){ + // Holds the image + QImage loadedImage; + + // If the image wasn't loaded leave this function + 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); + return true; +} + +void IntelliImage::resizeImage(QImage *image, const QSize &newSize){ + // Check if we need to redraw the image + if (image->size() == newSize) + return; + + // Create a new image to display and fill it with white + QImage newImage(newSize, QImage::Format_ARGB32); + newImage.fill(qRgb(255, 255, 255)); + + // Draw the image + QPainter painter(&newImage); + painter.drawImage(QPoint(0, 0), *image); + *image = newImage; +} + +void IntelliImage::drawPixel(const QPoint &p1, const QColor& color){ + // Used to draw on the widget + QPainter painter(&imageData); + + // Set the current settings for the pen + painter.setPen(QPen(color, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + + // Draw a line from the last registered point to the current + painter.drawPoint(p1); + + // Call to update the rectangular space where we drew + //update(QRect(p1, p2)); +} + +void IntelliImage::drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth){ + // Used to draw on the widget + QPainter painter(&imageData); + + // Set the current settings for the pen + painter.setPen(QPen(color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + + // Draw a line from the last registered point to the current + painter.drawLine(p1, p2); + +} + +void IntelliImage::floodFill(const QColor& color){ + imageData.fill(color); + +} + +int IntelliImage::x(){ + return imageData.size().width(); +} + +int IntelliImage::y(){ + return imageData.size().height(); +} diff --git a/IntelliPhoto/Painting/Image/IntelliImage.h b/IntelliPhoto/Painting/Image/IntelliImage.h new file mode 100644 index 0000000..a2fb3c0 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliImage.h @@ -0,0 +1,46 @@ +#ifndef INTELLIIMAGE_H +#define INTELLIIMAGE_H + +#include +#include +#include +#include +#include +#include + +enum class ImageType{ + Raster_Image, + Shaped_Image +}; + +class IntelliImage{ + +protected: + void resizeImage(QImage *image, const QSize &newSize); + + QImage imageData; +public: + IntelliImage(int weight, int height); + virtual ~IntelliImage() = 0; + + //start on top left + virtual void drawPixel(const QPoint &p1, const QColor& color); + virtual void drawLine(const QPoint &p1, const QPoint& p2, const QColor& color, const int& penWidth); + 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; + + //returns the filtered output + + //sets the data for the visible image + virtual void setPolygon(const std::vector& polygonData)=0; + + virtual bool loadImage(const QString &fileName); + + int x(); + int y(); +}; + +#endif diff --git a/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp b/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp new file mode 100644 index 0000000..b73c264 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliRasterImage.cpp @@ -0,0 +1,34 @@ +#include"Image/IntelliRasterImage.h" +#include +#include +#include + +IntelliRasterImage::IntelliRasterImage(int weight, int height) + :IntelliImage(weight, height){ + +} + +IntelliRasterImage::~IntelliRasterImage(){ + +} + +QImage IntelliRasterImage::getDisplayable(int alpha){ + return getDisplayable(imageData.size(), alpha); +} + +QImage IntelliRasterImage::getDisplayable(const QSize& displaySize, int alpha){ + QImage copy = imageData; + for(int y = 0; y& polygonData){ + qDebug() << "Raster Image has no polygon data " << polygonData.size() <<"\n"; + return; +} diff --git a/IntelliPhoto/Painting/Image/IntelliRasterImage.h b/IntelliPhoto/Painting/Image/IntelliRasterImage.h new file mode 100644 index 0000000..3b3e600 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliRasterImage.h @@ -0,0 +1,21 @@ +#ifndef INTELLIRASTER_H +#define INTELLIRASTER_H + +#include"Image/IntelliImage.h" + +class IntelliRasterImage : public IntelliImage{ + +public: + IntelliRasterImage(int weight, int height); + virtual ~IntelliRasterImage() override; + + //returns the filtered output + virtual QImage getDisplayable(const QSize& displaySize,int alpha) override; + virtual QImage getDisplayable(int alpha=255) override; + + + //sets the data for the visible image + virtual void setPolygon(const std::vector& polygonData) override; +}; + +#endif diff --git a/IntelliPhoto/Painting/Image/IntelliShapedImage.cpp b/IntelliPhoto/Painting/Image/IntelliShapedImage.cpp new file mode 100644 index 0000000..6b7a829 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliShapedImage.cpp @@ -0,0 +1,71 @@ +#include"Image/IntelliShapedImage.h" +#include"IntelliHelper/IntelliHelper.h" +#include +#include +#include + +IntelliShapedImage::IntelliShapedImage(int weight, int height) + :IntelliImage(weight, height){ +} + +IntelliShapedImage::~IntelliShapedImage(){ + +} + +QImage IntelliShapedImage::getDisplayable(int alpha){ + return getDisplayable(imageData.size()); +} + +QImage IntelliShapedImage::getDisplayable(const QSize& displaySize, int alpha){ + if(polygonData.size()==0){ + QImage copy = imageData; + for(int y = 0; y not in Polygon + if(!(cutNumberX&1)){ + 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); + } + } + } + + return copy.scaled(displaySize,Qt::IgnoreAspectRatio); +} + +void IntelliShapedImage::setPolygon(const std::vector& polygonData){ + if(polygonData.size()<3){ + return; + } + for(auto element:polygonData){ + this->polygonData.push_back(QPoint(element.x(), element.y())); + } + return; +} diff --git a/IntelliPhoto/Painting/Image/IntelliShapedImage.h b/IntelliPhoto/Painting/Image/IntelliShapedImage.h new file mode 100644 index 0000000..6c38366 --- /dev/null +++ b/IntelliPhoto/Painting/Image/IntelliShapedImage.h @@ -0,0 +1,22 @@ +#ifndef INTELLISHAPE_H +#define INTELLISHAPE_H + +#include"Image/IntelliImage.h" + +class IntelliShapedImage : public IntelliImage{ + +protected: + std::vector polygonData; +public: + IntelliShapedImage(int weight, int height); + virtual ~IntelliShapedImage() override; + + //returns the filtered output + virtual QImage getDisplayable(const QSize& displaySize, int alpha=255) override; + virtual QImage getDisplayable(int alpha=255) override; + + //sets the data for the visible image + virtual void setPolygon(const std::vector& polygonData) override; +}; + +#endif diff --git a/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.cpp b/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.cpp new file mode 100644 index 0000000..ef0e8fb --- /dev/null +++ b/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.cpp @@ -0,0 +1,39 @@ +#include"IntelliHelper.h" +#include + +int IntelliHelper::orientation(QPoint& p, QPoint& q, QPoint& r){ + int value = (q.y()-p.y())*(r.x()-q.x())- + (q.x()-p.x())*(r.y()-q.y()); + if(value==0) return 0; + return (value>0)?1:2; +} + +bool IntelliHelper::onSegment(QPoint& p1, QPoint& q, QPoint& p2){ + return (q.x() >= std::min(p1.x(),p2.x()) && q.x() <= std::max(p1.x(), p2.x()) && + q.y() >= std::min(p1.y(),p2.y()) && q.y() <= std::max(p1.y(), p2.y())); +} + +bool IntelliHelper::hasIntersection(QPoint& p1, QPoint& q1, QPoint& p2, QPoint& q2){ + int o1 = IntelliHelper::orientation(p1,q1,p2); + int o2 = IntelliHelper::orientation(p1,q1,q2); + int o3 = IntelliHelper::orientation(p2,q2,p1); + int o4 = IntelliHelper::orientation(p2,q2,q1); + + // General case + if (o1 != o2 && o3 != o4) + return true; + + // p1, q1 and p2 are colinear and p2 lies on segment p1q1 + if (o1 == 0 && onSegment(p1, p2, q1)) return true; + + // p1, q1 and q2 are colinear and q2 lies on segment p1q1 + if (o2 == 0 && onSegment(p1, q2, q1)) return true; + + // p2, q2 and p1 are colinear and p1 lies on segment p2q2 + if (o3 == 0 && onSegment(p2, p1, q2)) return true; + + // p2, q2 and q1 are colinear and q1 lies on segment p2q2 + if (o4 == 0 && onSegment(p2, q1, q2)) return true; + + return false; // Doesn't fall in any of the above cases +} diff --git a/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.h b/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.h new file mode 100644 index 0000000..9e273f6 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliHelper/IntelliHelper.h @@ -0,0 +1,22 @@ +#ifndef INTELLIHELPER_H +#define INTELLIHELPER_H + +#include + + +class IntelliHelper{ +public: + //checks for orientation: + // 0 - colinear + // 1 - clockwise + // 2 - counter clockwise + static int orientation(QPoint& p1, QPoint& p2, QPoint& p3); + + //checks if q is on segment p1-p2 + static bool onSegment(QPoint& p1, QPoint& q, QPoint& p2); + + //cheks if p1-q1 intersects with p2-q2 + static bool hasIntersection(QPoint& p1, QPoint& q1, QPoint& p2, QPoint& q2); +}; + +#endif diff --git a/IntelliPhoto/Painting/IntelliPhoto.87de10b b/IntelliPhoto/Painting/IntelliPhoto.87de10b new file mode 100644 index 0000000..934c6c1 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.87de10b @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {87de10b7-9dd6-4379-8674-fd04613e186e} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MinGW 64-bit + Desktop Qt 5.12.5 MinGW 64-bit + qt.qt5.5125.win64_mingw73_kit + 0 + 0 + 0 + + C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Scribble + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Jonas/Documents/QML/Scribble/Scribble.pro + + 3768 + false + true + true + false + false + true + + C:/Users/Jonas/Documents/QML/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro b/IntelliPhoto/Painting/IntelliPhoto.pro new file mode 100644 index 0000000..3d35323 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro @@ -0,0 +1,47 @@ +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + GUI/IntelliPhotoGui.cpp \ + Image/IntelliImage.cpp \ + Image/IntelliRasterImage.cpp \ + Image/IntelliShapedImage.cpp \ + IntelliHelper/IntelliHelper.cpp \ + Layer/PaintingArea.cpp \ + main.cpp + +HEADERS += \ + GUI/IntelliPhotoGui.h \ + Image/IntelliImage.h \ + Image/IntelliRasterImage.h \ + Image/IntelliShapedImage.h \ + IntelliHelper/IntelliHelper.h \ + Layer/PaintingArea.h + +FORMS += \ + widget.ui + + +QMAKE_CXXFLAGS += -fopenmp +QMAKE_LFLAGS += -fopenmp + +RC_ICONS = icon.ico + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user b/IntelliPhoto/Painting/IntelliPhoto.pro.user new file mode 100644 index 0000000..a8c83e7 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {d22feba4-9460-41e9-9ac3-cddcd407714c} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop (x86-windows-msvc2017-pe-64bit) + Desktop (x86-windows-msvc2017-pe-64bit) + {39c3549a-728d-484f-a9ec-e2904e3853e7} + 0 + 0 + 0 + + Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + IntelliPhoto + + Qt4ProjectManager.Qt4RunConfiguration:Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro + + 3768 + false + true + true + false + false + true + + Z:/Uni/ws 19_20/mathe/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_x86_windows_msvc2017_pe_64bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b b/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b new file mode 100644 index 0000000..06819e8 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user.2eff11b @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {2eff11b9-2504-4003-b4ce-30c119b76df9} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MSVC2017 64bit + Desktop Qt 5.12.5 MSVC2017 64bit + qt.qt5.5125.win64_msvc2017_64_kit + 0 + 0 + 0 + + C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + IntelliPhoto + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/Painting/IntelliPhoto.pro + + 3768 + false + true + true + false + false + true + + C:/Users/Basti/OneDrive/Documents/Uni/Softwaretechnologie/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MSVC2017_64bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d b/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d new file mode 100644 index 0000000..7a6a7ab --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user.426164d @@ -0,0 +1,342 @@ + + + + + + EnvironmentId + {426164d9-3771-4235-8f83-cb0b49423ffc} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + true + + + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MinGW 64-bit + Desktop Qt 5.12.5 MinGW 64-bit + qt.qt5.5125.win64_mingw73_kit + 1 + 0 + 0 + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + IntelliPhoto + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro + + 3768 + false + true + true + false + false + true + + C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/IntelliPhoto.pro.user.87de10b b/IntelliPhoto/Painting/IntelliPhoto.pro.user.87de10b new file mode 100644 index 0000000..fe52988 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.pro.user.87de10b @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {87de10b7-9dd6-4379-8674-fd04613e186e} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MinGW 64-bit + Desktop Qt 5.12.5 MinGW 64-bit + qt.qt5.5125.win64_mingw73_kit + 0 + 0 + 0 + + C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + IntelliPhoto + + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/Painting/IntelliPhoto.pro + + 3768 + false + true + true + false + false + true + + C:/Users/Jonas/Documents/GitHub/intelliphoto/IntelliPhoto/build-IntelliPhoto-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/IntelliPhoto.user b/IntelliPhoto/Painting/IntelliPhoto.user new file mode 100644 index 0000000..574e287 --- /dev/null +++ b/IntelliPhoto/Painting/IntelliPhoto.user @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {39e188fc-db7d-4dae-b6b7-f93e7e62e580} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.6 MinGW 32-bit + Desktop Qt 5.12.6 MinGW 32-bit + qt.qt5.5126.win32_mingw73_kit + 0 + 0 + 0 + + E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Scribble + + Qt4ProjectManager.Qt4RunConfiguration:E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/Scribble/Scribble.pro + + 3768 + false + true + true + false + false + true + + E:/Users/pauln/Documents/intelliphoto/IntelliPhoto/build-Scribble-Desktop_Qt_5_12_6_MinGW_32_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.cpp b/IntelliPhoto/Painting/Layer/PaintingArea.cpp new file mode 100644 index 0000000..de6ec85 --- /dev/null +++ b/IntelliPhoto/Painting/Layer/PaintingArea.cpp @@ -0,0 +1,331 @@ +// ---------- PaintingArea.cpp ---------- + +#include +#include +#include "PaintingArea.h" +#include "Image/IntelliRasterImage.h" +#include "Image/IntelliShapedImage.h" + +#include +#include + +PaintingArea::PaintingArea(int maxWidth, int maxHeight, QWidget *parent) + :QWidget(parent){ + this->setUp(maxWidth, maxHeight); + + //tetsing + this->addLayer(200,200,0,0,ImageType::Shaped_Image); + layerStructure[0].image->floodFill(QColor(255,0,0,255)); + std::vector polygon; + polygon.push_back(QPoint(100,0)); + polygon.push_back(QPoint(200,200)); + polygon.push_back(QPoint(0,200)); + polygon.push_back(QPoint(100,0)); + layerStructure[0].image->setPolygon(polygon); + + this->addLayer(200,200,150,150); + layerStructure[1].image->floodFill(QColor(0,255,0,255)); + layerStructure[1].alpha=200; + 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); + + // Roots the widget to the top left even if resized + setAttribute(Qt::WA_StaticContents); + + // Set defaults for the monitored variables + 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; + if(type==ImageType::Raster_Image){ + newLayer.image = new IntelliRasterImage(width,height); + }else if(type==ImageType::Shaped_Image){ + newLayer.image = new IntelliShapedImage(width, height); + } + newLayer.alpha = 255; + this->layerStructure.push_back(newLayer); + +} + +void PaintingArea::deleteLayer(int index){ + if(indexlayerStructure.erase(layerStructure.begin()+index); + if(activeLayer>=index){ + activeLayer--; + } + } +} + +void PaintingArea::setLayerToActive(int index) { + if(indexactiveLayer=index; + } +} + +void PaintingArea::setAlphaToLayer(int index, int alpha){ + if(indexactiveLayer==-1){ + return false; + } + IntelliImage* active = layerStructure[activeLayer].image; + bool open = active->loadImage(fileName); + update(); + return open; +} + +// Save the current image +bool PaintingArea::saveImage(const QString &fileName, const char *fileFormat) +{ + if(layerStructure.size()==0){ + return false; + } + this->assembleLayers(true); + + if(!std::strcmp(fileFormat,"PNG")){ + QImage visibleImage = Canvas->convertToFormat(QImage::Format_Indexed8); + fileFormat = "png"; + if (visibleImage.save(fileName, fileFormat)) { + return true; + } else { + return false; + } + } + + + if (Canvas->save(fileName, fileFormat)) { + return true; + } else { + return false; + } +} + +// Used to change the pen color +void PaintingArea::setPenColor(const QColor &newColor) +{ + myPenColor = newColor; +} + +// Used to change the pen width +void PaintingArea::setPenWidth(int newWidth) +{ + myPenWidth = newWidth; +} + +// Color the image area with white +void PaintingArea::clearImage(int r, int g, int b){ + if(this->activeLayer==-1){ + return; + } + IntelliImage* active = layerStructure[activeLayer].image; + active->floodFill(QColor(r, g, b, 255)); + + update(); +} + +void PaintingArea::activate(int a){ + this->setLayerToActive(a); +} + +void PaintingArea::setAlpha(int a){ + if(activeLayer>=0){ + layerStructure[activeLayer].alpha=a; + } +} + +void PaintingArea::getMoveUp(int a){ + layerStructure[activeLayer].heightOffset-=a; +} + +void PaintingArea::getMoveDown(int a){ + layerStructure[activeLayer].heightOffset+=a; +} + +void PaintingArea::getMoveRight(int a){ + layerStructure[activeLayer].widthOffset+=a; +} + +void PaintingArea::getMoveLeft(int a){ + layerStructure[activeLayer].widthOffset-=a; +} + +void PaintingArea::getMoveLayerUp(){ + if(activeLayer=0){ + std::swap(layerStructure[activeLayer], layerStructure[activeLayer+1]); + activeLayer++; + } +} + +void PaintingArea::getMoveLayerDown(){ + if(activeLayer>0){ + std::swap(layerStructure[activeLayer], layerStructure[activeLayer-1]); + activeLayer--; + } +} + +// If a mouse button is pressed check if it was the +// left button and if so store the current position +// Set that we are currently drawing +void PaintingArea::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + if(this->activeLayer==-1){ + return; + } + LayerObject& active = layerStructure[activeLayer]; + + int x = event->x()-active.widthOffset; + int y = event->y()-active.heightOffset; + //TODO CALCULATE LAST POINT + lastPoint=QPoint(x,y); + scribbling = true; + } +} + + +// When the mouse moves if the left button is clicked +// we call the drawline function which draws a line +// from the last position to the current +void PaintingArea::mouseMoveEvent(QMouseEvent *event) +{ + + if ((event->buttons() & Qt::LeftButton) && scribbling){ + if(this->activeLayer==-1){ + return; + } + LayerObject& active = layerStructure[activeLayer]; + + int x = event->x()-active.widthOffset; + int y = event->y()-active.heightOffset; + + //TODO CALCULATE NEW POINT + drawLineTo(QPoint(x,y)); + update(); + } +} + +// If the button is released we set variables to stop drawing +void PaintingArea::mouseReleaseEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton && scribbling) { + if(this->activeLayer==-1){ + return; + } + LayerObject& active = layerStructure[activeLayer]; + + int x = event->x()-active.widthOffset; + int y = event->y()-active.heightOffset; + + //TODO CALCULATE NEW POINT + drawLineTo(QPoint(x,y)); + update(); + scribbling = false; + } +} + +// QPainter provides functions to draw on the widget +// The QPaintEvent is sent to widgets that need to +// update themselves +void PaintingArea::paintEvent(QPaintEvent *event) +{ + this->assembleLayers(); + + QPainter painter(this); + QRect dirtyRec = event->rect(); + painter.drawImage(dirtyRec, *Canvas, dirtyRec); + update(); +} + +// Resize the image to slightly larger then the main window +// 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); + update(); +} + +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); + lastPoint = endPoint; + update(); +} + +void PaintingArea::resizeImage(QImage *image_res, const QSize &newSize){ + image_res->scaled(newSize,Qt::IgnoreAspectRatio); +} + +void PaintingArea::assembleLayers(bool forSaving){ + if(forSaving){ + Canvas->fill(Qt::GlobalColor::transparent); + }else{ + Canvas->fill(Qt::GlobalColor::black); + } + //TODO interpolation of alpha for saving + for(size_t i=0; igetDisplayable(layer.alpha); + QColor clr_0; + QColor clr_1; + for(int y=0; ypixelColor(layer.widthOffset+x, layer.heightOffset+y); + clr_1=cpy.pixelColor(x,y); + float t = (float)clr_1.alpha()/255.f; + int r =(float)clr_1.red()*(t)+(float)clr_0.red()*(1.-t); + int g =(float)clr_1.green()*(t)+(float)clr_0.green()*(1.-t); + int b =(float)clr_1.blue()*(t)+(float)clr_0.blue()*(1.-t); + int a =std::min(clr_0.alpha()+clr_1.alpha(), 255); + clr_0.setRed(r); + clr_0.setGreen(g); + clr_0.setBlue(b); + clr_0.setAlpha(a); + + Canvas->setPixelColor(layer.widthOffset+x, layer.heightOffset+y, clr_0); + } + } + } +} + diff --git a/IntelliPhoto/Painting/Layer/PaintingArea.h b/IntelliPhoto/Painting/Layer/PaintingArea.h new file mode 100644 index 0000000..6346687 --- /dev/null +++ b/IntelliPhoto/Painting/Layer/PaintingArea.h @@ -0,0 +1,110 @@ + +#ifndef PaintingArea_H +#define PaintingArea_H + +#include +#include +#include"Image/IntelliImage.h" +#include +#include +#include + +class PaintingArea : public QWidget +{ + // Declares our class as a QObject which is the base class + // for all Qt objects + // QObjects handle events + Q_OBJECT + +public: + PaintingArea(int maxWidth=1000, int maxHeight=800, 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); + + // 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; } + + + QPixmap getAsPixmap(); +public slots: + + // Events to handle + void clearImage(int r, int g, int b); + void activate(int a); + + void setAlpha(int a); + void getMoveUp(int a); + void getMoveDown(int a); + void getMoveRight(int a); + void getMoveLeft(int a); + void getMoveLayerUp(); + void getMoveLayerDown(); + //void setUp helper for konstruktor + void setUp(int maxWidth, int maxHeight); +protected: + void mousePressEvent(QMouseEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; + void mouseReleaseEvent(QMouseEvent *event) override; + + // Updates the painting area where we are painting + void paintEvent(QPaintEvent *event) override; + + // Makes sure the area we are drawing on remains + // as large as the widget + void resizeEvent(QResizeEvent *event) override; + +private: + struct LayerObject{ + IntelliImage* image; + int width; + int height; + int widthOffset; + int heightOffset; + int alpha=255; + }; + + QImage* Canvas; + int maxWidth; + int maxHeight; + + std::vector layerStructure; + int activeLayer=-1; + + void assembleLayers(bool forSaving=false); + + void drawLineTo(const QPoint &endPoint); + void resizeImage(QImage *image_res, const QSize &newSize); + + // Will be marked true or false depending on if + // we have saved after a change + bool modified=false; + + // Marked true or false depending on if the user + // is drawing + bool scribbling; + + // Holds the current pen width & color + int myPenWidth; + QColor myPenColor; + + // Stores the image being drawn + + // Stores the location at the current mouse event + QPoint lastPoint; +}; + +#endif + diff --git a/IntelliPhoto/Painting/Scribble.pro.user.426164d b/IntelliPhoto/Painting/Scribble.pro.user.426164d new file mode 100644 index 0000000..572799d --- /dev/null +++ b/IntelliPhoto/Painting/Scribble.pro.user.426164d @@ -0,0 +1,337 @@ + + + + + + EnvironmentId + {426164d9-3771-4235-8f83-cb0b49423ffc} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.12.5 MinGW 64-bit + Desktop Qt 5.12.5 MinGW 64-bit + qt.qt5.5125.win64_mingw73_kit + 0 + 0 + 0 + + C:/Users/jonas/OneDrive/Desktop/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Users/jonas/OneDrive/Desktop/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + C:/Users/jonas/OneDrive/Desktop/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Erstellen + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Bereinigen + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + Deployment + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deployment-Konfiguration + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Scribble + Scribble2 + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/jonas/OneDrive/Documents/GitHub/intelliphoto/IntelliPhoto/Scribble/Scribble.pro + + 3768 + false + true + true + false + false + true + + C:/Users/jonas/OneDrive/Desktop/build-Scribble-Desktop_Qt_5_12_5_MinGW_64_bit-Debug + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/IntelliPhoto/Painting/icon.ico b/IntelliPhoto/Painting/icon.ico new file mode 100644 index 0000000..f21cd00 Binary files /dev/null and b/IntelliPhoto/Painting/icon.ico differ diff --git a/IntelliPhoto/Painting/main.cpp b/IntelliPhoto/Painting/main.cpp new file mode 100644 index 0000000..6ada0cb --- /dev/null +++ b/IntelliPhoto/Painting/main.cpp @@ -0,0 +1,20 @@ +#include "GUI/IntelliPhotoGui.h" +#include +#include + +int main(int argc, char *argv[]) +{ + // The main application + QApplication app(argc, argv); + + //some nice ass looking comment + // Create and open the main window + IntelliPhotoGui window; + window.show(); + + return app.exec(); +} + + + + diff --git a/IntelliPhoto/Painting/widget.ui b/IntelliPhoto/Painting/widget.ui new file mode 100644 index 0000000..b90248d --- /dev/null +++ b/IntelliPhoto/Painting/widget.ui @@ -0,0 +1,19 @@ + + + Widget + + + + 0 + 0 + 800 + 600 + + + + Widget + + + + + diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..2829667 Binary files /dev/null and b/icon.png differ diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..ab6ba5b --- /dev/null +++ b/icon.svg @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +