Add Color and Image
This commit is contained in:
1 parent
6d102b8de9
commit
6849d583ae
4 files changed
+46
-2
No files matched your search
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
struct Color
|
||||
{
|
||||
double r;
|
||||
double g;
|
||||
double b;
|
||||
double a;
|
||||
|
||||
Color(double r = 0.0, double g = 0.0, double b = 0.0, double a = 1.0)
|
||||
: r(r), g(g), b(b), a(a)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <fart/Image.h>
|
||||
|
||||
Image::Image(size_t width, size_t height)
|
||||
: width(width), height(height)
|
||||
{
|
||||
this->pixels = new Color[width * height];
|
||||
}
|
||||
|
||||
Image::~Image()
|
||||
{
|
||||
delete[] this->pixels;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <fart/Color.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct Image
|
||||
{
|
||||
size_t width;
|
||||
size_t height;
|
||||
Color * pixels;
|
||||
Image(size_t width, size_t height);
|
||||
~Image();
|
||||
|
||||
Color & operator[](size_t x, size_t y)
|
||||
{
|
||||
return this->pixels[this->width * y + x];
|
||||
}
|
||||
};
|
||||
Reference in new issue
Block a user