summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/dimensionxx
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-04-12 15:41:29 +0000
committerTavian Barnes <tavianator@gmail.com>2009-04-12 15:41:29 +0000
commit510c9a95fb5f3f4a40a19ce66c95344c2013085f (patch)
tree4f69c12e773da63b2f5d7c116bd241043de24003 /libdimensionxx/dimensionxx
parentbef2ee297d3492c8a54e61fe498e6eda518da250 (diff)
downloaddimension-510c9a95fb5f3f4a40a19ce66c95344c2013085f.tar.xz
Change argument order of dmnsn_set_pixel; write C++ canvas wrapper.
Diffstat (limited to 'libdimensionxx/dimensionxx')
-rw-r--r--libdimensionxx/dimensionxx/canvas.hpp22
1 files changed, 22 insertions, 0 deletions
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 */