2016-07-12 17:40:45 +00:00
|
|
|
#pragma once
|
2013-12-09 21:16:00 +00:00
|
|
|
|
|
|
|
#include "basics_global.h"
|
|
|
|
|
2015-12-29 23:43:35 +00:00
|
|
|
#include <string>
|
|
|
|
|
2013-12-09 21:16:00 +00:00
|
|
|
namespace paysages {
|
|
|
|
namespace basics {
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
class BASICSSHARED_EXPORT Texture2D {
|
|
|
|
public:
|
2013-12-09 21:16:00 +00:00
|
|
|
Texture2D(int xsize, int ysize);
|
|
|
|
~Texture2D();
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
void getSize(int *xsize, int *ysize) const;
|
2013-12-09 21:16:00 +00:00
|
|
|
void setPixel(int x, int y, Color col);
|
2013-12-22 17:05:11 +00:00
|
|
|
Color getPixel(int x, int y) const;
|
|
|
|
Color getNearest(double dx, double dy) const;
|
|
|
|
Color getLinear(double dx, double dy) const;
|
|
|
|
Color getCubic(double dx, double dy) const;
|
2013-12-09 21:16:00 +00:00
|
|
|
void fill(Color col);
|
2015-11-09 21:30:46 +00:00
|
|
|
void add(Texture2D *other);
|
|
|
|
void save(PackStream *stream) const;
|
|
|
|
void load(PackStream *stream);
|
2015-12-10 23:36:50 +00:00
|
|
|
void saveToFile(const string &filepath) const;
|
2013-12-09 21:16:00 +00:00
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
private:
|
2013-12-09 21:16:00 +00:00
|
|
|
int xsize;
|
|
|
|
int ysize;
|
2015-11-09 21:30:46 +00:00
|
|
|
Color *data;
|
2013-12-09 21:16:00 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|