2014-06-05 15:12:49 +00:00
|
|
|
#ifndef CANVAS_H
|
|
|
|
#define CANVAS_H
|
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Graphics area to draw and do compositing.
|
|
|
|
*
|
|
|
|
* Software rendering is done in portions of Canvas (in CanvasPortion class).
|
|
|
|
* This splitting in portions allows to keep memory consumption low.
|
|
|
|
*/
|
|
|
|
class SOFTWARESHARED_EXPORT Canvas
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Canvas();
|
|
|
|
~Canvas();
|
|
|
|
|
|
|
|
void setSize(int width, int height);
|
|
|
|
|
|
|
|
inline int getHorizontalPortionCount() const {return horizontal_portion_count;}
|
|
|
|
inline int getVerticalPortionCount() const {return vertical_portion_count;}
|
|
|
|
|
|
|
|
CanvasPortion *at(int x, int y) const;
|
2014-08-21 10:36:28 +00:00
|
|
|
CanvasPortion *atPixel(int x, int y) const;
|
2014-06-05 15:12:49 +00:00
|
|
|
|
|
|
|
inline int getWidth() const {return width;}
|
|
|
|
inline int getHeight() const {return height;}
|
2014-06-10 13:13:16 +00:00
|
|
|
inline CanvasPreview *getPreview() const {return preview;}
|
2014-06-05 15:12:49 +00:00
|
|
|
|
2014-08-21 10:36:28 +00:00
|
|
|
/**
|
|
|
|
* Save the canvas to a picture file on disk.
|
|
|
|
*
|
|
|
|
* Returns true if the save was successful.
|
|
|
|
*/
|
|
|
|
bool saveToDisk(const std::string &filepath, const ColorProfile &profile, int antialias) const;
|
|
|
|
|
2014-06-05 15:12:49 +00:00
|
|
|
private:
|
|
|
|
std::vector<CanvasPortion*> portions;
|
|
|
|
int horizontal_portion_count;
|
|
|
|
int vertical_portion_count;
|
|
|
|
int width;
|
|
|
|
int height;
|
2014-06-10 13:13:16 +00:00
|
|
|
|
|
|
|
CanvasPreview *preview;
|
2014-06-05 15:12:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // CANVAS_H
|