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 <GradientConic.h>
12
13
14 // constructor
BGradientConic()15 BGradientConic::BGradientConic()
16 {
17 fData.conic.cx = 0.0f;
18 fData.conic.cy = 0.0f;
19 fData.conic.angle = 0.0f;
20 fType = TYPE_CONIC;
21 }
22
23
24 // constructor
BGradientConic(const BPoint & center,float angle)25 BGradientConic::BGradientConic(const BPoint& center, float angle)
26 {
27 fData.conic.cx = center.x;
28 fData.conic.cy = center.y;
29 fData.conic.angle = angle;
30 fType = TYPE_CONIC;
31 }
32
33
34 // constructor
BGradientConic(float cx,float cy,float angle)35 BGradientConic::BGradientConic(float cx, float cy, float angle)
36 {
37 fData.conic.cx = cx;
38 fData.conic.cy = cy;
39 fData.conic.angle = angle;
40 fType = TYPE_CONIC;
41 }
42
43
44 // Center
45 BPoint
Center() const46 BGradientConic::Center() const
47 {
48 return BPoint(fData.conic.cx, fData.conic.cy);
49 }
50
51
52 // SetCenter
53 void
SetCenter(const BPoint & center)54 BGradientConic::SetCenter(const BPoint& center)
55 {
56 fData.conic.cx = center.x;
57 fData.conic.cy = center.y;
58 }
59
60
61 // SetCenter
62 void
SetCenter(float cx,float cy)63 BGradientConic::SetCenter(float cx, float cy)
64 {
65 fData.conic.cx = cx;
66 fData.conic.cy = cy;
67 }
68
69
70 // Angle
71 float
Angle() const72 BGradientConic::Angle() const
73 {
74 return fData.conic.angle;
75 }
76
77
78 // SetAngle
79 void
SetAngle(float angle)80 BGradientConic::SetAngle(float angle)
81 {
82 fData.conic.angle = angle;
83 }
84