Exemple #1
0
bool DeltaRGB::contains(const CColor &c1, const CColor &c2) const {
  double rdiff = fabs(c1.getRed()-c2.getRed());
  double gdiff = fabs(c1.getGreen()-c2.getGreen());
  double bdiff = fabs(c1.getBlue()-c2.getBlue());
  
  if (rdiff <= delta_red && gdiff <= delta_green && bdiff <= delta_blue)
    return true;
  return false;
}
Exemple #2
0
CColor CColor::modulate ( const CColor& color ) const
{
    unsigned char R = static_cast<unsigned char> ( getRed()   * color.getRed()   / 255 );
    unsigned char G = static_cast<unsigned char> ( getGreen() * color.getGreen() / 255 );
    unsigned char B = static_cast<unsigned char> ( getBlue()  * color.getBlue()  / 255 );
    unsigned char A = static_cast<unsigned char> ( getAlpha() * color.getAlpha() / 255 );

    return CColor ( R , G , B , A );
}
Exemple #3
0
CColor CColor::operator - ( const CColor& color ) const
{
    int R = getRed()   - color.getRed();
    int G = getGreen() - color.getGreen();
    int B = getBlue()  - color.getBlue();
    int A = getAlpha() - color.getAlpha();

    CColor newc;
    newc.setInt ( R , G , B , A );

    return newc;
}
Exemple #4
0
double L2dist2(const CColor &c1, const CColor &c2) {
  double dr = c1.getRed() - c2.getRed();
  double dg = c1.getGreen() - c2.getGreen();
  double db = c1.getBlue() - c2.getBlue();
  return dr*dr + dg*dg + db*db;
}
Exemple #5
0
double L1dist(const CColor &c1, const CColor &c2) {
  return ((fabs(c1.getRed() - c2.getRed()) +
	   fabs(c1.getGreen() - c2.getGreen()) +
	   fabs(c1.getBlue() - c2.getBlue()))/3.0);
}