I want to find and cut out the painted area (painted means: not transparent.). Do you got any Ideas how to do that?
Data Informations:
unsigned char array* imageData; // (each entry = grey value of pixel)
int imageHeight;
int imageWidth;
int imageSize;
Example Code:

Qt Code:
  1. QPixmap img(imageWidth , imageHeight);
  2. img.fill(Qt::transparent);
  3. QPainter paint(&img);
  4. paint.setCompositionMode(QPainter::CompositionMode_Source);
  5.  
  6. int currentPos;
  7.  
  8.  
  9. while(currentpos < imageDataSize)
  10. {
  11. int x = imageDataSize % imageWidth;
  12. int y = imageDataSize / imageWidth+1;
  13. int greyVal = imageData[currentPos];
  14.  
  15. paint.setPen(QColor(greyVal,greyVal,greyVal);
  16. if(hmm < 160)
  17. {
  18. paint.drawPoint(x,y);
  19. } else {
  20. paint.save();
  21. paint.setOpacity(0.0);
  22. paint.setPen(QColor(255,255,255,255));
  23. paint.drawPoint(x,y);
  24. paint.restore();
  25.  
  26. }
  27. currentPos++;
  28. }
To copy to clipboard, switch view to plain text mode