mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 04:10:31 +02:00
fixed every known warning from cppcheck
done.
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
#include "IntelliColorPicker.h"
|
#include "IntelliColorPicker.h"
|
||||||
|
|
||||||
IntelliColorPicker::IntelliColorPicker(){
|
IntelliColorPicker::IntelliColorPicker(){
|
||||||
firstColor = QColor(255,0,0,255);
|
initializeColors();
|
||||||
secondColor = QColor(0,255,255,255);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IntelliColorPicker::~IntelliColorPicker(){
|
IntelliColorPicker::~IntelliColorPicker(){
|
||||||
@@ -28,3 +27,8 @@ void IntelliColorPicker::setFirstColor(QColor Color){
|
|||||||
void IntelliColorPicker::setSecondColor(QColor Color){
|
void IntelliColorPicker::setSecondColor(QColor Color){
|
||||||
this->secondColor = Color;
|
this->secondColor = Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntelliColorPicker::initializeColors(){
|
||||||
|
this->firstColor = QColor(255,0,0,255);
|
||||||
|
this->secondColor = QColor(0,0,0,255);
|
||||||
|
}
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ QColor firstColor;
|
|||||||
* \brief The secondary color.
|
* \brief The secondary color.
|
||||||
*/
|
*/
|
||||||
QColor secondColor;
|
QColor secondColor;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief initializeColors initializes the first and second color.
|
||||||
|
*/
|
||||||
|
void initializeColors();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -15,30 +15,30 @@ IntelliToolCircle::~IntelliToolCircle(){
|
|||||||
void IntelliToolCircle::drawCircle(int radius){
|
void IntelliToolCircle::drawCircle(int radius){
|
||||||
QColor inner = this->colorPicker->getSecondColor();
|
QColor inner = this->colorPicker->getSecondColor();
|
||||||
inner.setAlpha(Toolsettings->getInnerAlpha());
|
inner.setAlpha(Toolsettings->getInnerAlpha());
|
||||||
int yMin, yMax, xMin, xMax;
|
int yMinimum, yMaximum, xMinimum, xMaximum;
|
||||||
yMin = centerPoint.y() - radius;
|
yMinimum = centerPoint.y() - radius;
|
||||||
yMax = centerPoint.y() + radius;
|
yMaximum = centerPoint.y() + radius;
|
||||||
// x = x0+-sqrt(r2-(y-y0)2)
|
// x = x0+-sqrt(r2-(y-y0)2)
|
||||||
for(int i = yMin; i<=yMax; i++) {
|
for(int i = yMinimum; i<=yMaximum; i++) {
|
||||||
xMin = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
||||||
xMax = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
||||||
this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1);
|
this->Canvas->image->drawLine(QPoint(xMinimum,i), QPoint(xMaximum,i),inner,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO implement circle drawing algorithm bresenham
|
//TODO implement circle drawing algorithm bresenham
|
||||||
radius = static_cast<int>(radius + (Toolsettings->getLineWidth() / 2.));
|
radius = static_cast<int>(radius + (Toolsettings->getLineWidth() / 2.));
|
||||||
yMin = (centerPoint.y() - radius);
|
yMinimum = (centerPoint.y() - radius);
|
||||||
yMax = (centerPoint.y() + radius);
|
yMaximum = (centerPoint.y() + radius);
|
||||||
for(int i = yMin; i<=yMax; i++) {
|
for(int i = yMinimum; i<=yMaximum; i++) {
|
||||||
xMin = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
xMinimum = static_cast<int>(centerPoint.x() - sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
||||||
xMax = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
xMaximum = static_cast<int>(centerPoint.x() + sqrt(pow(radius,2) - pow(i - centerPoint.y(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(xMinimum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(xMaximum,i), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
xMin = (centerPoint.x() - radius);
|
xMinimum = (centerPoint.x() - radius);
|
||||||
xMax = (centerPoint.x() + radius);
|
xMaximum = (centerPoint.x() + radius);
|
||||||
for(int i = xMin; i<=xMax; i++) {
|
for(int i = xMinimum; i<=xMaximum; i++) {
|
||||||
int yMin = static_cast<int>(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
|
int yMin = static_cast<int>(centerPoint.y() - sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
|
||||||
int yMax = static_cast<int>(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
|
int yMax = static_cast<int>(centerPoint.y() + sqrt(pow(radius,2) - pow(i - centerPoint.x(),2)));
|
||||||
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),Toolsettings->getLineWidth());
|
||||||
|
|||||||
Reference in New Issue
Block a user