The Inversion Color of image
Loading Image function
dialog2.setNameFilter(tr("Images (*.png *.xpm *.jpg *.bmp)"));
if(dialog2.exec())
{
imageFileName2 = dialog2.selectedFiles().first();
}
primaryImage.load(imageFileName1);
primaryImage.invertPixels();
QFileDialog dialog2(this, "Upload secondary");
dialog2.setNameFilter(tr("Images (*.png *.xpm *.jpg *.bmp)"));
dialog2.setViewMode(QFileDialog::Detail);
if(dialog2.exec())
{
imageFileName2 = dialog2.selectedFiles().first();
}
primaryImage.load(imageFileName1);
primaryImage.invertPixels();
To copy to clipboard, switch view to plain text mode
In paint Function:
painter.
drawImage(QPoint(0,
0), secondaryImage
);
painter.drawImage(QPoint(0, 0), secondaryImage);
To copy to clipboard, switch view to plain text mode
The Changing color version of program ie(commented out until solution found)
for (int x = 0; x < secondaryImage.width(); ++x)
{
for (int y = 0; y < secondaryImage.height(); ++y)
{
if ( secondaryImage.pixel(x, y) == Qt::black)
secondaryImage.
setPixel(x, y,
QColor( 0,
0,
0,
0 ));
//This line gives compiler error :confused: else
secondaryImage.setPixel( x, y, Qt::red ); //Nothing happens here :(
}
}
for (int x = 0; x < secondaryImage.width(); ++x)
{
for (int y = 0; y < secondaryImage.height(); ++y)
{
if ( secondaryImage.pixel(x, y) == Qt::black)
secondaryImage.setPixel(x, y, QColor( 0, 0, 0, 0 )); //This line gives compiler error :confused:
else
secondaryImage.setPixel( x, y, Qt::red ); //Nothing happens here :(
}
}
To copy to clipboard, switch view to plain text mode
Ideas most welcome
Bookmarks