DocumentModelPointMatch::DocumentModelPointMatch(const DocumentModelPointMatch &other) :
  m_maxPointSize (other.maxPointSize()),
  m_paletteColorAccepted (other.paletteColorAccepted()),
  m_paletteColorCandidate (other.paletteColorCandidate()),
  m_paletteColorRejected (other.paletteColorRejected())
{
}
QList<PointMatchPixel> DigitizeStatePointMatch::extractSamplePointPixels (const QImage &img,
                                                                          const DocumentModelPointMatch &modelPointMatch,
                                                                          const QPointF &posScreen) const
{
  LOG4CPP_INFO_S ((*mainCat)) << "DigitizeStatePointMatch::extractSamplePointPixels";

  // All points inside modelPointMatch.maxPointSize() are collected, whether or not they
  // are on or off. Originally only the on points were collected, but obvious mismatches
  // were happening (example, 3x3 point would appear to be found in several places inside 8x32 rectangle)
  QList<PointMatchPixel> samplePointPixels;

  int radiusMax = qFloor (modelPointMatch.maxPointSize() / 2);

  ColorFilter colorFilter;
  for (int xOffset = -radiusMax; xOffset <= radiusMax; xOffset++) {
    for (int yOffset = -radiusMax; yOffset <= radiusMax; yOffset++) {

      int x = qFloor (posScreen.x() + xOffset);
      int y = qFloor (posScreen.y() + yOffset);
      int radius = qFloor (qSqrt (xOffset * xOffset + yOffset * yOffset));

      if (radius <= radiusMax) {

        bool pixelIsOn = colorFilter.pixelFilteredIsOn (img,
                                                        x,
                                                        y);

        PointMatchPixel point (xOffset,
                               yOffset,
                               pixelIsOn);

        samplePointPixels.push_back (point);
      }
    }
  }

  return samplePointPixels;
}