Make UEFI boot-platform build again
[haiku.git] / src / libs / icon / style / Style.h
blob26e58bf97fb07f4c3cdc968aa31373a10ec09545
1 /*
2 * Copyright 2006-2007, Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Stephan Aßmus <superstippi@gmx.de>
7 */
8 #ifndef STYLE_H
9 #define STYLE_H
12 #ifdef ICON_O_MATIC
13 # include "IconObject.h"
14 # include "Observer.h"
15 #endif
17 #include "IconBuild.h"
18 #include "IconRenderer.h"
19 // TODO: put GammaTable into its own file
21 #include <GraphicsDefs.h>
23 #include <agg_color_rgba.h>
26 class BMessage;
29 _BEGIN_ICON_NAMESPACE
32 class Gradient;
34 #ifdef ICON_O_MATIC
35 class Style : public IconObject,
36 public Observer {
37 #else
38 class Style {
39 #endif
40 public:
41 Style();
42 Style(const Style& other);
43 Style(const rgb_color& color);
44 Style(BMessage* archive);
46 virtual ~Style();
48 #ifdef ICON_O_MATIC
49 // Observer interface
50 virtual void ObjectChanged(const Observable* object);
52 // Style
53 status_t Archive(BMessage* into,
54 bool deep = true) const;
56 bool operator==(const Style& other) const;
57 #else
58 inline void Notify() {}
59 #endif // ICON_O_MATIC
61 bool HasTransparency() const;
63 void SetColor(const rgb_color& color);
64 inline rgb_color Color() const
65 { return fColor; }
67 void SetGradient(const _ICON_NAMESPACE Gradient*
68 gradient);
69 _ICON_NAMESPACE Gradient* Gradient() const
70 { return fGradient; }
72 const agg::rgba8* Colors() const
73 { return fColors; }
75 const agg::rgba8* GammaCorrectedColors(
76 const GammaTable& table) const;
78 private:
79 rgb_color fColor;
80 _ICON_NAMESPACE Gradient* fGradient;
82 // hold gradient color array
83 agg::rgba8* fColors;
85 // for caching gamma corrected gradient color array
86 mutable agg::rgba8* fGammaCorrectedColors;
87 mutable bool fGammaCorrectedColorsValid;
91 _END_ICON_NAMESPACE
94 _USING_ICON_NAMESPACE
97 #endif // STYLE_H