Update Gradient und UML

@DerAnonymos
@AshBastian
This commit is contained in:
Jan Schuffenhauer
2020-02-03 16:04:01 +01:00
parent fda9e89fa8
commit 5ac556f71c
4 changed files with 287 additions and 197 deletions

View File

@@ -1,17 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<diagram program="umlet" version="14.3.0">
<zoom_level>10</zoom_level>
<zoom_level>6</zoom_level>
<element>
<id>UMLClass</id>
<coordinates>
<x>2220</x>
<y>90</y>
<w>320</w>
<h>180</h>
<x>1338</x>
<y>84</y>
<w>192</w>
<h>120</h>
</coordinates>
<panel_attributes>/*IntelliImage*/
--
#imageData: QImage
-isFastRendering: Boolean
--
#resizeImage(image, newSize): void
+drawPixel(p1, color): void
@@ -26,10 +27,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>2230</x>
<y>400</y>
<w>310</w>
<h>80</h>
<x>1344</x>
<y>270</y>
<w>186</w>
<h>48</h>
</coordinates>
<panel_attributes>*IntelliRasterImage*
--
@@ -42,10 +43,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>2220</x>
<y>680</y>
<w>320</w>
<h>150</h>
<x>1338</x>
<y>438</y>
<w>192</w>
<h>90</h>
</coordinates>
<panel_attributes>*IntelliShapedImage*
--
@@ -62,10 +63,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>380</x>
<y>90</y>
<w>290</w>
<h>230</h>
<x>744</x>
<y>366</y>
<w>174</w>
<h>150</h>
</coordinates>
<panel_attributes>/*IntelliTool*/
--
@@ -74,6 +75,7 @@
#Active: LayerObject
#Canvas: LayerObject
#drawing: Boolean
#ActiveType: Tooltype
--
/+onMouseRightPressed(x,y): void/
/+onMouseLeftPressed(x,y): void/
@@ -87,21 +89,21 @@
<element>
<id>Relation</id>
<coordinates>
<x>2310</x>
<y>260</y>
<w>30</w>
<h>160</h>
<x>1392</x>
<y>198</y>
<w>18</w>
<h>84</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;140.0</additional_attributes>
<additional_attributes>10.0;10.0;10.0;120.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>2310</x>
<y>470</y>
<w>30</w>
<h>230</h>
<x>1392</x>
<y>312</y>
<w>18</w>
<h>138</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;210.0</additional_attributes>
@@ -109,10 +111,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>1440</x>
<y>200</y>
<w>240</w>
<h>80</h>
<x>870</x>
<y>210</y>
<w>144</w>
<h>48</h>
</coordinates>
<panel_attributes>&lt;&lt;Enumeration&gt;&gt;
*ImageType*
@@ -124,10 +126,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>140</x>
<y>940</y>
<w>250</w>
<h>150</h>
<x>432</x>
<y>810</y>
<w>150</w>
<h>90</h>
</coordinates>
<panel_attributes>*IntelliToolFloodFill*
--
@@ -144,10 +146,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>140</x>
<y>480</y>
<w>250</w>
<h>150</h>
<x>432</x>
<y>564</y>
<w>150</w>
<h>90</h>
</coordinates>
<panel_attributes>*IntelliToolPlain*
--
@@ -164,15 +166,16 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>1020</x>
<y>480</y>
<w>240</w>
<h>180</h>
<x>876</x>
<y>774</y>
<w>144</w>
<h>120</h>
</coordinates>
<panel_attributes>*IntelliToolPen*
<panel_attributes>*IntelliToolGradient*
--
-penWidth: Integer
-point: QPoint
-startPoint: QPoint
-endPoint: QPoint
-LineColor: QColor
--
+onMouseRightPressed(x,y): void
+onMouseLeftPressed(x,y): void
@@ -186,10 +189,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>1020</x>
<y>960</y>
<w>250</w>
<h>180</h>
<x>1122</x>
<y>780</y>
<w>150</w>
<h>108</h>
</coordinates>
<panel_attributes>*IntelliToolRectangle*
--
@@ -208,10 +211,10 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>1020</x>
<y>700</y>
<w>240</w>
<h>200</h>
<x>1128</x>
<y>642</y>
<w>144</w>
<h>120</h>
</coordinates>
<panel_attributes>*IntelliToolLine*
--
@@ -231,15 +234,15 @@
<element>
<id>UMLClass</id>
<coordinates>
<x>490</x>
<y>670</y>
<w>250</w>
<h>210</h>
<x>672</x>
<y>768</y>
<w>150</w>
<h>126</h>
</coordinates>
<panel_attributes>*IntelliToolPolygon*
--
-lineWidth: Integer
-isDrawing: Boolean
-isDrawingOfPolygon: Boolean
-PointIsNearStart: Boolean
-alphaInner: Integer
--
@@ -255,76 +258,76 @@
<element>
<id>Relation</id>
<coordinates>
<x>640</x>
<y>310</y>
<w>400</w>
<h>190</h>
<x>816</x>
<y>510</y>
<w>210</w>
<h>276</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;380.0;170.0</additional_attributes>
<additional_attributes>10.0;10.0;330.0;440.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>380</x>
<y>310</y>
<w>100</w>
<h>650</h>
<x>576</x>
<y>510</y>
<w>228</w>
<h>312</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>80.0;10.0;10.0;630.0</additional_attributes>
<additional_attributes>360.0;10.0;10.0;500.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>250</x>
<y>310</y>
<w>160</w>
<h>190</h>
<x>498</x>
<y>510</y>
<w>264</w>
<h>66</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>140.0;10.0;10.0;170.0</additional_attributes>
<additional_attributes>420.0;10.0;10.0;90.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>510</x>
<y>310</y>
<w>540</w>
<h>670</h>
<x>834</x>
<y>510</y>
<w>306</w>
<h>282</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;520.0;650.0</additional_attributes>
<additional_attributes>10.0;10.0;490.0;450.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>560</x>
<y>310</y>
<w>480</w>
<h>410</h>
<x>858</x>
<y>510</y>
<w>282</w>
<h>144</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;460.0;390.0</additional_attributes>
<additional_attributes>10.0;10.0;450.0;220.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>480</x>
<y>310</y>
<w>140</w>
<h>380</h>
<x>732</x>
<y>510</y>
<w>90</w>
<h>270</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;120.0;360.0</additional_attributes>
<additional_attributes>130.0;10.0;10.0;430.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>140</x>
<y>680</y>
<w>250</w>
<h>200</h>
<x>432</x>
<y>684</y>
<w>150</w>
<h>120</h>
</coordinates>
<panel_attributes>*IntelliToolCircle*
--
@@ -344,21 +347,21 @@
<element>
<id>Relation</id>
<coordinates>
<x>380</x>
<y>310</y>
<w>80</w>
<h>390</h>
<x>576</x>
<y>510</y>
<w>216</w>
<h>186</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>60.0;10.0;10.0;370.0</additional_attributes>
<additional_attributes>340.0;10.0;10.0;290.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1930</x>
<y>90</y>
<w>280</w>
<h>410</h>
<x>1164</x>
<y>84</y>
<w>168</w>
<h>246</h>
</coordinates>
<panel_attributes>*PaintingArea*
--
@@ -394,10 +397,10 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>1690</x>
<y>90</y>
<w>230</w>
<h>150</h>
<x>1020</x>
<y>84</y>
<w>138</w>
<h>90</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*LayerObject*
@@ -414,42 +417,30 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>830</x>
<y>90</y>
<w>320</w>
<x>324</x>
<y>150</y>
<w>192</w>
<h>78</h>
</coordinates>
<panel_attributes>/*IntelliToolSetttings*/
--
-lineWidth: Integer
-innerAlpha: Integer
--
+getInnerAlpha(): Integer
+setInnerAlpha( innerAlpha): void
+getLineWidth(): Integer
+setLineWidth( LineWidth): void</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>522</x>
<y>84</y>
<w>150</w>
<h>90</h>
</coordinates>
<panel_attributes>/*IntelliHelper*/
--
--
+isInTriangle(tri, P): Boolean
+calculateTriangles(polyPoints): vector&lt;Triangle&gt;
+isInPolygon(triangles, point): Boolean</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1440</x>
<y>90</y>
<w>240</w>
<h>80</h>
</coordinates>
<panel_attributes>&lt;&lt;Enumeration&gt;&gt;
*LineStyle*
--
SOLID
DOTTED</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1180</x>
<y>90</y>
<w>250</w>
<h>150</h>
</coordinates>
<panel_attributes>/*IntelliColorPicker*/
--
-firstColor: QColor
@@ -465,10 +456,10 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>1690</x>
<y>250</y>
<w>230</w>
<h>100</h>
<x>1020</x>
<y>180</y>
<w>138</w>
<h>60</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*Triangle*
@@ -482,10 +473,10 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>1690</x>
<y>360</y>
<w>230</w>
<h>70</h>
<x>1020</x>
<y>246</y>
<w>138</w>
<h>42</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*QImage*
@@ -498,10 +489,10 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>1690</x>
<y>440</y>
<w>230</w>
<h>70</h>
<x>1020</x>
<y>294</y>
<w>138</w>
<h>42</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*QPoint*
@@ -514,10 +505,81 @@ group=1</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>1690</x>
<y>530</y>
<w>230</w>
<h>90</h>
<x>1020</x>
<y>348</y>
<w>138</w>
<h>42</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*QColor*
--
--
--
Cotains RGBA Color Data.</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1128</x>
<y>516</y>
<w>144</w>
<h>108</h>
</coordinates>
<panel_attributes>*IntelliToolPen*
--
-penWidth: Integer
-point: QPoint
--
+onMouseRightPressed(x,y): void
+onMouseLeftPressed(x,y): void
+onMouseRightReleased(x,y): void
+onMousLeftReleased(x,y): void
+onWheelScrolled(value): void
+onMouseMoved(x,y): void
...</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>912</x>
<y>498</y>
<w>228</w>
<h>30</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;360.0;30.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>870</x>
<y>84</y>
<w>144</w>
<h>114</h>
</coordinates>
<panel_attributes>&lt;&lt;Enumeration&gt;&gt;
*Tooltype*
--
CIRCLE
FLOODFILL
GRADIENT
LINE
PEN
PLAIN
POLYGON
RECTANGLE
NONE</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>1020</x>
<y>408</y>
<w>138</w>
<h>54</h>
</coordinates>
<panel_attributes>&lt;&lt;dataType&gt;&gt;
*vector&lt;T&gt;*
@@ -528,4 +590,51 @@ group=1</panel_attributes>
data with equal type as type T.</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>324</x>
<y>84</y>
<w>192</w>
<h>54</h>
</coordinates>
<panel_attributes>/*IntelliRenderSettings*/
--
-fastRendering: Boolean
--
+isFastRendering(): Boolean
+setFastRendering(Updatesetting): void</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>324</x>
<y>240</y>
<w>192</w>
<h>54</h>
</coordinates>
<panel_attributes>/*IntelliTriangulation*/
--
--
+isInTriangle(tri, P): Boolean
+calculateTriangles(polyPoints): vector&lt;Triangle&gt;
+isInPolygon(triangles, point): Boolean</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>684</x>
<y>84</y>
<w>174</w>
<h>48</h>
</coordinates>
<panel_attributes>&lt;&lt;NAMESPACE&gt;&gt;
*IntelliDatamanager*
--
::loadProject(Canvas, filePath): Boolean
::saveProject(Canvas, filePath): Boolean</panel_attributes>
<additional_attributes/>
</element>
</diagram>

