From c35d5af1c2845ad072525e69f3f7be01994bcc2f Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 4 Oct 2009 19:04:59 +0000 Subject: Purge test suite and C++ wrapper - for now. --- libdimensionxx/canvas.cpp | 87 ----------------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 libdimensionxx/canvas.cpp (limited to 'libdimensionxx/canvas.cpp') diff --git a/libdimensionxx/canvas.cpp b/libdimensionxx/canvas.cpp deleted file mode 100644 index 10688da..0000000 --- a/libdimensionxx/canvas.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************* - * Copyright (C) 2009 Tavian Barnes * - * * - * This file is part of The Dimension Library. * - * * - * The Dimension Library is free software; you can redistribute it and/ * - * or modify it under the terms of the GNU Lesser General Public License * - * as published by the Free Software Foundation; either version 3 of the * - * License, or (at your option) any later version. * - * * - * The Dimension Library is distributed in the hope that it will be * - * useful, but WITHOUT ANY WARRANTY; without even the implied warranty * - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Lesser General Public License for more details. * - * * - * You should have received a copy of the GNU Lesser General Public * - * License along with this program. If not, see * - * . * - *************************************************************************/ - -#include "dimensionxx.hpp" - -namespace Dimension -{ - // Allocate the canvas with dmnsn_new_canvas() - Canvas::Canvas(unsigned int width, unsigned int height) - : m_canvas(new dmnsn_canvas*(dmnsn_new_canvas(width, height))) - { - if (!dmnsn()) { - throw Dimension_Error("Couldn't allocate canvas."); - } - } - - // Wrap an existing dmnsn_canvas* - Canvas::Canvas(dmnsn_canvas* canvas) - : m_canvas(new dmnsn_canvas*(canvas)) { } - - // Virtual destructor: delete the canvas with dmnsn_delete_canvas(). - Canvas::~Canvas() - { - if (m_canvas && m_canvas.unique()) { - dmnsn_delete_canvas(dmnsn()); - } - } - - // Get the width - unsigned int - Canvas::width() const - { - return dmnsn()->x; - } - - // Get the height - unsigned int - Canvas::height() const - { - return dmnsn()->y; - } - - // Get a particular pixel - Color - Canvas::pixel(unsigned int x, unsigned int y) const - { - return Color(dmnsn_get_pixel(dmnsn(), x, y)); - } - - // Set a particular pixel - void - Canvas::pixel(unsigned int x, unsigned int y, const Color& c) - { - dmnsn_set_pixel(dmnsn(), x, y, c.dmnsn()); - } - - // Return the wrapped canvas - dmnsn_canvas* - Canvas::dmnsn() - { - return *m_canvas; - } - - // Return a const version of the wrapped canvas - const dmnsn_canvas* - Canvas::dmnsn() const - { - return *m_canvas; - } -} -- cgit v1.2.3