See QImage ctor
See QImage ctor
Thanks.
Can we cast short int -> uchar* without any error?
wysotaQt allows you to use everything you want
--------------------------------------------------------------------------------
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
abort(); // trap; generates core dump
#else
exit(1); // goodbye cruel world
#endif
uchar is 8b long whereas short int is 16b on 32b machines. Might be different on others, but I suggest you try and see for yourself.
Ok. Thanks all for help.
Here's the final code I have:
Qt Code:
/*! Some data*/ QByteArray array; array.resize(18); array[0] =0x0089; array[1] =0x0044; array[2] =0x0010; array[3] =0x0022; array[4] =0x0094; array[5] =0x0002; array[6] =0x0068; array[7] =0x0001; image.loadFromData(array);To copy to clipboard, switch view to plain text mode
Now, though, I would like to convert this image: change black pixels -> transparent background, change white-like element to the selected colour.
If you have any idea I would appreciate your help.
Kacper
wysotaQt allows you to use everything you want
--------------------------------------------------------------------------------
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
abort(); // trap; generates core dump
#else
exit(1); // goodbye cruel world
#endif
Got the answer:
Qt Code:
qDebug()<<image.colorTable().size();/*!< "2" -> white & black */ image.setColor(0,Qt::transparent);/*!< Black -> transparent*/ image.setColor(1,qRgb(255,0,0));/*!< White-> red*/To copy to clipboard, switch view to plain text mode
Sorry for bothering you.
Kacper
wysotaQt allows you to use everything you want
--------------------------------------------------------------------------------
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
abort(); // trap; generates core dump
#else
exit(1); // goodbye cruel world
#endif
Bookmarks