View File

@@ -1,4 +1,4 @@
#ifndef INTELLIDATAMANAGER_H
#ifndef INTELLIDATAMANAGER_H
#define INTELLIDATAMANAGER_H
#include <QFile>

View File

@@ -44,11 +44,6 @@ void IntelliToolGradient::onMouseMoved(int x, int y){
if(this->isDrawing) {
hasMoved = true;
endPoint = QPoint(x,y);
VectorStartEnd[0] = static_cast<float>(endPoint.x() - startPoint.x());
VectorStartEnd[1] = static_cast<float>(endPoint.y() - startPoint.y());
NormalVector[0] = VectorStartEnd[1];
NormalVector[1] = (-1 * VectorStartEnd[0]);
NormalDotNormal = dotProduct(NormalVector,NormalVector);
this->Canvas->image->drawPlain(Qt::transparent);
computeGradientLayer();
Canvas->image->drawLine(startPoint,endPoint,LineColor,1);
@@ -60,7 +55,7 @@ void IntelliToolGradient::onWheelScrolled(int value){
IntelliTool::onWheelScrolled(value);
}
void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){
void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point, int FirstColor[4], int SecondColor[4], double NormalVector[2], double NormalDotNormal){
double doublePoint[2];
doublePoint[0] = static_cast<double>(Point.x());
doublePoint[1] = static_cast<double>(Point.y());
@@ -88,20 +83,10 @@ void IntelliToolGradient::computeAndDrawPixelColor(QPoint Point){
computedColor = colorPicker->getSecondColor();
}
else{
int red;
int green;
int blue;
int alpha;
int red2;
int green2;
int blue2;
int alpha2;
colorPicker->getFirstColor().getRgb(&red,&green,&blue,&alpha);
colorPicker->getSecondColor().getRgb(&red2,&green2,&blue2,&alpha2);
computedColor.setRed(static_cast<int>(ratio * red2 + (1 - ratio) * red));
computedColor.setGreen(static_cast<int>(ratio * green2 + (1 - ratio) * green));
computedColor.setBlue(static_cast<int>(ratio * blue2 + (1 - ratio) * blue));
computedColor.setAlpha(static_cast<int>(ratio * alpha2 + (1 - ratio) * alpha));
computedColor.setRed(static_cast<int>(ratio * SecondColor[0] + (1 - ratio) * FirstColor[0]));
computedColor.setGreen(static_cast<int>(ratio * SecondColor[1] + (1 - ratio) * FirstColor[1]));
computedColor.setBlue(static_cast<int>(ratio * SecondColor[2] + (1 - ratio) * FirstColor[2]));
computedColor.setAlpha(static_cast<int>(ratio * SecondColor[3] + (1 - ratio) * FirstColor[3]));
}
Canvas->image->drawPixel(Point,computedColor);
}
@@ -115,17 +100,23 @@ double IntelliToolGradient::lenghtVector(double Vector[2]){
}
void IntelliToolGradient::computeGradientLayer(){
bool switched = false;
if(Canvas->image->isFastRendering()) {
switched = true;
Canvas->image->updateRendererSetting(false);
}
for(int i = 0; i < activeLayer->height; i++) {
int FirstColor[4];
colorPicker->getFirstColor().getRgb(&FirstColor[0],&FirstColor[1],&FirstColor[2],&FirstColor[3]);
int SecondColor[4];
colorPicker->getSecondColor().getRgb(&SecondColor[0],&SecondColor[1],&SecondColor[2],&SecondColor[3]);
double NormalVector[2];
double NormalDotNormal;
VectorStartEnd[0] = static_cast<double>(endPoint.x() - startPoint.x());
VectorStartEnd[1] = static_cast<double>(endPoint.y() - startPoint.y());
NormalVector[0] = VectorStartEnd[1];
NormalVector[1] = (-1 * VectorStartEnd[0]);
NormalDotNormal = dotProduct(NormalVector,NormalVector);
for(int i = 0; i < activeLayer->height; i++) {
for(int j = 0; j < activeLayer->width; j++) {
computeAndDrawPixelColor(QPoint(j,i));
computeAndDrawPixelColor(QPoint(j,i), FirstColor, SecondColor, NormalVector, NormalDotNormal);
}
}
if(switched) {
Canvas->image->updateRendererSetting(true);
}
}

View File

@@ -82,16 +82,6 @@ double doubleStartPoint[2];
*/
double VectorStartEnd[2];
/*!
* \brief NormalVector of the VectorStartEnd
*/
double NormalVector[2];
/*!
* \brief NormalDotNormal dot product of Normal*Normal
*/
double NormalDotNormal;
/*!
* \brief LineColor color of th line.
*/
@@ -106,7 +96,7 @@ bool hasMoved;
* \brief computeAndDrawPixelColor computes the pixelcolor for a given point and sets it to the image.
* \param Point the point which shoud be computed
*/
void computeAndDrawPixelColor(QPoint Point);
void computeAndDrawPixelColor(QPoint Point, int FirstColor[4], int SecondColor[4], double NormalVector[2], double NormalDotNormal);
/*!
* \brief dotProduct calculates the dot product of 2 vetors.