Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 1.18 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Heap block modified past requested size
  2. return QPixmap::fromImage(qimage);
  3.        
  4. QPixmap Interpolation::getData() {
  5.     QPointF pt(0, 0);
  6.     QRgb color;
  7.     QImage qimage(m_width, m_height, QImage::Format_ARGB32);
  8.     qimage.fill(Qt::transparent);
  9.  
  10.     for (int i(0); i < m_height; ++i) {
  11.         m_progress->setValue(m_width+i);
  12.         QRgb *line = (QRgb *)qimage.scanLine(i);
  13.         for (int j(0); j < m_width; ++j) {
  14.             pt.setX(j);
  15.             pt.setY(i);
  16.             line += 1;
  17.             if (isInHull(pt)) {
  18.                 color = colorScale(interp(&pt));
  19.                 *line = color; //If I remove this part the program won't crash
  20.             }
  21.         }
  22.     }  
  23.     return QPixmap::fromImage(qimage);
  24. }
  25.        
  26. QRgb Interpolation::colorScale(qreal value)
  27. {
  28.     int cat;
  29.     cat = qFloor(qreal(9)*(value-m_min)/(m_max-m_min));
  30.  
  31.     return m_couleurs[cat];
  32. }
  33.        
  34. m_couleurs[0] = qRgb(247, 252, 240);
  35. m_couleurs[1] = qRgb(224, 243, 219);
  36. m_couleurs[2] = qRgb(204, 235, 197);
  37. m_couleurs[3] = qRgb(168, 221, 181);
  38. m_couleurs[4] = qRgb(123, 204, 196);
  39. m_couleurs[5] = qRgb(78, 179, 211);
  40. m_couleurs[6] = qRgb(43, 140, 190);
  41. m_couleurs[7] = qRgb(8, 104, 172);
  42. m_couleurs[8] = qRgb(8, 64, 129);