mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
60
src/Aspect/Aspect_ColorPixel.cxx
Executable file
60
src/Aspect/Aspect_ColorPixel.cxx
Executable file
@@ -0,0 +1,60 @@
|
||||
#include <Aspect_ColorPixel.ixx>
|
||||
|
||||
Aspect_ColorPixel::Aspect_ColorPixel () {
|
||||
|
||||
myColor.SetValues( 0.,0.,0. , Quantity_TOC_RGB ) ;
|
||||
|
||||
}
|
||||
|
||||
Aspect_ColorPixel::Aspect_ColorPixel (const Quantity_Color& aColor) {
|
||||
|
||||
myColor = aColor;
|
||||
|
||||
}
|
||||
|
||||
const Quantity_Color& Aspect_ColorPixel::Value() const {
|
||||
|
||||
return myColor;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Aspect_ColorPixel::SetValue(const Quantity_Color& aColor) {
|
||||
|
||||
myColor = aColor;
|
||||
|
||||
}
|
||||
|
||||
void Aspect_ColorPixel::Print(Standard_OStream& s) const
|
||||
|
||||
{ Standard_Real r,g,b ;
|
||||
|
||||
myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
|
||||
|
||||
s << "( " << r << ", " << g << ", " << b << " )" << flush;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// Hascode : Computes a hascoding value for a given Aspect_ColorPixel
|
||||
// ------------------------------------------------------------------
|
||||
Standard_Integer Aspect_ColorPixel::HashCode(const Standard_Integer Upper) const
|
||||
{ Standard_Real r,g,b ;
|
||||
Standard_Integer ret ;
|
||||
|
||||
myColor.Values( r,g,b, Quantity_TOC_RGB ) ;
|
||||
|
||||
ret = ( Standard_Integer ) ( ( r + g + b ) * Upper ) ;
|
||||
|
||||
return ( ret % Upper ) + 1 ;
|
||||
}
|
||||
|
||||
|
||||
Standard_Boolean Aspect_ColorPixel::IsEqual(const Aspect_ColorPixel& Other) const
|
||||
{
|
||||
return (myColor == Other.myColor);
|
||||
}
|
||||
|
||||
Standard_Boolean Aspect_ColorPixel::IsNotEqual(const Aspect_ColorPixel& Other) const
|
||||
{
|
||||
return !IsEqual(Other);
|
||||
}
|
Reference in New Issue
Block a user