file.h:
Qt Code:
  1. QImage background;
To copy to clipboard, switch view to plain text mode 

file.cxx:
Qt Code:
  1. this->background = QImage(size, QImage::Format_RGB32);
  2. this->background.fill(Qt::black);
  3. std::vector<double>::const_iterator it = values.begin();
  4. for (int j=0 ; j<this->original_size[1] ; j++)
  5. for (int i=0 ; i<this->original_size[0] ; i++,it++)
  6. if (*it >= 1)
  7. for (int ii=0 ; ii<factor ; ii++)
  8. for (int jj=0 ; jj<factor ; jj++)
  9. this->background.setPixel(i*factor+ii, j*factor+jj, Qt::green);
  10. int g=0, b=0;
  11. for (int j=0 ; j<background.height() ; j++)
  12. for (int i=0 ; i<background.width() ; i++)
  13. if (background.pixel(i,j) == Qt::black)
  14. b++;
  15. else if (background.pixel(i,j) == Qt::green)
  16. g++;
  17. printf("%d black pixels and %d green pixels\n", b, g);
To copy to clipboard, switch view to plain text mode 

Expected result: some green pixels among black ones (I checked there really are some points for which *it == 1)
Actual result: 0 0 !