[opengtl-commits] [472] use the image docker |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 472
Author: cyrille
Date: 2008-11-10 00:18:49 +0100 (Mon, 10 Nov 2008)
Log Message:
-----------
use the image docker
Modified Paths:
--------------
trunk/GTLDesigner/src/gtldesigner.cpp
Modified: trunk/GTLDesigner/src/gtldesigner.cpp
===================================================================
--- trunk/GTLDesigner/src/gtldesigner.cpp 2008-11-09 22:37:06 UTC (rev 471)
+++ trunk/GTLDesigner/src/gtldesigner.cpp 2008-11-09 23:18:49 UTC (rev 472)
@@ -46,6 +46,7 @@
#include <OpenShiva/Kernel.h>
#include <GTLCore/Region.h>
#include <GTLImageIO/ImageDCRegistry.h>
+#include <GTLImageIO/ImageDC.h>
#include "ImageViewer.h"
#include "ErrorMessagesModel.h"
@@ -197,28 +198,51 @@
p.compile();
if(p.isCompiled())
{
+ GTLCore::Region region(0,0,800,600);
+ if( p.hasGeneratedFunction() )
+ {
+ region = p.generated();
+ }
std::list<GTLCore::AbstractImage*> inputImages;
-/* for( int k = 0; k < m_mainWindow->listImages->count(); ++k)
+ std::list<GTLCore::Region> inputDOD;
+ for( int k = 0; k < ui_imagesDocker->listImages->count(); ++k)
{
- QString fileName = m_mainWindow->listImages->item( k )->data( Qt::UserRole ).toString();
- QImage img;
- if (not img.load(fileName)) {
+ GTLCore::String fileName = ui_imagesDocker->listImages->item( k )->data( Qt::UserRole ).toString().toLatin1().data();
+ const GTLImageIO::ImageDC* decoder = GTLImageIO::ImageDCRegistry::instance()->decoder( fileName );
+ if( not decoder )
+ {
QMessageBox::warning(this, tr("QtShiva"),
tr("Cannot read image %1..")
- .arg(fileName));
- return;
+ .arg(fileName.c_str()));
}
- GTLCore::AbstractImage* iImage = new QImageImage( img );
- inputImages.push_back( iImage );
- }*/
- QImageImage image( QImage( 1000, 1000, QImage::Format_ARGB32) );
- p.evaluatePixeles( GTLCore::Region(0,0, 1000,1000), inputImages, &image );
+ GTLCore::Region region;
+ GTLCore::AbstractImage* image = decoder->decode( fileName, ®ion, 0 );
+ if( not image )
+ {
+ QMessageBox::warning(this, tr("QtShiva"),
+ tr("Cannot read image %1..")
+ .arg(fileName.c_str()));
+ }
+ inputImages.push_back( image );
+ inputDOD.push_back( region );
+ }
+ if( p.hasChangedFunction() )
+ {
+ int i = 0;
+ for( std::list<GTLCore::Region>::iterator it = inputDOD.begin(); it != inputDOD.end(); ++it, ++i)
+ {
+ region += p.changed( *it, i, inputDOD );
+ }
+ }
+ kDebug() << region.width() << " " << region.height();
+ QImageImage image( QImage( region.width(), region.height(), QImage::Format_ARGB32) );
+ p.evaluatePixeles( region, inputImages, &image );
showImage( image.image() );
-/* for( std::list<GTLCore::AbstractImage*>::iterator it = inputImages.begin();
+ for( std::list<GTLCore::AbstractImage*>::iterator it = inputImages.begin();
it != inputImages.end(); ++it)
{
delete *it;
- }*/
+ }
} else {
m_listView->setModel( new ErrorMessagesModel( p.compilationErrors() ) );
}