178 |
kaklik |
1 |
#include <algorithm> |
|
|
2 |
#include "tools.hh" |
|
|
3 |
|
|
|
4 |
using namespace mimas; |
|
|
5 |
using namespace std; |
|
|
6 |
|
|
|
7 |
image< rgba< unsigned char > > qImageToMimasImage( const QImage &qImg ) |
|
|
8 |
{ |
|
|
9 |
QImage temp( qImg.convertToFormat( QImage::Format_RGB32 ) ); |
|
|
10 |
image< rgba< unsigned char > > retVal; |
|
|
11 |
retVal.init( temp.width(), temp.height() ); |
|
|
12 |
rgba< unsigned char > *p = retVal.rawData(); |
|
|
13 |
for( int y=0; y<temp.height(); y++ ) { |
|
|
14 |
copy( (const rgba< unsigned char > *)temp.scanLine( y ), |
|
|
15 |
(const rgba< unsigned char > *)temp.scanLine( y ) + |
|
|
16 |
temp.width(), p ); |
|
|
17 |
p += temp.width(); |
|
|
18 |
}; |
|
|
19 |
return retVal; |
|
|
20 |
} |