1fb07ece0SStephan Aßmus /* 2325a6253SAxel Dörfler * Copyright 2006-2007, Haiku. 3fb07ece0SStephan Aßmus * Distributed under the terms of the MIT License. 4fb07ece0SStephan Aßmus * 5fb07ece0SStephan Aßmus * Authors: 6fb07ece0SStephan Aßmus * Stephan Aßmus <superstippi@gmx.de> 7fb07ece0SStephan Aßmus */ 8fb07ece0SStephan Aßmus #ifndef STYLE_H 9fb07ece0SStephan Aßmus #define STYLE_H 10fb07ece0SStephan Aßmus 11fb07ece0SStephan Aßmus 12fb07ece0SStephan Aßmus #ifdef ICON_O_MATIC 13fb07ece0SStephan Aßmus # include "IconObject.h" 14fb07ece0SStephan Aßmus # include "Observer.h" 15fb07ece0SStephan Aßmus #endif 16fb07ece0SStephan Aßmus 17*25dc253dSIngo Weinhold #include "IconBuild.h" 18fb07ece0SStephan Aßmus #include "IconRenderer.h" 19fb07ece0SStephan Aßmus // TODO: put GammaTable into its own file 20fb07ece0SStephan Aßmus 21325a6253SAxel Dörfler #include <GraphicsDefs.h> 22325a6253SAxel Dörfler 23325a6253SAxel Dörfler #include <agg_color_rgba.h> 24325a6253SAxel Dörfler 25325a6253SAxel Dörfler 268b8d44bfSMichael Lotz class BMessage; 278b8d44bfSMichael Lotz 28*25dc253dSIngo Weinhold 29*25dc253dSIngo Weinhold _BEGIN_ICON_NAMESPACE 30*25dc253dSIngo Weinhold 31325a6253SAxel Dörfler 32fb07ece0SStephan Aßmus class Gradient; 33fb07ece0SStephan Aßmus 34fb07ece0SStephan Aßmus #ifdef ICON_O_MATIC 35fb07ece0SStephan Aßmus class Style : public IconObject, 36fb07ece0SStephan Aßmus public Observer { 37fb07ece0SStephan Aßmus #else 38fb07ece0SStephan Aßmus class Style { 39fb07ece0SStephan Aßmus #endif 40fb07ece0SStephan Aßmus public: 41fb07ece0SStephan Aßmus Style(); 42fb07ece0SStephan Aßmus Style(const Style& other); 43fb07ece0SStephan Aßmus Style(const rgb_color& color); 44fb07ece0SStephan Aßmus Style(BMessage* archive); 458b8d44bfSMichael Lotz 46fb07ece0SStephan Aßmus virtual ~Style(); 47fb07ece0SStephan Aßmus 48fb07ece0SStephan Aßmus #ifdef ICON_O_MATIC 49fb07ece0SStephan Aßmus // Observer interface 50fb07ece0SStephan Aßmus virtual void ObjectChanged(const Observable* object); 51fb07ece0SStephan Aßmus 52fb07ece0SStephan Aßmus // Style 53fb07ece0SStephan Aßmus status_t Archive(BMessage* into, 54fb07ece0SStephan Aßmus bool deep = true) const; 556e3b3b09SStephan Aßmus 566e3b3b09SStephan Aßmus bool operator==(const Style& other) const; 57fb07ece0SStephan Aßmus #else 58fb07ece0SStephan Aßmus inline void Notify() {} 59fb07ece0SStephan Aßmus #endif // ICON_O_MATIC 60fb07ece0SStephan Aßmus 61112d6155SStephan Aßmus bool HasTransparency() const; 62112d6155SStephan Aßmus 63fb07ece0SStephan Aßmus void SetColor(const rgb_color& color); 64fb07ece0SStephan Aßmus inline rgb_color Color() const 65fb07ece0SStephan Aßmus { return fColor; } 66fb07ece0SStephan Aßmus 67*25dc253dSIngo Weinhold void SetGradient(const _ICON_NAMESPACE Gradient* 68325a6253SAxel Dörfler gradient); 69*25dc253dSIngo Weinhold _ICON_NAMESPACE Gradient* Gradient() const 70fb07ece0SStephan Aßmus { return fGradient; } 71fb07ece0SStephan Aßmus 72fb07ece0SStephan Aßmus const agg::rgba8* Colors() const 73fb07ece0SStephan Aßmus { return fColors; } 74fb07ece0SStephan Aßmus 75fb07ece0SStephan Aßmus const agg::rgba8* GammaCorrectedColors( 76fb07ece0SStephan Aßmus const GammaTable& table) const; 77fb07ece0SStephan Aßmus 78fb07ece0SStephan Aßmus private: 79fb07ece0SStephan Aßmus rgb_color fColor; 80*25dc253dSIngo Weinhold _ICON_NAMESPACE Gradient* fGradient; 81fb07ece0SStephan Aßmus 82fb07ece0SStephan Aßmus // hold gradient color array 83fb07ece0SStephan Aßmus agg::rgba8* fColors; 84fb07ece0SStephan Aßmus 85fb07ece0SStephan Aßmus // for caching gamma corrected gradient color array 86fb07ece0SStephan Aßmus mutable agg::rgba8* fGammaCorrectedColors; 87fb07ece0SStephan Aßmus mutable bool fGammaCorrectedColorsValid; 88fb07ece0SStephan Aßmus }; 89fb07ece0SStephan Aßmus 90325a6253SAxel Dörfler 91*25dc253dSIngo Weinhold _END_ICON_NAMESPACE 92*25dc253dSIngo Weinhold 93*25dc253dSIngo Weinhold 94*25dc253dSIngo Weinhold _USING_ICON_NAMESPACE 95*25dc253dSIngo Weinhold 96325a6253SAxel Dörfler 97fb07ece0SStephan Aßmus #endif // STYLE_H 98