diff options
Diffstat (limited to 'libdimensionxx')
-rw-r--r-- | libdimensionxx/canvas.cpp | 8 | ||||
-rw-r--r-- | libdimensionxx/dimensionxx/canvas.hpp | 22 |
2 files changed, 30 insertions, 0 deletions
diff --git a/libdimensionxx/canvas.cpp b/libdimensionxx/canvas.cpp index 8b90fe9..2340066 100644 --- a/libdimensionxx/canvas.cpp +++ b/libdimensionxx/canvas.cpp @@ -19,3 +19,11 @@ *************************************************************************/ #include "dimensionxx.hpp" + +namespace Dimension +{ + Canvas::~Canvas() + { + dmnsn_delete_canvas(m_canvas); + } +} diff --git a/libdimensionxx/dimensionxx/canvas.hpp b/libdimensionxx/dimensionxx/canvas.hpp index e2e493a..f51aa75 100644 --- a/libdimensionxx/dimensionxx/canvas.hpp +++ b/libdimensionxx/dimensionxx/canvas.hpp @@ -23,6 +23,28 @@ namespace Dimension { + class Canvas + { + public: + Canvas(unsigned int x, unsigned int y) + : m_canvas(dmnsn_new_canvas(x, y)) { } + virtual ~Canvas(); + + Color pixel(unsigned int x, unsigned int y) const + { return Color(dmnsn_get_pixel(m_canvas, x, y)); } + void pixel(unsigned int x, unsigned int y, const Color& c) + { dmnsn_set_pixel(m_canvas, x, y, c.dmnsn()); } + + dmnsn_canvas* dmnsn() { return m_canvas; } + const dmnsn_canvas* dmnsn() const { return m_canvas; } + + private: + dmnsn_canvas* m_canvas; + + // Copying prohibited + Canvas(const Canvas&); + Canvas& operator=(const Canvas&); + }; } #endif /* DIMENSIONXX_CANVAS_HPP */ |