Hi, guys, I want to use QPixmap to translate a PNG picture which is not transparent, into a transparent one. But the following codes does not work, for some compiling errors:
int main(int argc, char *argv[])
{
if(argc < 2)
{
//
std::cout << "no original picture file ï¼" << std::endl;
return 0;
}
pix.setMask(pix.createHeuristicMask());
if(argc == 3)
{
toWrite = argv[2];
}
pix.save(toWrite, "PNG");
return a.exec();
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if(argc < 2)
{
//
std::cout << "no original picture file ï¼" << std::endl;
return 0;
}
QPixmap pix(QString(argv[1])); //original picture
pix.setMask(pix.createHeuristicMask());
QString toWrite("out.png");
if(argc == 3)
{
toWrite = argv[2];
}
pix.save(toWrite, "PNG");
return a.exec();
}
To copy to clipboard, switch view to plain text mode
How can the compiler complain that the pix is non-class type"QPixmap"?
Thanks in advance!
Bookmarks