[opengtl-commits] [550] use the channels position to indicates that QImage have revert order |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 550
Author: cyrille
Date: 2008-12-18 22:40:01 +0100 (Thu, 18 Dec 2008)
Log Message:
-----------
use the channels position to indicates that QImage have revert order
Modified Paths:
--------------
trunk/libQtGTL/QtGTL/QImageImage.cpp
Modified: trunk/libQtGTL/QtGTL/QImageImage.cpp
===================================================================
--- trunk/libQtGTL/QtGTL/QImageImage.cpp 2008-12-18 21:38:47 UTC (rev 549)
+++ trunk/libQtGTL/QtGTL/QImageImage.cpp 2008-12-18 21:40:01 UTC (rev 550)
@@ -41,16 +41,41 @@
return static_cast<const QImageBuffer*>(buffer())->image();
}
+inline std::vector< std::size_t > createPositions( std::size_t _nc )
+{
+ std::vector< std::size_t > v;
+ v.push_back( 2 );
+ v.push_back( 1 );
+ v.push_back( 0 );
+ if( _nc == 4 )
+ {
+ v.push_back( 3 );
+ }
+ return v;
+}
+
GTLCore::PixelDescription QImageImage::imageToPixelDescription( const QImage& img )
{
switch( img.format())
{
case QImage::Format_RGB32:
- return GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 4 );
+ {
+ GTLCore::PixelDescription p = GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 4 );
+ p.setChannelPositions( createPositions( 4 ) );
+ return p;
+ }
case QImage::Format_ARGB32:
- return GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 4 );
+ {
+ GTLCore::PixelDescription p = GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 4 );
+ p.setChannelPositions( createPositions( 4 ) );
+ return p;
+ }
case QImage::Format_RGB888:
- return GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 3 );
+ {
+ GTLCore::PixelDescription p = GTLCore::PixelDescription( GTLCore::Type::UnsignedInteger8, 3 );
+ p.setChannelPositions( createPositions( 3 ) );
+ return p;
+ }
default:
qFatal("Unsupported QImage");
}