mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-14 12:20:32 +02:00
some fixes
only unused Variable and shadowing left
This commit is contained in:
@@ -49,8 +49,8 @@ void IntelliTool::onWheelScrolled(int value){
|
||||
|
||||
void IntelliTool::createToolLayer(){
|
||||
Area->createTempLayerAfter(Area->activeLayer);
|
||||
this->Active=&Area->layerBundle[Area->activeLayer];
|
||||
this->Canvas=&Area->layerBundle[Area->activeLayer+1];
|
||||
this->Active=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer)];
|
||||
this->Canvas=&Area->layerBundle[static_cast<unsigned long long>(Area->activeLayer+1)];
|
||||
}
|
||||
|
||||
void IntelliTool::mergeToolLayer(){
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "IntelliHelper/IntelliColorPicker.h"
|
||||
#include <vector>
|
||||
|
||||
class LayerObject;
|
||||
struct LayerObject;
|
||||
class PaintingArea;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -22,18 +22,18 @@ void IntelliToolCircle::drawCyrcle(int radius){
|
||||
yMax = Middle.y()+radius;
|
||||
// x = x0+-sqrt(r2-(y-y0)2)
|
||||
for(int i=yMin; i<=yMax; i++) {
|
||||
xMin = Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2));
|
||||
xMax = Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2));
|
||||
xMin = static_cast<int>(Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
|
||||
xMax = static_cast<int>(Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
|
||||
this->Canvas->image->drawLine(QPoint(xMin,i), QPoint(xMax,i),inner,1);
|
||||
}
|
||||
|
||||
//TODO implement circle drawing algorithm bresenham
|
||||
radius = radius +(this->edgeWidth/2.)-1.;
|
||||
radius = static_cast<int>(radius +(this->edgeWidth/2.)-1.);
|
||||
yMin = (Middle.y()-radius);
|
||||
yMax = (Middle.y()+radius);
|
||||
for(int i=yMin; i<=yMax; i++) {
|
||||
xMin = Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2));
|
||||
xMax = Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2));
|
||||
xMin = static_cast<int>(Middle.x()-sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
|
||||
xMax = static_cast<int>(Middle.x()+sqrt(pow(radius,2)-pow(i-Middle.y(),2)));
|
||||
this->Canvas->image->drawPoint(QPoint(xMin,i), colorPicker->getFirstColor(),edgeWidth);
|
||||
this->Canvas->image->drawPoint(QPoint(xMax,i), colorPicker->getFirstColor(),edgeWidth);
|
||||
}
|
||||
@@ -41,8 +41,8 @@ void IntelliToolCircle::drawCyrcle(int radius){
|
||||
xMin = (Middle.x()-radius);
|
||||
xMax = (Middle.x()+radius);
|
||||
for(int i=xMin; i<=xMax; i++) {
|
||||
int yMin = Middle.y()-sqrt(pow(radius,2)-pow(i-Middle.x(),2));
|
||||
int yMax = Middle.y()+sqrt(pow(radius,2)-pow(i-Middle.x(),2));
|
||||
int yMin = static_cast<int>(Middle.y()-sqrt(pow(radius,2)-pow(i-Middle.x(),2)));
|
||||
int yMax = static_cast<int>(Middle.y()+sqrt(pow(radius,2)-pow(i-Middle.x(),2)));
|
||||
this->Canvas->image->drawPoint(QPoint(i, yMin), colorPicker->getFirstColor(),edgeWidth);
|
||||
this->Canvas->image->drawPoint(QPoint(i, yMax), colorPicker->getFirstColor(),edgeWidth);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void IntelliToolLine::onMouseMoved(int x, int y){
|
||||
case LineStyle::DOTTED_LINE:
|
||||
QPoint p1 =start.x() <= next.x() ? start : next;
|
||||
QPoint p2 =start.x() < next.x() ? next : start;
|
||||
int m = (float)(p2.y()-p1.y())/(float)(p2.x()-p1.x())+0.5f;
|
||||
int m = static_cast<int>((p2.y()-p1.y())/(p2.x()-p1.x())+0.5f);
|
||||
int c = start.y()-start.x()*m;
|
||||
|
||||
break;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
IntelliToolPolygon::IntelliToolPolygon(PaintingArea* Area, IntelliColorPicker* colorPicker)
|
||||
: IntelliTool(Area, colorPicker){
|
||||
this->alphaInner = QInputDialog::getInt(nullptr,"Inner Alpha Value", "Value:", 0,0,255,1);
|
||||
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);;
|
||||
lineWidth = QInputDialog::getInt(nullptr,"Line Width Input", "Width",1,1,50,1);
|
||||
PointIsNearStart = false;
|
||||
isDrawing = false;
|
||||
}
|
||||
@@ -63,9 +63,9 @@ void IntelliToolPolygon::onMouseLeftReleased(int x, int y){
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int i=0; i<QPointList.size(); i++) {
|
||||
int next = (i+1)%QPointList.size();
|
||||
this->Canvas->image->drawLine(QPointList[i], QPointList[next], colorPicker->getFirstColor(), lineWidth);
|
||||
for(int i=0; i<static_cast<int>(QPointList.size()); i++) {
|
||||
int next = static_cast<int>((i+static_cast<int>(1))%static_cast<int>(QPointList.size()));
|
||||
this->Canvas->image->drawLine(QPointList[static_cast<unsigned long long>(i)], QPointList[static_cast<unsigned long long>(next)], colorPicker->getFirstColor(), lineWidth);
|
||||
}
|
||||
QPointList.clear();
|
||||
IntelliTool::onMouseLeftReleased(x,y);
|
||||
|
||||
Reference in New Issue
Block a user