0022627: Change OCCT memory management defaults
[occt.git] / src / Aspect / Aspect_ColorPixel.cxx
CommitLineData
7fd59977 1#include <Aspect_ColorPixel.ixx>
2
3Aspect_ColorPixel::Aspect_ColorPixel () {
4
5 myColor.SetValues( 0.,0.,0. , Quantity_TOC_RGB ) ;
6
7}
8
9Aspect_ColorPixel::Aspect_ColorPixel (const Quantity_Color& aColor) {
10
11 myColor = aColor;
12
13}
14
15const Quantity_Color& Aspect_ColorPixel::Value() const {
16
17return myColor;
18
19}
20
21
22void Aspect_ColorPixel::SetValue(const Quantity_Color& aColor) {
23
24 myColor = aColor;
25
26}
27
28void Aspect_ColorPixel::Print(Standard_OStream& s) const
29
30{ Standard_Real r,g,b ;
31
32 myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
33
34 s << "( " << r << ", " << g << ", " << b << " )" << flush;
35}
36
37// ------------------------------------------------------------------
38// Hascode : Computes a hascoding value for a given Aspect_ColorPixel
39// ------------------------------------------------------------------
40Standard_Integer Aspect_ColorPixel::HashCode(const Standard_Integer Upper) const
41{ Standard_Real r,g,b ;
42 Standard_Integer ret ;
43
44 myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
45
46 ret = ( Standard_Integer ) ( ( r + g + b ) * Upper ) ;
47
48 return ( ret % Upper ) + 1 ;
49}
50
51
52Standard_Boolean Aspect_ColorPixel::IsEqual(const Aspect_ColorPixel& Other) const
53{
54 return (myColor == Other.myColor);
55}
56
57Standard_Boolean Aspect_ColorPixel::IsNotEqual(const Aspect_ColorPixel& Other) const
58{
59 return !IsEqual(Other);
60}