xref: /haiku/src/kits/interface/GradientRadialFocus.cpp (revision 820dca4df6c7bf955c46e8f6521b9408f50b2900)
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 <GradientRadialFocus.h>
12 
13 
14 // constructor
15 BGradientRadialFocus::BGradientRadialFocus()
16 {
17 	fData.radial_focus.cx = 0.0f;
18 	fData.radial_focus.cy = 0.0f;
19 	fData.radial_focus.fx = 0.0f;
20 	fData.radial_focus.fy = 0.0f;
21 	fData.radial_focus.radius = 0.0f;
22 	fType = TYPE_RADIAL_FOCUS;
23 }
24 
25 
26 // constructor
27 BGradientRadialFocus::BGradientRadialFocus(const BPoint& center, float radius,
28 	const BPoint& focal)
29 {
30 	fData.radial_focus.cx = center.x;
31 	fData.radial_focus.cy = center.y;
32 	fData.radial_focus.fx = focal.x;
33 	fData.radial_focus.fy = focal.y;
34 	fData.radial_focus.radius = radius;
35 	fType = TYPE_RADIAL_FOCUS;
36 }
37 
38 
39 // constructor
40 BGradientRadialFocus::BGradientRadialFocus(float cx, float cy, float radius,
41 	float fx, float fy)
42 {
43 	fData.radial_focus.cx = cx;
44 	fData.radial_focus.cy = cy;
45 	fData.radial_focus.fx = fx;
46 	fData.radial_focus.fy = fy;
47 	fData.radial_focus.radius = radius;
48 	fType = TYPE_RADIAL_FOCUS;
49 }
50 
51 
52 // Center
53 BPoint
54 BGradientRadialFocus::Center() const
55 {
56 	return BPoint(fData.radial_focus.cx, fData.radial_focus.cy);
57 }
58 
59 
60 // SetCenter
61 void
62 BGradientRadialFocus::SetCenter(const BPoint& center)
63 {
64 	fData.radial_focus.cx = center.x;
65 	fData.radial_focus.cy = center.y;
66 }
67 
68 
69 // SetCenter
70 void
71 BGradientRadialFocus::SetCenter(float cx, float cy)
72 {
73 	fData.radial_focus.cx = cx;
74 	fData.radial_focus.cy = cy;
75 }
76 
77 
78 // Focal
79 BPoint
80 BGradientRadialFocus::Focal() const
81 {
82 	return BPoint(fData.radial_focus.fx, fData.radial_focus.fy);
83 }
84 
85 
86 // SetFocal
87 void
88 BGradientRadialFocus::SetFocal(const BPoint& focal)
89 {
90 	fData.radial_focus.fx = focal.x;
91 	fData.radial_focus.fy = focal.y;
92 }
93 
94 
95 // SetFocal
96 void
97 BGradientRadialFocus::SetFocal(float fx, float fy)
98 {
99 	fData.radial_focus.fx = fx;
100 	fData.radial_focus.fy = fy;
101 }
102 
103 
104 // Radius
105 float
106 BGradientRadialFocus::Radius() const
107 {
108 	return fData.radial_focus.radius;
109 }
110 
111 
112 // SetRadius
113 void
114 BGradientRadialFocus::SetRadius(float radius)
115 {
116 	fData.radial_focus.radius = radius;
117 }
118