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