Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

imageio.cpp

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2002 Michael 'Mickey' Lauer.  All rights reserved.
00003 **
00004 ** This file is part of Opie Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 **********************************************************************/
00015 
00016 #include "imageio.h"
00017 
00018 #include <opie2/odebug.h>
00019 #include <qimage.h>
00020 
00021 using namespace Opie::Core;
00022 
00023 void bufferToImage( int _width, int _height, unsigned char* bp, QImage* image )
00024 {
00025     unsigned char* p;
00026 
00027     image->create( _width, _height, 16 );
00028     for ( int i = 0; i < _height; ++i )
00029     {
00030         p = image->scanLine( i );
00031         for ( int j = 0; j < _width; j++ )
00032         {
00033             *p = *bp;
00034             p++;
00035             bp++;
00036             *p = *bp;
00037             p++;
00038             bp++;
00039         }
00040     }
00041 }
00042 
00043 
00044 void imageToFile( QImage* i, const QString& name, const QString& format, int quality )
00045 {
00046     QImage im = i->convertDepth( 32 );
00047     bool result = im.save( name, format, quality );
00048     if ( !result )
00049     {
00050         oerr << "imageio-Problem while writing to " << name << oendl;
00051     }
00052     else
00053     {
00054         odebug << format << "-image has been successfully captured" << oendl;
00055     }
00056 }

Generated on Sat Nov 5 16:17:31 2005 for OPIE by  doxygen 1.4.2