mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
caf: implement checking if a color is in a color table
This commit is contained in:
@@ -132,7 +132,24 @@ caf::ColorTable ColorTable::inverted() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub ColorTable::fromQColor( const QColor& color )
|
||||
bool ColorTable::contains(const cvf::Color3ub& color) const
|
||||
{
|
||||
auto it = std::find(m_colors.begin(), m_colors.end(), color);
|
||||
return it != m_colors.end();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool ColorTable::contains(const cvf::Color3f& color) const
|
||||
{
|
||||
return contains(cvf::Color3ub(color));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub ColorTable::fromQColor(const QColor& color)
|
||||
{
|
||||
return cvf::Color3ub( color.red(), color.green(), color.blue() );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user