xref: /haiku/src/kits/interface/GradientDiamond.cpp (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
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 <GradientDiamond.h>
12 
13 
14 // constructor
15 BGradientDiamond::BGradientDiamond()
16 {
17 	fData.diamond.cx = 0.0f;
18 	fData.diamond.cy = 0.0f;
19 	fType = TYPE_DIAMOND;
20 }
21 
22 
23 // constructor
24 BGradientDiamond::BGradientDiamond(const BPoint& center)
25 {
26 	fData.diamond.cx = center.x;
27 	fData.diamond.cy = center.y;
28 	fType = TYPE_DIAMOND;
29 }
30 
31 
32 // constructor
33 BGradientDiamond::BGradientDiamond(float cx, float cy)
34 {
35 	fData.diamond.cx = cx;
36 	fData.diamond.cy = cy;
37 	fType = TYPE_DIAMOND;
38 }
39 
40 
41 // Center
42 BPoint
43 BGradientDiamond::Center() const
44 {
45 	return BPoint(fData.diamond.cx, fData.diamond.cy);
46 }
47 
48 
49 // SetCenter
50 void
51 BGradientDiamond::SetCenter(const BPoint& center)
52 {
53 	fData.diamond.cx = center.x;
54 	fData.diamond.cy = center.y;
55 }
56 
57 
58 // SetCenter
59 void
60 BGradientDiamond::SetCenter(float cx, float cy)
61 {
62 	fData.diamond.cx = cx;
63 	fData.diamond.cy = cy;
64 }
65