1 /*
2 * Copyright 2006-2008, Haiku.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 * Artur Wyszynski <harakash@gmail.com>
7 */
8
9 #include <Point.h>
10 #include <Gradient.h>
11 #include <GradientRadial.h>
12
13
14 // constructor
BGradientRadial()15 BGradientRadial::BGradientRadial()
16 {
17 fData.radial.cx = 0.0f;
18 fData.radial.cy = 0.0f;
19 fData.radial.radius = 0.0f;
20 fType = TYPE_RADIAL;
21 }
22
23
24 // constructor
BGradientRadial(const BPoint & center,float radius)25 BGradientRadial::BGradientRadial(const BPoint& center, float radius)
26 {
27 fData.radial.cx = center.x;
28 fData.radial.cy = center.y;
29 fData.radial.radius = radius;
30 fType = TYPE_RADIAL;
31 }
32
33
34 // constructor
BGradientRadial(float cx,float cy,float radius)35 BGradientRadial::BGradientRadial(float cx, float cy, float radius)
36 {
37 fData.radial.cx = cx;
38 fData.radial.cy = cy;
39 fData.radial.radius = radius;
40 fType = TYPE_RADIAL;
41 }
42
43
44 // Center
45 BPoint
Center() const46 BGradientRadial::Center() const
47 {
48 return BPoint(fData.radial.cx, fData.radial.cy);
49 }
50
51
52 // SetCenter
53 void
SetCenter(const BPoint & center)54 BGradientRadial::SetCenter(const BPoint& center)
55 {
56 fData.radial.cx = center.x;
57 fData.radial.cy = center.y;
58 }
59
60
61 // SetCenter
62 void
SetCenter(float cx,float cy)63 BGradientRadial::SetCenter(float cx, float cy)
64 {
65 fData.radial.cx = cx;
66 fData.radial.cy = cy;
67 }
68
69
70 // Radius
71 float
Radius() const72 BGradientRadial::Radius() const
73 {
74 return fData.radial.radius;
75 }
76
77
78 // SetRadius
79 void
SetRadius(float radius)80 BGradientRadial::SetRadius(float radius)
81 {
82 fData.radial.radius = radius;
83 }
84