/* Copyright (C) 2007 Michael Goffioul ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program 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 General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 */ #ifndef __graphics_renderer_h__ #define __graphics_renderer_h__ #include #include class base_scaler { public: virtual Matrix scale (const Matrix& m) = 0; }; class scaler : public base_scaler { public: scaler (void) : rep (0) { } Matrix scale(const Matrix& m) { return (rep ? rep->scale (m) : m); } scaler& operator= (const radio_property& p); private: base_scaler *rep; }; class graphics_renderer { public: void draw (double handle) { graphics_handle h = gh_manager::lookup (handle); if (h.ok ()) draw (gh_manager::get_object (h)); } void draw (const graphics_object& obj); virtual void draw (const figure::properties& props) = 0; virtual void draw (const axes::properties& props) = 0; virtual void set_viewport (int w, int h); int get_width () const { return width; } int get_height () const { return height; } Matrix get_boundingbox (const axes::properties& props) const; protected: graphics_renderer (void) { } protected: int width, height; scaler sx, sy, sz; }; #endif /* __graphics_renderer_h__ */