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:
QPixmap img
(imageWidth , imageHeight
);
img.fill(Qt::transparent);
paint.
setCompositionMode(QPainter::CompositionMode_Source);
int currentPos;
while(currentpos < imageDataSize)
{
int x = imageDataSize % imageWidth;
int y = imageDataSize / imageWidth+1;
int greyVal = imageData[currentPos];
paint.
setPen(QColor(greyVal,greyVal,greyVal
);
if(hmm < 160)
{
paint.drawPoint(x,y);
} else {
paint.save();
paint.setOpacity(0.0);
paint.
setPen(QColor(255,
255,
255,
255));
paint.drawPoint(x,y);
paint.restore();
}
currentPos++;
}
QPixmap img(imageWidth , imageHeight);
img.fill(Qt::transparent);
QPainter paint(&img);
paint.setCompositionMode(QPainter::CompositionMode_Source);
int currentPos;
while(currentpos < imageDataSize)
{
int x = imageDataSize % imageWidth;
int y = imageDataSize / imageWidth+1;
int greyVal = imageData[currentPos];
paint.setPen(QColor(greyVal,greyVal,greyVal);
if(hmm < 160)
{
paint.drawPoint(x,y);
} else {
paint.save();
paint.setOpacity(0.0);
paint.setPen(QColor(255,255,255,255));
paint.drawPoint(x,y);
paint.restore();
}
currentPos++;
}
To copy to clipboard, switch view to plain text mode
Bookmarks