papyrus logo

fill.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Rick L. Vinyard, Jr.                            *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the papyrus library.                             *
00006  *                                                                         *
00007  *   papyrus is free software; you can redistribute it and/or modify       *
00008  *   it under the terms of the GNU Lesser General Public License           *
00009  *   version 3.0 as published by the Free Software Foundation.             *
00010  *                                                                         *
00011  *   papyrus is distributed in the hope that it will be useful,            *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Lesser General Public License version 3.0 for more details.       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with the papyrus library. If not, see                   *
00018  *   <http://www.gnu.org/licenses/>.                                       *
00019  ***************************************************************************/
00020 #ifndef PAPYRUSFILL_H
00021 #define PAPYRUSFILL_H
00022 
00023 #include <cmath>
00024 #include <papyrus/renderable.h>
00025 #include <papyrus/drawable.h>
00026 #include <papyrus/paint.h>
00027 
00028 namespace Papyrus
00029 {
00030 
00031   class RGBA;
00032 
00036   class Fill : public Renderable
00037   {
00038     public:
00039       
00040     // TODO figure out how to handle fill ids and not step on the string color constructor... probably with an explicit color class
00041     protected:
00042       Fill ( Paint::pointer paint, Cairo::FillRule rule );
00043       
00044     public:
00045       PAPYRUS_RENDERABLE(Fill);
00046 
00047       static pointer create( Paint::pointer paint = Paint::pointer(), Cairo::FillRule rule = Cairo::FILL_RULE_WINDING );
00048 
00049       static pointer create( Cairo::RefPtr<Cairo::Pattern> pattern, Cairo::FillRule rule=Cairo::FILL_RULE_WINDING );
00050 
00051       static pointer create( const RGBA& rgba, Cairo::FillRule rule=Cairo::FILL_RULE_WINDING );
00052       
00053       static pointer create( const Glib::ustring& color, Cairo::FillRule rule=Cairo::FILL_RULE_WINDING );
00054       
00055       ~Fill();
00056 
00057       Fill& operator= ( const Fill& other );
00058 
00059       bool operator== ( const Fill& other ) const;
00060 
00061       bool operator!= ( const Fill& other ) const;
00062 
00063       Paint::pointer paint();
00064 
00065       void set_paint ( Paint::pointer paint = Paint::pointer() );
00066 
00067       Cairo::FillRule fill_rule();
00068 
00069       void set_fill_rule( Cairo::FillRule rule );
00070 
00071       virtual void render ( Context& cairo ) const;
00072 
00073       virtual Glib::ustring svg(unsigned depth=0);
00074 
00075       sigc::signal<void> signal_paint_changed();
00076       sigc::signal<void> signal_fill_rule_changed();
00077 
00078     protected:
00079       Paint::pointer m_paint;
00080       Cairo::FillRule m_fill_rule;
00081 
00082       sigc::signal<void> m_signal_paint_changed;
00083       sigc::signal<void> m_signal_fill_rule_changed;
00084 
00085       sigc::connection m_paint_changed_connection;
00086       void on_paint_changed();
00087 
00088   };
00089 
00090 }
00091 
00092 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1