1 /*
2  * paint_style.h -- ePiX's current line and fill style.
3  *
4  * This file is part of ePiX, a C++ library for creating high-quality
5  * figures in LaTeX
6  *
7  * Version 1.1.3
8  * Last Change: March 04, 2007
9  */
10 
11 /*
12  * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
13  * Andrew D. Hwang <rot 13 nujnat at zngupf dot ubylpebff dot rqh>
14  * Department of Mathematics and Computer Science
15  * College of the Holy Cross
16  * Worcester, MA, 01610-2395, USA
17  */
18 
19 /*
20  * ePiX is free software; you can redistribute it and/or modify it
21  * under the terms of the GNU General Public License as published by
22  * the Free Software Foundation; either version 2 of the License, or
23  * (at your option) any later version.
24  *
25  * ePiX is distributed in the hope that it will be useful, but WITHOUT
26  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
28  * License for more details.
29  *
30  * You should have received a copy of the GNU General Public License
31  * along with ePiX; if not, write to the Free Software Foundation, Inc.,
32  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33  */
34 
35 /*
36  * This file implements ePiX's "paint" style:
37  *
38  *  [] Front pen, base pen (Color and width x2)
39  *  [] Filling and fill color (bool, Color)
40  *
41  * The class in this file implements backend for user-level global
42  * functions defined in state.h, which modify the_paint_style().
43  *
44  * This header is not part of epix.h.
45  */
46 #ifndef EPIX_PAINT_STYLE
47 #define EPIX_PAINT_STYLE
48 
49 #include "Color.h"
50 #include "pen_data.h"
51 
52 namespace ePiX {
53 
54   class Camera;
55   class length;
56 
57   class paint_state {
58   public:
59     paint_state();
60 
61     paint_state* clone() const;
62 
63     // set
64     void line_pen(const pen_data& pen);
65     void line_color(const Color& col);
66     void line_width(const length& len);
67 
68     void base_pen(const pen_data& pen);
69     void base_color(const Color& col);
70     void base_width(const length& len);
71 
72     void fill_color(const Color& col);
73     void fill_flag(bool fill);
74 
75     // get
76     pen_data line_pen() const;
77     Color  line_color() const;
78     length line_width() const;
79 
80     pen_data base_pen() const;
81     Color  base_color() const;
82     length base_width() const;
83 
84     Color  fill_color() const;
85     bool    fill_flag() const;
86 
87     paint_state seen_through(const Camera& cam) const;
88 
89   private:
90     pen_data m_line;
91     pen_data m_base;
92 
93     Color  m_tint;
94     bool   m_filling;
95 
96     paint_state(const pen_data&, const pen_data&, const Color&, bool fill);
97   }; // end of class paint_state
98 
99   paint_state& the_paint_style();
100 
101 } // end of namespace
102 
103 #endif /* EPIX_PAINT_STYLE */
104