summaryrefslogtreecommitdiffstats
path: root/libdimensionxx/dimensionxx/canvas.hpp
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-04-12 15:42:04 +0000
committerTavian Barnes <tavianator@gmail.com>2009-04-12 15:42:04 +0000
commit4f9f95a05a41bfbcc9965eaaf7f2d14c6af9f261 (patch)
treec5d3d649d36e6102708d0f86edb87499e1ff8c3e /libdimensionxx/dimensionxx/canvas.hpp
parent510c9a95fb5f3f4a40a19ce66c95344c2013085f (diff)
downloaddimension-4f9f95a05a41bfbcc9965eaaf7f2d14c6af9f261.tar.xz
Write C++ libdimension-png wrapper.
Diffstat (limited to 'libdimensionxx/dimensionxx/canvas.hpp')
-rw-r--r--libdimensionxx/dimensionxx/canvas.hpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/libdimensionxx/dimensionxx/canvas.hpp b/libdimensionxx/dimensionxx/canvas.hpp
index f51aa75..c501413 100644
--- a/libdimensionxx/dimensionxx/canvas.hpp
+++ b/libdimensionxx/dimensionxx/canvas.hpp
@@ -26,10 +26,14 @@ namespace Dimension
class Canvas
{
public:
- Canvas(unsigned int x, unsigned int y)
- : m_canvas(dmnsn_new_canvas(x, y)) { }
+ Canvas(unsigned int width, unsigned int height)
+ : m_canvas(dmnsn_new_canvas(width, height)) { }
+ explicit Canvas(dmnsn_canvas* canvas) : m_canvas(canvas) { }
virtual ~Canvas();
+ unsigned int width() const { return m_canvas->x; }
+ unsigned int height() const { return m_canvas->y; }
+
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)
@@ -38,9 +42,12 @@ namespace Dimension
dmnsn_canvas* dmnsn() { return m_canvas; }
const dmnsn_canvas* dmnsn() const { return m_canvas; }
- private:
+ protected:
+ Canvas() : m_canvas(0) { }
+
dmnsn_canvas* m_canvas;
+ private:
// Copying prohibited
Canvas(const Canvas&);
Canvas& operator=(const Canvas&);