Make UEFI boot-platform build again
[haiku.git] / src / libs / icon / style / GradientTransformable.h
blob42fc93ae71070d33d7cf5849ef46d5152a968bae
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 GRADIENT_TRANSFORMABLE_H
9 #define GRADIENT_TRANSFORMABLE_H
12 #ifdef ICON_O_MATIC
13 # include <Archivable.h>
14 # include <Referenceable.h>
16 # include "Observable.h"
17 #endif // ICON_O_MATIC
19 #include "IconBuild.h"
20 #include "Transformable.h"
22 #include <GraphicsDefs.h>
23 #include <Gradient.h>
24 #include <List.h>
26 class BMessage;
28 enum gradients_type {
29 GRADIENT_LINEAR = 0,
30 GRADIENT_CIRCULAR,
31 GRADIENT_DIAMOND,
32 GRADIENT_CONIC,
33 GRADIENT_XY,
34 GRADIENT_SQRT_XY
37 enum interpolation_type {
38 INTERPOLATION_LINEAR = 0,
39 INTERPOLATION_SMOOTH
43 _BEGIN_ICON_NAMESPACE
46 #ifdef ICON_O_MATIC
47 class Gradient : public BArchivable,
48 public Observable,
49 public BReferenceable,
50 public Transformable {
51 #else
52 class Gradient : public Transformable {
53 #endif
55 public:
56 Gradient(bool empty = false);
57 Gradient(BMessage* archive);
58 Gradient(const Gradient& other);
59 virtual ~Gradient();
61 #ifdef ICON_O_MATIC
62 status_t Archive(BMessage* into, bool deep = true) const;
63 #else
64 inline void Notify() {}
65 #endif
67 Gradient& operator=(const Gradient& other);
69 bool operator==(const Gradient& other) const;
70 bool operator!=(const Gradient& other) const;
71 bool ColorStepsAreEqual(
72 const Gradient& other) const;
74 void SetColors(const Gradient& other);
77 int32 AddColor(const rgb_color& color, float offset);
78 bool AddColor(const BGradient::ColorStop& color,
79 int32 index);
81 bool RemoveColor(int32 index);
83 bool SetColor(int32 index,
84 const BGradient::ColorStop& step);
85 bool SetColor(int32 index, const rgb_color& color);
86 bool SetOffset(int32 index, float offset);
88 int32 CountColors() const;
89 BGradient::ColorStop* ColorAt(int32 index) const;
90 BGradient::ColorStop* ColorAtFast(int32 index) const;
92 void SetType(gradients_type type);
93 gradients_type Type() const
94 { return fType; }
96 void SetInterpolation(interpolation_type type);
97 interpolation_type Interpolation() const
98 { return fInterpolation; }
100 void SetInheritTransformation(bool inherit);
101 bool InheritTransformation() const
102 { return fInheritTransformation; }
104 void MakeGradient(uint32* colors,
105 int32 count) const;
107 void FitToBounds(const BRect& bounds);
108 BRect GradientArea() const;
109 virtual void TransformationChanged();
111 void PrintToStream() const;
113 private:
114 void _MakeEmpty();
116 BList fColors;
117 gradients_type fType;
118 interpolation_type fInterpolation;
119 bool fInheritTransformation;
123 _END_ICON_NAMESPACE
126 #endif // GRADIENT_TRANSFORMABLE_H