1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2 #ifndef __rendertexture_hh
3 #define __rendertexture_hh
5 #include "rendercolor.hh"
9 //! Superclass for all the Textures
34 //! If true, the texture is not rendered at all, so all options are ignored
35 bool _parent_relative;
36 //! The relief type of the texture
38 //! The way the bevel should be drawn
40 //! If a flat border is drawn on the outside, ignored for all ReliefType
41 //! values except ReliefType::Flat
43 //! The type of gradient to fill the texture with (if any)
44 GradientType _gradient;
45 //! If interlace lines should be drawn over the texture
48 //! The base color for the texture, the only color when the texture is solid.
49 //! This must always be defined
50 const RenderColor *_color;
51 //! The secondary color for a gradient texture.
52 //! This is only defined for gradients
53 const RenderColor *_secondary_color;
54 //! The shadow color for the bevel. This must be defined if
55 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
56 const RenderColor *_bevel_dark_color;
57 //! The light color for the bevel. This must be defined if
58 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
59 const RenderColor *_bevel_light_color;
60 //! The color for the flat border if RenderTexture::_border is true. This
61 //! must be defined if it is true
62 const RenderColor *_border_color;
63 //! The color for the interlace lines if RenderTexture. This must be defined
65 const RenderColor *_interlace_color;
68 RenderTexture(bool parent_relative, ReliefType relief, BevelType bevel,
69 bool border, GradientType gradient, bool interlaced,
70 const RenderColor::RGB &color,
71 const RenderColor::RGB &secondary_color,
72 const RenderColor::RGB &bevel_dark_color,
73 const RenderColor::RGB &bevel_light_color,
74 const RenderColor::RGB &border_color,
75 const RenderColor::RGB &interlace_color)
76 : _parent_relative(parent_relative),
81 _interlaced(interlaced),
82 _color(new RenderColor(color)),
83 _secondary_color(new RenderColor(secondary_color)),
84 _bevel_dark_color(new RenderColor(bevel_dark_color)),
85 _bevel_light_color(new RenderColor(bevel_light_color)),
86 _border_color(new RenderColor(border_color)),
87 _interlace_color(new RenderColor(interlace_color))
89 assert(_relief == Flat || (_bevel_dark_color && _bevel_light_color));
90 assert(!_border || _border_color);
91 assert(!_interlaced || _interlace_color);
95 virtual ~RenderTexture() {
97 delete _secondary_color;
98 delete _bevel_dark_color;
99 delete _bevel_light_color;
100 delete _border_color;
101 delete _interlace_color;
104 //! If true, the texture is not rendered at all, so all options are ignored
105 inline bool parentRelative() const { return _parent_relative; }
106 //! The relief type of the texture
107 inline ReliefType relief() const { return _relief; }
108 //! The way the bevel should be drawn
109 inline BevelType bevel() const { return _bevel; }
110 //! If a flat border is drawn on the outside, ignored for all ReliefType
111 //! values except ReliefType::Flat
112 inline bool border() const { return _border; }
113 //! The type of gradient to fill the texture with (if any)
114 inline GradientType gradient() const { return _gradient; }
115 //! If interlace lines should be drawn over the texture
116 inline bool interlaced() const { return _interlaced; }
118 //! The base color for the texture, the only color when the texture is solid.
119 //! This must always be defined
120 inline const RenderColor& color() const { return *_color; }
121 //! The secondary color for gradient textures.
122 //! This is only defined for gradients
123 inline const RenderColor& secondary_color() const
124 { return *_secondary_color; }
125 //! The shadow color for the bevel. This must be defined if
126 //! RenderTexture::_relief is not RenderTexture::ReliefType::Flat
127 inline const RenderColor& bevelDarkColor() const
128 { return *_bevel_dark_color; }
129 //! The light color for the bevel. This must be defined if
130 //! RenderTexture::)relief is not RenderTexture::ReliefType::Flat
131 inline const RenderColor& bevelLightColor() const
132 { return *_bevel_light_color; }
133 //! The color for the flat border if RenderTexture::_border is true. This
134 //! must be defined if it is true
135 inline const RenderColor& borderColor() const { return *_border_color; }
136 //! The color for the interlace lines if RenderTexture. This must be defined
138 inline const RenderColor& interlaceColor() const
139 { return *_interlace_color; }
144 #endif // __rendertexture_hh