mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-13 03:40:31 +02:00
Moved up src/ one level
This commit is contained in:
30
src/IntelliHelper/IntelliColorPicker.cpp
Normal file
30
src/IntelliHelper/IntelliColorPicker.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#include "IntelliColorPicker.h"
|
||||
|
||||
IntelliColorPicker::IntelliColorPicker(){
|
||||
firstColor = {255,0,0,255};
|
||||
secondColor = {0,0,255,255};
|
||||
}
|
||||
|
||||
IntelliColorPicker::~IntelliColorPicker(){
|
||||
|
||||
}
|
||||
|
||||
void IntelliColorPicker::switchColors(){
|
||||
std::swap(firstColor, secondColor);
|
||||
}
|
||||
|
||||
QColor IntelliColorPicker::getFirstColor(){
|
||||
return this->firstColor;
|
||||
}
|
||||
|
||||
QColor IntelliColorPicker::getSecondColor(){
|
||||
return this->secondColor;
|
||||
}
|
||||
|
||||
void IntelliColorPicker::setFirstColor(QColor Color){
|
||||
this->firstColor = Color;
|
||||
}
|
||||
|
||||
void IntelliColorPicker::setSecondColor(QColor Color){
|
||||
this->secondColor = Color;
|
||||
}
|
||||
26
src/IntelliHelper/IntelliColorPicker.h
Normal file
26
src/IntelliHelper/IntelliColorPicker.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef INTELLITOOLSETCOLORTOOL_H
|
||||
#define INTELLITOOLSETCOLORTOOL_H
|
||||
|
||||
#include"QColor"
|
||||
#include"QPoint"
|
||||
#include"QColorDialog"
|
||||
|
||||
class IntelliColorPicker{
|
||||
public:
|
||||
IntelliColorPicker();
|
||||
virtual ~IntelliColorPicker();
|
||||
|
||||
void switchColors();
|
||||
|
||||
QColor getFirstColor();
|
||||
QColor getSecondColor();
|
||||
|
||||
void setFirstColor(QColor Color);
|
||||
void setSecondColor(QColor Color);
|
||||
|
||||
private:
|
||||
QColor firstColor;
|
||||
QColor secondColor;
|
||||
};
|
||||
|
||||
#endif // INTELLITOOLSETCOLORTOOL_H
|
||||
4
src/IntelliHelper/IntelliHelper.cpp
Normal file
4
src/IntelliHelper/IntelliHelper.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
#include"IntelliHelper.h"
|
||||
#include<algorithm>
|
||||
|
||||
|
||||
31
src/IntelliHelper/IntelliHelper.h
Normal file
31
src/IntelliHelper/IntelliHelper.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef INTELLIHELPER_H
|
||||
#define INTELLIHELPER_H
|
||||
|
||||
#include<QPoint>
|
||||
|
||||
|
||||
class IntelliHelper{
|
||||
|
||||
public:
|
||||
|
||||
static inline float sign(QPoint& p1, QPoint& p2, QPoint& p3){
|
||||
return (p1.x()-p3.x())*(p2.y()-p3.y())-(p2.x()-p3.x())*(p1.y()-p3.y());
|
||||
}
|
||||
|
||||
|
||||
static inline bool isInTriangle(QPoint& A, QPoint& B, QPoint& C, QPoint& P){
|
||||
float val1, val2, val3;
|
||||
bool neg, pos;
|
||||
|
||||
val1 = IntelliHelper::sign(P,A,B);
|
||||
val2 = IntelliHelper::sign(P,B,C);
|
||||
val3 = IntelliHelper::sign(P,C,A);
|
||||
|
||||
neg = (val1<0.f) || (val2<0.f) || (val3<0.f);
|
||||
pos = (val1>0.f) || (val2>0.f) || (val3>0.f);
|
||||
|
||||
return !(neg && pos);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user