2 * Copyright 2006-2009, Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
9 #include <Archivable.h>
10 #include <GraphicsDefs.h>
18 // WARNING! This is experimental API and may change! Be prepared to
19 // recompile your software in a next version of haiku. In particular,
20 // the offsets are currently specified on [0..255], but may be changed
21 // to the interval [0..1]. This class also does not have any FBC padding,
22 // So your software will definitely break when this class gets new
23 // virtuals. And the object size may change too...
26 class BGradient
: public BArchivable
{
38 ColorStop(const rgb_color c
, float o
);
39 ColorStop(uint8 r
, uint8 g
, uint8 b
, uint8 a
, float o
);
40 ColorStop(const ColorStop
& other
);
43 bool operator!=(const ColorStop
& other
) const;
51 BGradient(BMessage
* archive
);
54 status_t
Archive(BMessage
* into
,
55 bool deep
= true) const;
57 BGradient
& operator=(const BGradient
& other
);
59 bool operator==(const BGradient
& other
) const;
60 bool operator!=(const BGradient
& other
) const;
61 bool ColorStopsAreEqual(
62 const BGradient
& other
) const;
64 void SetColorStops(const BGradient
& other
);
66 int32
AddColor(const rgb_color
& color
,
68 bool AddColorStop(const ColorStop
& colorStop
,
71 bool RemoveColor(int32 index
);
73 bool SetColorStop(int32 index
,
74 const ColorStop
& colorStop
);
75 bool SetColor(int32 index
, const rgb_color
& color
);
76 bool SetOffset(int32 index
, float offset
);
78 int32
CountColorStops() const;
79 ColorStop
* ColorStopAt(int32 index
) const;
80 ColorStop
* ColorStopAtFast(int32 index
) const;
81 ColorStop
* ColorStops() const;
82 void SortColorStopsByOffset();
90 friend class BGradientLinear
;
91 friend class BGradientRadial
;
92 friend class BGradientRadialFocus
;
93 friend class BGradientDiamond
;
94 friend class BGradientConic
;
101 float cx
, cy
, radius
;
104 float cx
, cy
, fx
, fy
, radius
;
118 #endif // _GRADIENT_H