Commit 03a7e3ed authored by Ilya Prokhorov's avatar Ilya Prokhorov

Pre glReadPixels flipping fix

parent 47791bd7
......@@ -4,7 +4,7 @@
using namespace FlameSteelCore::Utils;
using namespace FlameSteelEngine::CommonTraits;
Color::Color(int8_t red, int8_t green, int8_t blue, int8_t alpha) {
Color::Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
this->red = red;
this->green = green;
......@@ -21,4 +21,17 @@ bool Color::isEqualTo(shared_ptr<Color> color) {
return false;
}
return true;
};
string Color::asString() {
string output = "";
output += "red: ";
output += to_string(red);
output += " green: ";
output += to_string(green);
output += " blue: ";
output += to_string(blue);
output += " alpha: ";
output += to_string(alpha);
return output;
};
\ No newline at end of file
......@@ -12,7 +12,7 @@ namespace CommonTraits {
class Color {
public:
Color(int8_t red, int8_t green, int8_t blue, int8_t alpha);
Color(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
uint8_t red;
uint8_t green;
......@@ -20,6 +20,7 @@ public:
uint8_t alpha;
bool isEqualTo(shared_ptr<Color> color);
string asString();
};
};
......
#include "Image.h"
#include "Color.h"
#include "FlameSteelCore/FSCUtils.h"
using namespace FlameSteelCore::Utils;
Image::Image(int width, int height) {
this->width = width;
......@@ -13,7 +16,7 @@ Image::Image(int width, int height) {
void Image::setColorAtXY(shared_ptr<Color> color, int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) {
return;
throwRuntimeException("Can't set color outside of image size");
}
int index = (y * width) + x;
......@@ -23,7 +26,7 @@ void Image::setColorAtXY(shared_ptr<Color> color, int x, int y) {
shared_ptr<Color> Image::getColorAtXY(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) {
return shared_ptr<Color>();
throwRuntimeException("Can't get color outside of image size");
}
int index = (y * width) + x;
......
#include "Path.h"
#include <cctype>
#include <FlameSteelCore/FSCUtils.h>
using namespace FlameSteelCore::Utils;
using namespace FlameSteelCommonTraits;
inline bool isRDNS(string path) {
for (unsigned i=0; i<path.length(); ++i)
{
auto character = path.at(i);
if (isalpha(character) == false && character != '.') {
return false;
}
}
return true;
};
Path::Path(string path) {
if (isRDNS(path) == false) {
string errorText = path;
errorText += "is not in reverse-domain-format";
throwRuntimeException(errorText);
}
this->path = path;
};
\ No newline at end of file
#ifndef FLAMESTEELCOMMONTRAITSPATH_H_
#define FLAMESTEELCOMMONTRAITSPATH_H_
#include <string>
using namespace std;
namespace FlameSteelCommonTraits {
class Path {
public:
Path(string path);
string path;
};
};
#endif
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment