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:
parent
007f0282df
commit
1d16b55fdc
@ -129,6 +129,23 @@ caf::ColorTable ColorTable::inverted() const
|
||||
return ColorTable( invertedColors );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
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));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -67,6 +67,9 @@ public:
|
||||
|
||||
ColorTable inverted() const;
|
||||
|
||||
bool contains(const cvf::Color3ub& color) const;
|
||||
bool contains(const cvf::Color3f& color) const;
|
||||
|
||||
static cvf::Color3ub fromQColor(const QColor& color);
|
||||
static cvf::Color3ubArray interpolateColorArray(const cvf::Color3ubArray& colorArray, size_t targetColorCount);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user