feat (wip): gui
This commit is contained in:
0
src/core/CLI.cpp
Normal file
0
src/core/CLI.cpp
Normal file
0
src/core/CLI.h
Normal file
0
src/core/CLI.h
Normal file
25
src/core/CLIParser.cpp
Normal file
25
src/core/CLIParser.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
// #include <cstddef>
|
||||
// #include <getopt.h>
|
||||
// int main(int argc, char* argv[]) {
|
||||
// // CLI parsing code. TODO: move to core somewhere
|
||||
// option longopts[] = {
|
||||
// {"number", optional_argument, NULL, 'n'},
|
||||
// {"show-ends", optional_argument, NULL, 'E'}, {0}};
|
||||
//
|
||||
// while (1) {
|
||||
// const int opt = getopt_long(argc, argv, "nE::", longopts, 0);
|
||||
//
|
||||
// if (opt == -1) {
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// switch (opt) {
|
||||
// case 'n':
|
||||
// // ...
|
||||
// case 'E':
|
||||
// // ...
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //...
|
||||
// }
|
||||
0
src/core/CLIParser.h
Normal file
0
src/core/CLIParser.h
Normal file
35
src/core/Colour.cpp
Normal file
35
src/core/Colour.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "Colour.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
using namespace core;
|
||||
|
||||
|
||||
Colour::Colour(const float r, const float g, const float b) {
|
||||
this->len = sqrt(r*r + g*g + b*b);
|
||||
|
||||
this->r = r;
|
||||
this->g = g;
|
||||
this->b = b;
|
||||
}
|
||||
|
||||
|
||||
Colour::~Colour() {
|
||||
}
|
||||
|
||||
|
||||
char* Colour::toString() {
|
||||
sprintf(this->str, "%3.0f %3.0f %3.0f", round(this->r*255.0f),round(this->g*255.0f),round(this->b*255.0f));
|
||||
return this->str;
|
||||
}
|
||||
|
||||
|
||||
float Colour::getLength() const {
|
||||
return this->len;
|
||||
}
|
||||
|
||||
bool Colour::operator<(const Colour& other) const {
|
||||
return getLength() < other.getLength();
|
||||
}
|
||||
22
src/core/Colour.h
Normal file
22
src/core/Colour.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace core {
|
||||
class Colour {
|
||||
public:
|
||||
Colour(const float r, const float g, const float b);
|
||||
~Colour();
|
||||
char* toString();
|
||||
float getLength() const;
|
||||
bool operator<(const Colour& other) const;
|
||||
float r; // FIXME: should be private
|
||||
float g;
|
||||
float b;
|
||||
private:
|
||||
char str[128];
|
||||
float len;
|
||||
};
|
||||
}
|
||||
10
src/core/ImageMatcher.h
Normal file
10
src/core/ImageMatcher.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
class ImageMatcher{
|
||||
public:
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
0
src/core/RGBMatcher.cpp
Normal file
0
src/core/RGBMatcher.cpp
Normal file
0
src/core/RGBMatcher.h
Normal file
0
src/core/RGBMatcher.h
Normal file
Reference in New Issue
Block a user