diff options
Diffstat (limited to 'src/imageutils')
-rw-r--r-- | src/imageutils/croppedqimage.cpp | 30 | ||||
-rw-r--r-- | src/imageutils/croppedqimage.h | 16 | ||||
-rw-r--r-- | src/imageutils/imageutils.cpp | 50 | ||||
-rw-r--r-- | src/imageutils/imageutils.h | 20 | ||||
-rw-r--r-- | src/imageutils/jpegcontent.cpp | 128 | ||||
-rw-r--r-- | src/imageutils/jpegcontent.h | 42 | ||||
-rw-r--r-- | src/imageutils/jpegint.h | 106 | ||||
-rw-r--r-- | src/imageutils/orientation.h | 2 | ||||
-rw-r--r-- | src/imageutils/scale.cpp | 124 | ||||
-rw-r--r-- | src/imageutils/testjpegcontent.cpp | 54 | ||||
-rw-r--r-- | src/imageutils/transupp.c | 20 |
11 files changed, 296 insertions, 296 deletions
diff --git a/src/imageutils/croppedqimage.cpp b/src/imageutils/croppedqimage.cpp index 0271e85..7f47366 100644 --- a/src/imageutils/croppedqimage.cpp +++ b/src/imageutils/croppedqimage.cpp @@ -23,43 +23,43 @@ namespace ImageUtils { -// This class is used in ImageView::performPaint(). Just using QImage::copy( QRect ) +// This class is used in ImageView::performPaint(). Just using TQImage::copy( TQRect ) // takes a significant time with very large images. So instead of copying the image data -// just create CroppedQImage which fakes a subimage by manipulating its scanline pointers. +// just create CroppedTQImage which fakes a subimage by manipulating its scanline pointers. // That will of course break if something doesn't use scanlines but accesses the image -// data directly, QImage::copy() being the most notable case. There are two ways +// data directly, TQImage::copy() being the most notable case. There are two ways // to handle that: 1) It is possible to manually call normalize() which will make -// CroppedQImage copy the image data and own it, just like proper QImage. 2) CroppedQImage -// has as a data member also QImage holding the original image. This ensures that all -// the original image data are still available for the whole lifetime of CroppedQImage. +// CroppedTQImage copy the image data and own it, just like proper TQImage. 2) CroppedTQImage +// has as a data member also TQImage holding the original image. This ensures that all +// the original image data are still available for the whole lifetime of CroppedTQImage. -CroppedQImage::CroppedQImage( const QImage& im, const QRect& rect ) - : QImage( rect.size(), im.depth(), im.numColors(), im.bitOrder()) +CroppedTQImage::CroppedTQImage( const TQImage& im, const TQRect& rect ) + : TQImage( rect.size(), im.depth(), im.numColors(), im.bitOrder()) , orig( im ) { if( im.isNull()) return; - memcpy( colorTable(), im.colorTable(), im.numColors() * sizeof( QRgb )); + memcpy( tqcolorTable(), im.tqcolorTable(), im.numColors() * sizeof( TQRgb )); setAlphaBuffer( im.hasAlphaBuffer()); setDotsPerMeterX( im.dotsPerMeterX()); setDotsPerMeterY( im.dotsPerMeterY()); //data->offset = im.offset(); - // make scanlines point to right places in the original QImage + // make scanlines point to right places in the original TQImage for( int i = 0; i < height(); ++i ) - jumpTable()[ i ] = im.scanLine( rect.y() + i ) + rect.x() * ( depth() / 8 ); + const_cast<CroppedTQImage*>(this)->jumpTable()[ i ] = const_cast<TQImage&>(im).scanLine( rect.y() + i ) + rect.x() * ( depth() / 8 ); } -CroppedQImage& CroppedQImage::operator= ( const QImage& im ) +CroppedTQImage& CroppedTQImage::operator= ( const TQImage& im ) { - QImage::operator=( im ); + TQImage::operator=( im ); return *this; } -void CroppedQImage::normalize() +void CroppedTQImage::normalize() { - // is it a normal QImage with its own data? + // is it a normal TQImage with its own data? uchar* firstdata = ( uchar* )( jumpTable() + height()); if( scanLine( 0 ) == firstdata ) return; diff --git a/src/imageutils/croppedqimage.h b/src/imageutils/croppedqimage.h index c8c2ac3..f13334f 100644 --- a/src/imageutils/croppedqimage.h +++ b/src/imageutils/croppedqimage.h @@ -18,23 +18,23 @@ */ -#ifndef CROPPED_QIMAGE_H -#define CROPPED_QIMAGE_H +#ifndef CROPPED_TQIMAGE_H +#define CROPPED_TQIMAGE_H -#include <qimage.h> +#include <tqimage.h> namespace ImageUtils { -class CroppedQImage - : public QImage +class CroppedTQImage + : public TQImage { public: - CroppedQImage( const QImage& im, const QRect& rect ); - CroppedQImage& operator= ( const QImage& im ); + CroppedTQImage( const TQImage& im, const TQRect& rect ); + CroppedTQImage& operator= ( const TQImage& im ); void normalize(); private: - QImage orig; + TQImage orig; }; } // namespace diff --git a/src/imageutils/imageutils.cpp b/src/imageutils/imageutils.cpp index 0dce222..2ec1209 100644 --- a/src/imageutils/imageutils.cpp +++ b/src/imageutils/imageutils.cpp @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -20,9 +20,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <math.h> -// Qt -#include <qimage.h> -#include <qwmatrix.h> +// TQt +#include <tqimage.h> +#include <tqwmatrix.h> // KDE #include <kdebug.h> @@ -35,8 +35,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. namespace ImageUtils { -QWMatrix transformMatrix(Orientation orientation) { - QWMatrix matrix; +TQWMatrix transformMatrix(Orientation orientation) { + TQWMatrix matrix; switch (orientation) { case NOT_AVAILABLE: case NORMAL: @@ -77,7 +77,7 @@ QWMatrix transformMatrix(Orientation orientation) { } -QImage transform(const QImage& img, Orientation orientation) { +TQImage transform(const TQImage& img, Orientation orientation) { if (orientation != NOT_AVAILABLE && orientation != NORMAL) { return img.xForm(transformMatrix(orientation)); } else { @@ -123,9 +123,9 @@ int changeUsingTable( int value, const int table[] ) template< int operation( int, int ) > static -QImage changeImage( const QImage& image, int value ) +TQImage changeImage( const TQImage& image, int value ) { - QImage im = image; + TQImage im = image; im.detach(); if( im.numColors() == 0 ) /* truecolor */ { @@ -142,14 +142,14 @@ QImage changeImage( const QImage& image, int value ) y < im.height(); ++y ) { - QRgb* line = reinterpret_cast< QRgb* >( im.scanLine( y )); + TQRgb* line = reinterpret_cast< TQRgb* >( im.scanLine( y )); for( int x = 0; x < im.width(); ++x ) - line[ x ] = qRgba( changeUsingTable( qRed( line[ x ] ), table ), - changeUsingTable( qGreen( line[ x ] ), table ), - changeUsingTable( qBlue( line[ x ] ), table ), - changeUsingTable( qAlpha( line[ x ] ), table )); + line[ x ] = tqRgba( changeUsingTable( tqRed( line[ x ] ), table ), + changeUsingTable( tqGreen( line[ x ] ), table ), + changeUsingTable( tqBlue( line[ x ] ), table ), + changeUsingTable( tqAlpha( line[ x ] ), table )); } } else @@ -158,32 +158,32 @@ QImage changeImage( const QImage& image, int value ) y < im.height(); ++y ) { - QRgb* line = reinterpret_cast< QRgb* >( im.scanLine( y )); + TQRgb* line = reinterpret_cast< TQRgb* >( im.scanLine( y )); for( int x = 0; x < im.width(); ++x ) - line[ x ] = qRgb( changeUsingTable( qRed( line[ x ] ), table ), - changeUsingTable( qGreen( line[ x ] ), table ), - changeUsingTable( qBlue( line[ x ] ), table )); + line[ x ] = tqRgb( changeUsingTable( tqRed( line[ x ] ), table ), + changeUsingTable( tqGreen( line[ x ] ), table ), + changeUsingTable( tqBlue( line[ x ] ), table )); } } } else { - QRgb* colors = im.colorTable(); + TQRgb* colors = im.tqcolorTable(); for( int i = 0; i < im.numColors(); ++i ) - colors[ i ] = qRgb( operation( qRed( colors[ i ] ), value ), - operation( qGreen( colors[ i ] ), value ), - operation( qBlue( colors[ i ] ), value )); + colors[ i ] = tqRgb( operation( tqRed( colors[ i ] ), value ), + operation( tqGreen( colors[ i ] ), value ), + operation( tqBlue( colors[ i ] ), value )); } return im; } // brightness is multiplied by 100 in order to avoid floating point numbers -QImage changeBrightness( const QImage& image, int brightness ) +TQImage changeBrightness( const TQImage& image, int brightness ) { if( brightness == 0 ) // no change return image; @@ -192,7 +192,7 @@ QImage changeBrightness( const QImage& image, int brightness ) // contrast is multiplied by 100 in order to avoid floating point numbers -QImage changeContrast( const QImage& image, int contrast ) +TQImage changeContrast( const TQImage& image, int contrast ) { if( contrast == 100 ) // no change return image; @@ -200,7 +200,7 @@ QImage changeContrast( const QImage& image, int contrast ) } // gamma is multiplied by 100 in order to avoid floating point numbers -QImage changeGamma( const QImage& image, int gamma ) +TQImage changeGamma( const TQImage& image, int gamma ) { if( gamma == 100 ) // no change return image; diff --git a/src/imageutils/imageutils.h b/src/imageutils/imageutils.h index f234a07..b661eda 100644 --- a/src/imageutils/imageutils.h +++ b/src/imageutils/imageutils.h @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -21,8 +21,8 @@ Copyright 2000-2004 Aurélien Gâteau #ifndef IMAGEUTILS_H #define IMAGEUTILS_H -// Qt -#include <qimage.h> +// TQt +#include <tqimage.h> // Local #include "imageutils/orientation.h" @@ -30,20 +30,20 @@ Copyright 2000-2004 Aurélien Gâteau namespace ImageUtils { enum SmoothAlgorithm { SMOOTH_NONE, SMOOTH_FAST, SMOOTH_NORMAL, SMOOTH_BEST }; - QImage scale(const QImage& image, int width, int height, - SmoothAlgorithm alg, QImage::ScaleMode mode = QImage::ScaleFree, double blur = 1.0); + TQImage scale(const TQImage& image, int width, int height, + SmoothAlgorithm alg, TQ_ScaleMode mode = TQ_ScaleFree, double blur = 1.0); int extraScalePixels( SmoothAlgorithm alg, double zoom, double blur = 1.0 ); - QImage transform(const QImage& img, Orientation orientation); + TQImage transform(const TQImage& img, Orientation orientation); - QImage changeBrightness( const QImage& image, int brightness ); + TQImage changeBrightness( const TQImage& image, int brightness ); - QImage changeContrast( const QImage& image, int contrast ); + TQImage changeContrast( const TQImage& image, int contrast ); - QImage changeGamma( const QImage& image, int gamma ); + TQImage changeGamma( const TQImage& image, int gamma ); - QWMatrix transformMatrix(Orientation orientation); + TQWMatrix transformMatrix(Orientation orientation); } #endif diff --git a/src/imageutils/jpegcontent.cpp b/src/imageutils/jpegcontent.cpp index d23d74f..5bcb7ef 100644 --- a/src/imageutils/jpegcontent.cpp +++ b/src/imageutils/jpegcontent.cpp @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab: /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -28,12 +28,12 @@ extern "C" { #include "transupp.h" } -// Qt -#include <qbuffer.h> -#include <qfile.h> -#include <qimage.h> -#include <qmap.h> -#include <qwmatrix.h> +// TQt +#include <tqbuffer.h> +#include <tqfile.h> +#include <tqimage.h> +#include <tqmap.h> +#include <tqwmatrix.h> // KDE #include <kdebug.h> @@ -69,7 +69,7 @@ const int INMEM_DST_DELTA=4096; // //------------------------------------------ struct inmem_src_mgr : public jpeg_source_mgr { - QByteArray* mInput; + TQByteArray* mInput; }; void inmem_init_source(j_decompress_ptr cinfo) { @@ -107,7 +107,7 @@ void inmem_term_source(j_decompress_ptr /*cinfo*/) { // //----------------------------------------------- struct inmem_dest_mgr : public jpeg_destination_mgr { - QByteArray* mOutput; + TQByteArray* mOutput; void dump() { kdDebug() << "dest_mgr:\n"; @@ -120,7 +120,7 @@ struct inmem_dest_mgr : public jpeg_destination_mgr { void inmem_init_destination(j_compress_ptr cinfo) { inmem_dest_mgr* dest=(inmem_dest_mgr*)(cinfo->dest); if (dest->mOutput->size()==0) { - bool result=dest->mOutput->resize(INMEM_DST_DELTA); + bool result=dest->mOutput->tqresize(INMEM_DST_DELTA); Q_ASSERT(result); } dest->free_in_buffer=dest->mOutput->size(); @@ -129,7 +129,7 @@ void inmem_init_destination(j_compress_ptr cinfo) { int inmem_empty_output_buffer(j_compress_ptr cinfo) { inmem_dest_mgr* dest=(inmem_dest_mgr*)(cinfo->dest); - bool result=dest->mOutput->resize(dest->mOutput->size() + INMEM_DST_DELTA); + bool result=dest->mOutput->tqresize(dest->mOutput->size() + INMEM_DST_DELTA); Q_ASSERT(result); dest->next_output_byte=(JOCTET*)( dest->mOutput->data() + dest->mOutput->size() - INMEM_DST_DELTA ); dest->free_in_buffer=INMEM_DST_DELTA; @@ -141,7 +141,7 @@ void inmem_term_destination(j_compress_ptr cinfo) { inmem_dest_mgr* dest=(inmem_dest_mgr*)(cinfo->dest); int finalSize=dest->next_output_byte - (JOCTET*)(dest->mOutput->data()); Q_ASSERT(finalSize>=0); - dest->mOutput->resize(finalSize); + dest->mOutput->tqresize(finalSize); } @@ -151,16 +151,16 @@ void inmem_term_destination(j_compress_ptr cinfo) { // //--------------------- struct JPEGContent::Private { - QByteArray mRawData; - QSize mSize; - QString mComment; - QString mAperture; - QString mExposureTime; - QString mFocalLength; - QString mIso; + TQByteArray mRawData; + TQSize mSize; + TQString mComment; + TQString mAperture; + TQString mExposureTime; + TQString mFocalLength; + TQString mIso; bool mPendingTransformation; - QWMatrix mTransformMatrix; + TQWMatrix mTransformMatrix; Exiv2::ExifData mExifData; Private() { @@ -184,7 +184,7 @@ struct JPEGContent::Private { } - void setupInmemDestination(j_compress_ptr cinfo, QByteArray* outputData) { + void setupInmemDestination(j_compress_ptr cinfo, TQByteArray* outputData) { Q_ASSERT(!cinfo->dest); inmem_dest_mgr* dest = (inmem_dest_mgr*) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, @@ -223,7 +223,7 @@ struct JPEGContent::Private { jpeg_destroy_decompress(&srcinfo); return false; } - mSize=QSize(srcinfo.image_width, srcinfo.image_height); + mSize=TQSize(srcinfo.image_width, srcinfo.image_height); jpeg_destroy_decompress(&srcinfo); return true; @@ -246,8 +246,8 @@ JPEGContent::~JPEGContent() { } -bool JPEGContent::load(const QString& path) { - QFile file(path); +bool JPEGContent::load(const TQString& path) { + TQFile file(path); if (!file.open(IO_ReadOnly)) { kdError() << "Could not open '" << path << "' for reading\n"; return false; @@ -256,7 +256,7 @@ bool JPEGContent::load(const QString& path) { } -bool JPEGContent::loadFromData(const QByteArray& data) { +bool JPEGContent::loadFromData(const TQByteArray& data) { d->mPendingTransformation = false; d->mTransformMatrix.reset(); @@ -278,7 +278,7 @@ bool JPEGContent::loadFromData(const QByteArray& data) { } d->mExifData = image->exifData(); - d->mComment = QString::fromUtf8( image->comment().c_str() ); + d->mComment = TQString::fromUtf8( image->comment().c_str() ); d->mAperture=aperture(); d->mExposureTime=exposureTime(); @@ -321,14 +321,14 @@ int JPEGContent::dotsPerMeterY() const { } -int JPEGContent::dotsPerMeter(const QString& keyName) const { +int JPEGContent::dotsPerMeter(const TQString& keyName) const { Exiv2::ExifKey keyResUnit("Exif.Image.ResolutionUnit"); Exiv2::ExifData::iterator it = d->mExifData.findKey(keyResUnit); if (it == d->mExifData.end()) { return 0; } int res = it->toLong(); - QString keyVal = "Exif.Image." + keyName; + TQString keyVal = "Exif.Image." + keyName; Exiv2::ExifKey keyResolution(keyVal.ascii()); it = d->mExifData.findKey(keyResolution); if (it == d->mExifData.end()) { @@ -368,17 +368,17 @@ void JPEGContent::resetOrientation() { } -QSize JPEGContent::size() const { +TQSize JPEGContent::size() const { return d->mSize; } -QString JPEGContent::comment() const { +TQString JPEGContent::comment() const { return d->mComment; } -QString JPEGContent::getExifInformation(const QString exifkey) const { - QString ret; +TQString JPEGContent::getExifInformation(const TQString exifkey) const { + TQString ret; Exiv2::ExifKey key(exifkey.latin1()); Exiv2::ExifData::iterator it = d->mExifData.findKey(key); @@ -386,7 +386,7 @@ QString JPEGContent::getExifInformation(const QString exifkey) const { if (it != d->mExifData.end()) { std::ostringstream outputString; outputString << *it; - ret=QString(outputString.str().c_str()); + ret=TQString(outputString.str().c_str()); } else { ret="n/a"; @@ -394,39 +394,39 @@ QString JPEGContent::getExifInformation(const QString exifkey) const { return ret; } -QString JPEGContent::aperture() const { +TQString JPEGContent::aperture() const { d->mAperture=getExifInformation("Exif.Photo.FNumber"); return d->mAperture; } -QString JPEGContent::exposureTime() const { +TQString JPEGContent::exposureTime() const { d->mExposureTime=getExifInformation("Exif.Photo.ExposureTime"); return d->mExposureTime; } -QString JPEGContent::iso() const { +TQString JPEGContent::iso() const { d->mIso=getExifInformation("Exif.Photo.ISOSpeedRatings"); return d->mIso; } -QString JPEGContent::focalLength() const { +TQString JPEGContent::focalLength() const { d->mFocalLength=getExifInformation("Exif.Photo.FocalLength"); return d->mFocalLength; } -void JPEGContent::setComment(const QString& comment) { +void JPEGContent::setComment(const TQString& comment) { d->mComment = comment; } -static QWMatrix createRotMatrix(int angle) { - QWMatrix matrix; +static TQWMatrix createRotMatrix(int angle) { + TQWMatrix matrix; matrix.rotate(angle); return matrix; } -static QWMatrix createScaleMatrix(int dx, int dy) { - QWMatrix matrix; +static TQWMatrix createScaleMatrix(int dx, int dy) { + TQWMatrix matrix; matrix.scale(dx, dy); return matrix; } @@ -435,25 +435,25 @@ static QWMatrix createScaleMatrix(int dx, int dy) { struct OrientationInfo { OrientationInfo() {} - OrientationInfo(Orientation o, QWMatrix m, JXFORM_CODE j) + OrientationInfo(Orientation o, TQWMatrix m, JXFORM_CODE j) : orientation(o), matrix(m), jxform(j) {} Orientation orientation; - QWMatrix matrix; + TQWMatrix matrix; JXFORM_CODE jxform; }; -typedef QValueList<OrientationInfo> OrientationInfoList; +typedef TQValueList<OrientationInfo> OrientationInfoList; static const OrientationInfoList& orientationInfoList() { static OrientationInfoList list; if (list.size() == 0) { - QWMatrix rot90 = createRotMatrix(90); - QWMatrix hflip = createScaleMatrix(-1, 1); - QWMatrix vflip = createScaleMatrix(1, -1); + TQWMatrix rot90 = createRotMatrix(90); + TQWMatrix hflip = createScaleMatrix(-1, 1); + TQWMatrix vflip = createScaleMatrix(1, -1); list - << OrientationInfo(NOT_AVAILABLE, QWMatrix(), JXFORM_NONE) - << OrientationInfo(NORMAL, QWMatrix(), JXFORM_NONE) + << OrientationInfo(NOT_AVAILABLE, TQWMatrix(), JXFORM_NONE) + << OrientationInfo(NORMAL, TQWMatrix(), JXFORM_NONE) << OrientationInfo(HFLIP, hflip, JXFORM_FLIP_H) << OrientationInfo(ROT_180, createRotMatrix(180), JXFORM_ROT_180) << OrientationInfo(VFLIP, vflip, JXFORM_FLIP_V) @@ -485,7 +485,7 @@ void JPEGContent::transform(Orientation orientation) { #if 0 -static void dumpMatrix(const QWMatrix& matrix) { +static void dumpMatrix(const TQWMatrix& matrix) { kdDebug() << "matrix | " << matrix.m11() << ", " << matrix.m12() << " |\n"; kdDebug() << " | " << matrix.m21() << ", " << matrix.m22() << " |\n"; kdDebug() << " ( " << matrix.dx() << ", " << matrix.dy() << " )\n"; @@ -493,7 +493,7 @@ static void dumpMatrix(const QWMatrix& matrix) { #endif -static bool matricesAreSame(const QWMatrix& m1, const QWMatrix& m2, double tolerance) { +static bool matricesAreSame(const TQWMatrix& m1, const TQWMatrix& m2, double tolerance) { return fabs( m1.m11() - m2.m11() ) < tolerance && fabs( m1.m12() - m2.m12() ) < tolerance && fabs( m1.m21() - m2.m21() ) < tolerance @@ -503,7 +503,7 @@ static bool matricesAreSame(const QWMatrix& m1, const QWMatrix& m2, double toler } -static JXFORM_CODE findJxform(const QWMatrix& matrix) { +static JXFORM_CODE findJxform(const TQWMatrix& matrix) { OrientationInfoList::ConstIterator it(orientationInfoList().begin()), end(orientationInfoList().end()); for (; it!=end; ++it) { if ( matricesAreSame( (*it).matrix, matrix, 0.001) ) { @@ -576,7 +576,7 @@ void JPEGContent::applyPendingTransformation() { &transformoption); /* Specify data destination for compression */ - QByteArray output; + TQByteArray output; output.resize(d->mRawData.size()); d->setupInmemDestination(&dstinfo, &output); @@ -602,8 +602,8 @@ void JPEGContent::applyPendingTransformation() { } -QImage JPEGContent::thumbnail() const { - QImage image; +TQImage JPEGContent::thumbnail() const { + TQImage image; if (!d->mExifData.empty()) { #if (EXIV2_TEST_VERSION(0,17,91)) Exiv2::ExifThumbC thumb(d->mExifData); @@ -617,15 +617,15 @@ QImage JPEGContent::thumbnail() const { } -void JPEGContent::setThumbnail(const QImage& thumbnail) { +void JPEGContent::setThumbnail(const TQImage& thumbnail) { if (d->mExifData.empty()) { return; } - QByteArray array; - QBuffer buffer(array); + TQByteArray array; + TQBuffer buffer(array); buffer.open(IO_WriteOnly); - QImageIO iio(&buffer, "JPEG"); + TQImageIO iio(&buffer, "JPEG"); iio.setImage(thumbnail); if (!iio.write()) { kdError() << "Could not write thumbnail\n"; @@ -641,8 +641,8 @@ void JPEGContent::setThumbnail(const QImage& thumbnail) { } -bool JPEGContent::save(const QString& path) { - QFile file(path); +bool JPEGContent::save(const TQString& path) { + TQFile file(path); if (!file.open(IO_WriteOnly)) { kdError() << "Could not open '" << path << "' for writing\n"; return false; @@ -652,7 +652,7 @@ bool JPEGContent::save(const QString& path) { } -bool JPEGContent::save(QFile* file) { +bool JPEGContent::save(TQFile* file) { if (d->mRawData.size()==0) { kdError() << "No data to store in '" << file->name() << "'\n"; return false; @@ -675,7 +675,7 @@ bool JPEGContent::save(QFile* file) { d->mRawData.resize(io.size()); io.read((unsigned char*)d->mRawData.data(), io.size()); - QDataStream stream(file); + TQDataStream stream(file); stream.writeRawBytes(d->mRawData.data(), d->mRawData.size()); // Make sure we are up to date diff --git a/src/imageutils/jpegcontent.h b/src/imageutils/jpegcontent.h index 7aa03fc..dddc28d 100644 --- a/src/imageutils/jpegcontent.h +++ b/src/imageutils/jpegcontent.h @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -21,17 +21,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef JPEGCONTENT_H #define JPEGCONTENT_H -// Qt -#include <qcstring.h> +// TQt +#include <tqcstring.h> // Local #include <imageutils/orientation.h> #include "../gvcore/libgwenview_export.h" -class QImage; -class QString; -class QFile; +class TQImage; +class TQString; +class TQFile; namespace ImageUtils { @@ -47,27 +47,27 @@ public: int dotsPerMeterX() const; int dotsPerMeterY() const; - QSize size() const; + TQSize size() const; - QString comment() const; - void setComment(const QString&); + TQString comment() const; + void setComment(const TQString&); - QString aperture() const; - QString exposureTime() const; - QString iso() const; - QString focalLength() const; + TQString aperture() const; + TQString exposureTime() const; + TQString iso() const; + TQString focalLength() const; - QString getExifInformation(const QString exifkey) const; + TQString getExifInformation(const TQString exifkey) const; void transform(Orientation); - QImage thumbnail() const; - void setThumbnail(const QImage&); + TQImage thumbnail() const; + void setThumbnail(const TQImage&); - bool load(const QString& file); - bool loadFromData(const QByteArray& rawData); - bool save(const QString& file); - bool save(QFile*); + bool load(const TQString& file); + bool loadFromData(const TQByteArray& rawData); + bool save(const TQString& file); + bool save(TQFile*); private: struct Private; @@ -76,7 +76,7 @@ private: JPEGContent(const JPEGContent&); void operator=(const JPEGContent&); void applyPendingTransformation(); - int dotsPerMeter(const QString& keyName) const; + int dotsPerMeter(const TQString& keyName) const; }; diff --git a/src/imageutils/jpegint.h b/src/imageutils/jpegint.h index 95b00d4..9d00c59 100644 --- a/src/imageutils/jpegint.h +++ b/src/imageutils/jpegint.h @@ -43,9 +43,9 @@ typedef enum { /* Operating modes for buffer controllers */ /* Master control module */ struct jpeg_comp_master { - JMETHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); - JMETHOD(void, pass_startup, (j_compress_ptr cinfo)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, prepare_for_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, pass_startup, (j_compress_ptr cinfo)); + JTQT_METHOD(void, finish_pass, (j_compress_ptr cinfo)); /* State variables made visible to other modules */ boolean call_pass_startup; /* True if pass_startup must be called */ @@ -54,16 +54,16 @@ struct jpeg_comp_master { /* Main buffer control (downsampled-data buffer) */ struct jpeg_c_main_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_compress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JTQT_METHOD(void, process_data, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail)); }; /* Compression preprocessing (downsampling input buffer control) */ struct jpeg_c_prep_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, pre_process_data, (j_compress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JTQT_METHOD(void, pre_process_data, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail, @@ -74,23 +74,23 @@ struct jpeg_c_prep_controller { /* Coefficient buffer control */ struct jpeg_c_coef_controller { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(boolean, compress_data, (j_compress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo, J_BUF_MODE pass_mode)); + JTQT_METHOD(boolean, compress_data, (j_compress_ptr cinfo, JSAMPIMAGE input_buf)); }; /* Colorspace conversion */ struct jpeg_color_converter { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, color_convert, (j_compress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, color_convert, (j_compress_ptr cinfo, JSAMPARRAY input_buf, JSAMPIMAGE output_buf, JDIMENSION output_row, int num_rows)); }; /* Downsampling */ struct jpeg_downsampler { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); - JMETHOD(void, downsample, (j_compress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, downsample, (j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)); @@ -100,9 +100,9 @@ struct jpeg_downsampler { /* Forward DCT (also controls coefficient quantization) */ struct jpeg_forward_dct { - JMETHOD(void, start_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo)); /* perhaps this should be an array??? */ - JMETHOD(void, forward_DCT, (j_compress_ptr cinfo, + JTQT_METHOD(void, forward_DCT, (j_compress_ptr cinfo, jpeg_component_info * compptr, JSAMPARRAY sample_data, JBLOCKROW coef_blocks, JDIMENSION start_row, JDIMENSION start_col, @@ -111,23 +111,23 @@ struct jpeg_forward_dct { /* Entropy encoding */ struct jpeg_entropy_encoder { - JMETHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); - JMETHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); - JMETHOD(void, finish_pass, (j_compress_ptr cinfo)); + JTQT_METHOD(void, start_pass, (j_compress_ptr cinfo, boolean gather_statistics)); + JTQT_METHOD(boolean, encode_mcu, (j_compress_ptr cinfo, JBLOCKROW *MCU_data)); + JTQT_METHOD(void, finish_pass, (j_compress_ptr cinfo)); }; /* Marker writing */ struct jpeg_marker_writer { - JMETHOD(void, write_file_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_frame_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_scan_header, (j_compress_ptr cinfo)); - JMETHOD(void, write_file_trailer, (j_compress_ptr cinfo)); - JMETHOD(void, write_tables_only, (j_compress_ptr cinfo)); + JTQT_METHOD(void, write_file_header, (j_compress_ptr cinfo)); + JTQT_METHOD(void, write_frame_header, (j_compress_ptr cinfo)); + JTQT_METHOD(void, write_scan_header, (j_compress_ptr cinfo)); + JTQT_METHOD(void, write_file_trailer, (j_compress_ptr cinfo)); + JTQT_METHOD(void, write_tables_only, (j_compress_ptr cinfo)); /* These routines are exported to allow insertion of extra markers */ /* Probably only COM and APPn markers should be written this way */ - JMETHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, + JTQT_METHOD(void, write_marker_header, (j_compress_ptr cinfo, int marker, unsigned int datalen)); - JMETHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); + JTQT_METHOD(void, write_marker_byte, (j_compress_ptr cinfo, int val)); }; @@ -135,8 +135,8 @@ struct jpeg_marker_writer { /* Master control module */ struct jpeg_decomp_master { - JMETHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, prepare_for_output_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, finish_output_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ boolean is_dummy_pass; /* True during 1st pass for 2-pass quant */ @@ -144,10 +144,10 @@ struct jpeg_decomp_master { /* Input control module */ struct jpeg_input_controller { - JMETHOD(int, consume_input, (j_decompress_ptr cinfo)); - JMETHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(int, consume_input, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, reset_input_controller, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, start_input_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, finish_input_pass, (j_decompress_ptr cinfo)); /* State variables made visible to other modules */ boolean has_multiple_scans; /* True if file has multiple scans */ @@ -156,18 +156,18 @@ struct jpeg_input_controller { /* Main buffer control (downsampled-data buffer) */ struct jpeg_d_main_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, process_data, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); + JTQT_METHOD(void, process_data, (j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)); }; /* Coefficient buffer control */ struct jpeg_d_coef_controller { - JMETHOD(void, start_input_pass, (j_decompress_ptr cinfo)); - JMETHOD(int, consume_data, (j_decompress_ptr cinfo)); - JMETHOD(void, start_output_pass, (j_decompress_ptr cinfo)); - JMETHOD(int, decompress_data, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_input_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(int, consume_data, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, start_output_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(int, decompress_data, (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)); /* Pointer to array of coefficient virtual arrays, or NULL if none */ jvirt_barray_ptr *coef_arrays; @@ -175,8 +175,8 @@ struct jpeg_d_coef_controller { /* Decompression postprocessing (color quantization buffer control) */ struct jpeg_d_post_controller { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); - JMETHOD(void, post_process_data, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)); + JTQT_METHOD(void, post_process_data, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -187,12 +187,12 @@ struct jpeg_d_post_controller { /* Marker reading & parsing */ struct jpeg_marker_reader { - JMETHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, reset_marker_reader, (j_decompress_ptr cinfo)); /* Read markers until SOS or EOI. * Returns same codes as are defined for jpeg_consume_input: * JPEG_SUSPENDED, JPEG_REACHED_SOS, or JPEG_REACHED_EOI. */ - JMETHOD(int, read_markers, (j_decompress_ptr cinfo)); + JTQT_METHOD(int, read_markers, (j_decompress_ptr cinfo)); /* Read a restart marker --- exported for use by entropy decoder only */ jpeg_marker_parser_method read_restart_marker; @@ -207,8 +207,8 @@ struct jpeg_marker_reader { /* Entropy decoding */ struct jpeg_entropy_decoder { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(boolean, decode_mcu, (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)); /* This is here to share code between baseline and progressive decoders; */ @@ -217,21 +217,21 @@ struct jpeg_entropy_decoder { }; /* Inverse DCT (also performs dequantization) */ -typedef JMETHOD(void, inverse_DCT_method_ptr, +typedef JTQT_METHOD(void, inverse_DCT_method_ptr, (j_decompress_ptr cinfo, jpeg_component_info * compptr, JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col)); struct jpeg_inverse_dct { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo)); /* It is useful to allow each component to have a separate IDCT method. */ inverse_DCT_method_ptr inverse_DCT[MAX_COMPONENTS]; }; /* Upsampling (note that upsampler must also call color converter) */ struct jpeg_upsampler { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, upsample, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, upsample, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION *in_row_group_ctr, JDIMENSION in_row_groups_avail, @@ -244,20 +244,20 @@ struct jpeg_upsampler { /* Colorspace conversion */ struct jpeg_color_deconverter { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, color_convert, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, color_convert, (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)); }; /* Color quantization or color precision reduction */ struct jpeg_color_quantizer { - JMETHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); - JMETHOD(void, color_quantize, (j_decompress_ptr cinfo, + JTQT_METHOD(void, start_pass, (j_decompress_ptr cinfo, boolean is_pre_scan)); + JTQT_METHOD(void, color_quantize, (j_decompress_ptr cinfo, JSAMPARRAY input_buf, JSAMPARRAY output_buf, int num_rows)); - JMETHOD(void, finish_pass, (j_decompress_ptr cinfo)); - JMETHOD(void, new_color_map, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, finish_pass, (j_decompress_ptr cinfo)); + JTQT_METHOD(void, new_color_map, (j_decompress_ptr cinfo)); }; diff --git a/src/imageutils/orientation.h b/src/imageutils/orientation.h index cd4b535..d223e3b 100644 --- a/src/imageutils/orientation.h +++ b/src/imageutils/orientation.h @@ -1,7 +1,7 @@ // vim: set tabstop=4 shiftwidth=4 noexpandtab /* Gwenview - A simple image viewer for KDE -Copyright 2000-2004 Aurélien Gâteau +Copyright 2000-2004 Aur�lien G�teau This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/src/imageutils/scale.cpp b/src/imageutils/scale.cpp index 99ed186..0d78886 100644 --- a/src/imageutils/scale.cpp +++ b/src/imageutils/scale.cpp @@ -6,7 +6,7 @@ // ImageMagick code begin // ---------------------- -// This code is ImageMagick's resize code, adapted for QImage, with +// This code is ImageMagick's resize code, adapted for TQImage, with // fastfloat class added as an optimization. // The original license text follows. @@ -69,9 +69,9 @@ #endif #endif -// Qt -#include <qimage.h> -#include <qcolor.h> +// TQt +#include <tqimage.h> +#include <tqcolor.h> #include <kdeversion.h> #include <kcpuinfo.h> @@ -86,8 +86,8 @@ namespace ImageUtils { -#define Max QMAX -#define Min QMIN +#define Max TQMAX +#define Min TQMIN // mustn't be less than used precision (i.e. 1/fastfloat::RATIO) #define MagickEpsilon 0.0002 @@ -423,7 +423,7 @@ static fastfloat Triangle(const fastfloat x,const fastfloat) return(0.0); } -static void HorizontalFilter(const QImage& source,QImage& destination, +static void HorizontalFilter(const TQImage& source,TQImage& destination, const fastfloat x_factor,const fastfloat blur, ContributionInfo *contribution, Filter filter, fastfloat filtersupport) { @@ -492,23 +492,23 @@ static void HorizontalFilter(const QImage& source,QImage& destination, { int px = contribution[i].pixel; int py = y; - QRgb p = reinterpret_cast< QRgb* >( source.jumpTable()[ py ])[ px ]; - red+=contribution[i].weight*qRed(p); - green+=contribution[i].weight*qGreen(p); - blue+=contribution[i].weight*qBlue(p); - alpha+=contribution[i].weight*qAlpha(p); + TQRgb p = reinterpret_cast< TQRgb* >( const_cast<TQImage&>(source).jumpTable()[ py ])[ px ]; + red+=contribution[i].weight*tqRed(p); + green+=contribution[i].weight*tqGreen(p); + blue+=contribution[i].weight*tqBlue(p); + alpha+=contribution[i].weight*tqAlpha(p); } - QRgb pix = qRgba( + TQRgb pix = tqRgba( fasttolong( red < 0 ? 0 : red > 255 ? 255 : red + 0.5 ), fasttolong( green < 0 ? 0 : green > 255 ? 255 : green + 0.5 ), fasttolong( blue < 0 ? 0 : blue > 255 ? 255 : blue + 0.5 ), fasttolong( alpha < 0 ? 0 : alpha > 255 ? 255 : alpha + 0.5 )); - reinterpret_cast< QRgb* >( destination.jumpTable()[ y ])[ x ] = pix; + reinterpret_cast< TQRgb* >( const_cast<TQImage&>(destination).jumpTable()[ y ])[ x ] = pix; } } } -static void VerticalFilter(const QImage& source,QImage& destination, +static void VerticalFilter(const TQImage& source,TQImage& destination, const fastfloat y_factor,const fastfloat blur, ContributionInfo *contribution, Filter filter, fastfloat filtersupport ) { @@ -577,23 +577,23 @@ static void VerticalFilter(const QImage& source,QImage& destination, { int px = x; int py = contribution[i].pixel; - QRgb p = reinterpret_cast< QRgb* >( source.jumpTable()[ py ])[ px ]; - red+=contribution[i].weight*qRed(p); - green+=contribution[i].weight*qGreen(p); - blue+=contribution[i].weight*qBlue(p); - alpha+=contribution[i].weight*qAlpha(p); + TQRgb p = reinterpret_cast< TQRgb* >( const_cast<TQImage&>(source).jumpTable()[ py ])[ px ]; + red+=contribution[i].weight*tqRed(p); + green+=contribution[i].weight*tqGreen(p); + blue+=contribution[i].weight*tqBlue(p); + alpha+=contribution[i].weight*tqAlpha(p); } - QRgb pix = qRgba( + TQRgb pix = tqRgba( fasttolong( red < 0 ? 0 : red > 255 ? 255 : red + 0.5 ), fasttolong( green < 0 ? 0 : green > 255 ? 255 : green + 0.5 ), fasttolong( blue < 0 ? 0 : blue > 255 ? 255 : blue + 0.5 ), fasttolong( alpha < 0 ? 0 : alpha > 255 ? 255 : alpha + 0.5 )); - reinterpret_cast< QRgb* >( destination.jumpTable()[ y ])[ x ] = pix; + reinterpret_cast< TQRgb* >( const_cast<TQImage&>(destination).jumpTable()[ y ])[ x ] = pix; } } } -static QImage ResizeImage(const QImage& image,const int columns, +static TQImage ResizeImage(const TQImage& image,const int columns, const int rows, Filter filter, fastfloat filtersupport, double blur) { ContributionInfo @@ -611,7 +611,7 @@ static QImage ResizeImage(const QImage& image,const int columns, */ if ((columns == image.width()) && (rows == image.height()) && (blur == 1.0)) return image.copy(); - QImage resize_image( columns, rows, 32 ); + TQImage resize_image( columns, rows, 32 ); resize_image.setAlphaBuffer( image.hasAlphaBuffer()); /* Allocate filter contribution info. @@ -638,20 +638,20 @@ static QImage ResizeImage(const QImage& image,const int columns, if (((fastfloat) columns*(image.height()+rows)) > ((fastfloat) rows*(image.width()+columns))) { - QImage source_image( columns, image.height(), 32 ); + TQImage source_image( columns, image.height(), 32 ); source_image.setAlphaBuffer( image.hasAlphaBuffer()); - HorizontalFilter(image,source_image,x_factor,blur, + HorizontalFilter(image,source_image,x_factor,blur, contribution,filter,filtersupport); - VerticalFilter(source_image,resize_image,y_factor, + VerticalFilter(source_image,resize_image,y_factor, blur,contribution,filter,filtersupport); } else { - QImage source_image( image.width(), rows, 32 ); + TQImage source_image( image.width(), rows, 32 ); source_image.setAlphaBuffer( image.hasAlphaBuffer()); - VerticalFilter(image,source_image,y_factor,blur, + VerticalFilter(image,source_image,y_factor,blur, contribution,filter,filtersupport); - HorizontalFilter(source_image,resize_image,x_factor, + HorizontalFilter(source_image,resize_image,x_factor, blur,contribution,filter,filtersupport); } /* @@ -724,7 +724,7 @@ static QImage ResizeImage(const QImage& image,const int columns, % % */ -QImage SampleImage(const QImage& image,const int columns, +TQImage SampleImage(const TQImage& image,const int columns, const int rows) { int @@ -756,7 +756,7 @@ QImage SampleImage(const QImage& image,const int columns, // 32bit like the ImageMagick original. This avoids the relatively // expensive conversion. const int d = image.depth() / 8; - QImage sample_image( columns, rows, image.depth()); + TQImage sample_image( columns, rows, image.depth()); sample_image.setAlphaBuffer( image.hasAlphaBuffer()); /* Allocate scan line buffer and column offset buffers. @@ -769,7 +769,7 @@ QImage SampleImage(const QImage& image,const int columns, */ // In the following several code 0.5 needs to be added, otherwise the image // would be moved by half a pixel to bottom-right, just like -// with Qt's QImage::scale() +// with TQt's TQImage::scale() for (x=0; x < (long) sample_image.width(); x++) { x_offset[x]=int((x+0.5)*image.width()/sample_image.width()); @@ -808,7 +808,7 @@ QImage SampleImage(const QImage& image,const int columns, case 4: // 32bit for (x=0; x < (long) sample_image.width(); x++) { - *(QRgb*)q=((QRgb*)pixels)[ x_offset[x] ]; + *(TQRgb*)q=((TQRgb*)pixels)[ x_offset[x] ]; q += d; } break; @@ -848,11 +848,11 @@ QImage SampleImage(const QImage& image,const int columns, /** * This is the normal smoothscale method, based on Imlib2's smoothscale. * - * Originally I took the algorithm used in NetPBM and Qt and added MMX/3dnow - * optimizations. It ran in about 1/2 the time as Qt. Then I ported Imlib's + * Originally I took the algorithm used in NetPBM and TQt and added MMX/3dnow + * optimizations. It ran in about 1/2 the time as TQt. Then I ported Imlib's * C algorithm and it ran at about the same speed as my MMX optimized one... * Finally I ported Imlib's MMX version and it ran in less than half the - * time as my MMX algorithm, (taking only a quarter of the time Qt does). + * time as my MMX algorithm, (taking only a quarter of the time TQt does). * * Changes include formatting, namespaces and other C++'ings, removal of old * #ifdef'ed code, and removal of unneeded border calculation code. @@ -933,7 +933,7 @@ namespace MImageScale{ int* mimageCalcXPoints(int sw, int dw); int* mimageCalcApoints(int s, int d, int up); MImageScaleInfo* mimageFreeScaleInfo(MImageScaleInfo *isi); - MImageScaleInfo *mimageCalcScaleInfo(QImage &img, int sw, int sh, + MImageScaleInfo *mimageCalcScaleInfo(TQImage &img, int sw, int sh, int dw, int dh, char aa, int sow); void mimageSampleRGBA(MImageScaleInfo *isi, unsigned int *dest, int dxx, int dyy, int dx, int dy, int dw, int dh, int dow); @@ -943,7 +943,7 @@ namespace MImageScale{ void mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, int dxx, int dyy, int dx, int dy, int dw, int dh, int dow, int sow); - QImage smoothScale(const QImage& img, int dw, int dh); + TQImage smoothScale(const TQImage& img, int dw, int dh); typedef long long llong; } @@ -958,14 +958,14 @@ extern "C" { using namespace MImageScale; -QImage MImageScale::smoothScale(const QImage& image, int dw, int dh) +TQImage MImageScale::smoothScale(const TQImage& image, int dw, int dh) { - QImage img = image.depth() < 32 ? image.convertDepth( 32 ) : image; + TQImage img = image.depth() < 32 ? image.convertDepth( 32 ) : image; int w = img.width(); int h = img.height(); int sow = img.bytesPerLine(); - // handle CroppedQImage + // handle CroppedTQImage if( img.height() > 1 && sow != img.scanLine( 1 ) - img.scanLine( 0 )) sow = img.scanLine( 1 ) - img.scanLine( 0 ); sow = sow / ( img.depth() / 8 ); @@ -973,9 +973,9 @@ QImage MImageScale::smoothScale(const QImage& image, int dw, int dh) MImageScaleInfo *scaleinfo = mimageCalcScaleInfo(img, w, h, dw, dh, true, sow); if(!scaleinfo) - return QImage(); + return TQImage(); - QImage buffer(dw, dh, 32); + TQImage buffer(dw, dh, 32); buffer.setAlphaBuffer(img.hasAlphaBuffer()); #ifdef HAVE_X86_MMX @@ -1143,7 +1143,7 @@ MImageScaleInfo* MImageScale::mimageFreeScaleInfo(MImageScaleInfo *isi) return(NULL); } -MImageScaleInfo* MImageScale::mimageCalcScaleInfo(QImage &img, int sw, int sh, +MImageScaleInfo* MImageScale::mimageCalcScaleInfo(TQImage &img, int sw, int sh, int dw, int dh, char aa, int sow) { MImageScaleInfo *isi; @@ -1254,7 +1254,7 @@ void MImageScale::mimageScaleAARGBA(MImageScaleInfo *isi, unsigned int *dest, g = ((gg * YAP) + (g * INV_YAP)) >> 16; b = ((bb * YAP) + (b * INV_YAP)) >> 16; a = ((aa * YAP) + (a * INV_YAP)) >> 16; - *dptr++ = qRgba(r, g, b, a); + *dptr++ = tqRgba(r, g, b, a); } else{ pix = ypoints[dyy + y] + xpoints[x]; @@ -1271,7 +1271,7 @@ void MImageScale::mimageScaleAARGBA(MImageScaleInfo *isi, unsigned int *dest, g >>= 8; b >>= 8; a >>= 8; - *dptr++ = qRgba(r, g, b, a); + *dptr++ = tqRgba(r, g, b, a); } } } @@ -1295,7 +1295,7 @@ void MImageScale::mimageScaleAARGBA(MImageScaleInfo *isi, unsigned int *dest, g >>= 8; b >>= 8; a >>= 8; - *dptr++ = qRgba(r, g, b, a); + *dptr++ = tqRgba(r, g, b, a); } else *dptr++ = sptr[xpoints[x] ]; @@ -1372,7 +1372,7 @@ void MImageScale::mimageScaleAARGBA(MImageScaleInfo *isi, unsigned int *dest, b >>= 4; a >>= 4; } - *dptr = qRgba(r, g, b, a); + *dptr = tqRgba(r, g, b, a); dptr++; } } @@ -1446,7 +1446,7 @@ void MImageScale::mimageScaleAARGBA(MImageScaleInfo *isi, unsigned int *dest, b >>= 4; a >>= 4; } - *dptr = qRgba(r, g, b, a); + *dptr = tqRgba(r, g, b, a); dptr++; } } @@ -1610,7 +1610,7 @@ void MImageScale::mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, r = ((rr * YAP) + (r * INV_YAP)) >> 16; g = ((gg * YAP) + (g * INV_YAP)) >> 16; b = ((bb * YAP) + (b * INV_YAP)) >> 16; - *dptr++ = qRgba(r, g, b, 0xff); + *dptr++ = tqRgba(r, g, b, 0xff); } else{ pix = ypoints[dyy + y] + xpoints[x]; @@ -1624,7 +1624,7 @@ void MImageScale::mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, r >>= 8; g >>= 8; b >>= 8; - *dptr++ = qRgba(r, g, b, 0xff); + *dptr++ = tqRgba(r, g, b, 0xff); } } } @@ -1645,7 +1645,7 @@ void MImageScale::mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, r >>= 8; g >>= 8; b >>= 8; - *dptr++ = qRgba(r, g, b, 0xff); + *dptr++ = tqRgba(r, g, b, 0xff); } else *dptr++ = sptr[xpoints[x] ]; @@ -1713,7 +1713,7 @@ void MImageScale::mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, g >>= 4; b >>= 4; } - *dptr = qRgba(r, g, b, 0xff); + *dptr = tqRgba(r, g, b, 0xff); dptr++; } } @@ -1778,7 +1778,7 @@ void MImageScale::mimageScaleAARGB(MImageScaleInfo *isi, unsigned int *dest, g >>= 4; b >>= 4; } - *dptr = qRgba(r, g, b, 0xff); + *dptr = tqRgba(r, g, b, 0xff); dptr++; } } @@ -1917,20 +1917,20 @@ int extraScalePixels( SmoothAlgorithm alg, double zoom, double blur ) // Imlib2/Mosfet scale - I have really no idea how many pixels it needs if( filter == Box && blur == 1.0 ) return int( 3 / zoom + 1 ); // This is support size for ImageMagick's scaling. - double scale=blur*QMAX(1.0/zoom,1.0); + double scale=blur*TQMAX(1.0/zoom,1.0); double support=scale* filtersupport; if (support <= 0.5) support=0.5+0.000001; return int( support + 1 ); } -QImage scale(const QImage& image, int width, int height, - SmoothAlgorithm alg, QImage::ScaleMode mode, double blur ) +TQImage scale(const TQImage& image, int width, int height, + SmoothAlgorithm alg, TQ_ScaleMode mode, double blur ) { if( image.isNull()) return image.copy(); - QSize newSize( image.size() ); - newSize.scale( QSize( width, height ), (QSize::ScaleMode)mode ); // ### remove cast in Qt 4.0 - newSize = newSize.expandedTo( QSize( 1, 1 )); // make sure it doesn't become null + TQSize newSize( image.size() ); + newSize.tqscale( TQSize( width, height ), (TQSize::ScaleMode)mode ); // ### remove cast in TQt 4.0 + newSize = newSize.expandedTo( TQSize( 1, 1 )); // make sure it doesn't become null if ( newSize == image.size() ) return image.copy(); @@ -1972,7 +1972,7 @@ QImage scale(const QImage& image, int width, int height, } return ResizeImage( image.convertDepth( 32 ), width, height, filter, filtersupport, blur ); - // unlike Qt's smoothScale() this function introduces new colors to grayscale images ... oh well + // unlike TQt's smoothScale() this function introduces new colors to grayscale images ... oh well } diff --git a/src/imageutils/testjpegcontent.cpp b/src/imageutils/testjpegcontent.cpp index fa9128d..c810506 100644 --- a/src/imageutils/testjpegcontent.cpp +++ b/src/imageutils/testjpegcontent.cpp @@ -20,11 +20,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <iostream> -// Qt -#include <qdir.h> -#include <qfile.h> -#include <qimage.h> -#include <qstring.h> +// TQt +#include <tqdir.h> +#include <tqfile.h> +#include <tqimage.h> +#include <tqstring.h> // KDE #include <kapplication.h> @@ -43,8 +43,8 @@ const char* ORIENT6_FILE="orient6.jpg"; const int ORIENT6_WIDTH=128; // This size is the size *after* orientation const int ORIENT6_HEIGHT=256; // has been applied const char* CUT_FILE="cut.jpg"; -const QString ORIENT6_COMMENT="a comment"; -const QString ORIENT1_VFLIP_FILE="test_orient1_vflip.jpg"; +const TQString ORIENT6_COMMENT="a comment"; +const TQString ORIENT1_VFLIP_FILE="test_orient1_vflip.jpg"; const char* THUMBNAIL_FILE="test_thumbnail.jpg"; const char* TMP_FILE="tmp.jpg"; @@ -53,18 +53,18 @@ class TestEnvironment { public: TestEnvironment() { bool result; - QFile in(ORIENT6_FILE); + TQFile in(ORIENT6_FILE); result=in.open(IO_ReadOnly); Q_ASSERT(result); - QFileInfo info(in); + TQFileInfo info(in); int size=info.size()/2; char* data=new char[size]; int readSize=in.readBlock(data, size); Q_ASSERT(size==readSize); - QFile out(CUT_FILE); + TQFile out(CUT_FILE); result=out.open(IO_WriteOnly); Q_ASSERT(result); @@ -74,17 +74,17 @@ public: } ~TestEnvironment() { - QDir::current().remove(CUT_FILE); + TQDir::current().remove(CUT_FILE); } }; -typedef QMap<QString,QString> MetaInfoMap; +typedef TQMap<TQString,TQString> MetaInfoMap; -MetaInfoMap getMetaInfo(const QString& path) { +MetaInfoMap getMetaInfo(const TQString& path) { KFileMetaInfo fmi(path); - QStringList list=fmi.supportedKeys(); - QStringList::ConstIterator it=list.begin(); + TQStringList list=fmi.supportedKeys(); + TQStringList::ConstIterator it=list.begin(); MetaInfoMap map; for ( ; it!=list.end(); ++it) { @@ -95,16 +95,16 @@ MetaInfoMap getMetaInfo(const QString& path) { return map; } -void compareMetaInfo(const QString& path1, const QString& path2, const QStringList& ignoredKeys) { +void compareMetaInfo(const TQString& path1, const TQString& path2, const TQStringList& ignoredKeys) { MetaInfoMap mim1=getMetaInfo(path1); MetaInfoMap mim2=getMetaInfo(path2); Q_ASSERT(mim1.keys()==mim2.keys()); - QValueList<QString> keys=mim1.keys(); - QValueList<QString>::ConstIterator it=keys.begin(); + TQValueList<TQString> keys=mim1.keys(); + TQValueList<TQString>::ConstIterator it=keys.begin(); for ( ; it!=keys.end(); ++it) { - QString key=*it; - if (ignoredKeys.contains(key)) continue; + TQString key=*it; + if (ignoredKeys.tqcontains(key)) continue; if (mim1[key]!=mim2[key]) { kdError() << "Meta info differs. Key:" << key << ", V1:" << mim1[key] << ", V2:" << mim2[key] << endl; @@ -154,7 +154,7 @@ void testResetOrientation() { */ void testTransform() { bool result; - QImage finalImage, expectedImage; + TQImage finalImage, expectedImage; ImageUtils::JPEGContent content; result = content.load(ORIENT6_FILE); @@ -181,7 +181,7 @@ void testTransform() { void testSetComment() { - QString comment = "test comment"; + TQString comment = "test comment"; ImageUtils::JPEGContent content; bool result; result = content.load(ORIENT6_FILE); @@ -211,10 +211,10 @@ int main(int argc, char* argv[]) { Q_ASSERT(result); Q_ASSERT(content.orientation() == 6); Q_ASSERT(content.comment() == ORIENT6_COMMENT); - Q_ASSERT(content.size() == QSize(ORIENT6_WIDTH, ORIENT6_HEIGHT)); + Q_ASSERT(content.size() == TQSize(ORIENT6_WIDTH, ORIENT6_HEIGHT)); // thumbnail() - QImage thumbnail=content.thumbnail(); + TQImage thumbnail=content.thumbnail(); result=thumbnail.save(THUMBNAIL_FILE, "JPEG"); Q_ASSERT(result); @@ -236,12 +236,12 @@ int main(int argc, char* argv[]) { result = content.load(TMP_FILE); Q_ASSERT(result); - Q_ASSERT(content.size() == QSize(ORIENT6_HEIGHT, ORIENT6_WIDTH)); + Q_ASSERT(content.size() == TQSize(ORIENT6_HEIGHT, ORIENT6_WIDTH)); // Check the other meta info are still here - QStringList ignoredKeys; - ignoredKeys << "Orientation" << "Comment"; + TQStringList ignoredKeys; + ignoredKeys << "Qt::Orientation" << "Comment"; compareMetaInfo(ORIENT6_FILE, ORIENT1_VFLIP_FILE, ignoredKeys); // Test that loading and manipulating a truncated file does not crash diff --git a/src/imageutils/transupp.c b/src/imageutils/transupp.c index e5ec564..3bc6f20 100644 --- a/src/imageutils/transupp.c +++ b/src/imageutils/transupp.c @@ -30,7 +30,7 @@ * or recompression of the image. * Thanks to Guido Vollbeding for the initial design and code of this feature. * - * Horizontal flipping is done in-place, using a single top-to-bottom + *Qt::Horizontal flipping is done in-place, using a single top-to-bottom * pass through the virtual source array. It will thus be much the * fastest option for images larger than main memory. * @@ -65,7 +65,7 @@ LOCAL(void) do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays) -/* Horizontal flip; done in-place, so no separate dest array is required */ +/*Qt::Horizontal flip; done in-place, so no separate dest array is required */ { JDIMENSION MCU_cols, comp_width, blk_x, blk_y; int ci, k, offset_y; @@ -74,7 +74,7 @@ do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, JCOEF temp1, temp2; jpeg_component_info *compptr; - /* Horizontal mirroring of DCT blocks is accomplished by swapping + /*Qt::Horizontal mirroring of DCT blocks is accomplished by swapping * pairs of blocks in-place. Within a DCT block, we perform horizontal * mirroring by changing the signs of odd-numbered columns. * Partial iMCUs at the right edge are left untouched. @@ -115,7 +115,7 @@ LOCAL(void) do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) -/* Vertical flip */ +/*Qt::Vertical flip */ { JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y; int ci, i, j, offset_y; @@ -232,7 +232,7 @@ do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *dst_coef_arrays) /* 90 degree rotation is equivalent to * 1. Transposing the image; - * 2. Horizontal mirroring. + * 2.Qt::Horizontal mirroring. * These two steps are merged into a single processing routine. */ { @@ -295,7 +295,7 @@ do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* 270 degree rotation is equivalent to - * 1. Horizontal mirroring; + * 1.Qt::Horizontal mirroring; * 2. Transposing the image. * These two steps are merged into a single processing routine. */ @@ -359,8 +359,8 @@ do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, jvirt_barray_ptr *src_coef_arrays, jvirt_barray_ptr *dst_coef_arrays) /* 180 degree rotation is equivalent to - * 1. Vertical mirroring; - * 2. Horizontal mirroring. + * 1.Qt::Vertical mirroring; + * 2.Qt::Horizontal mirroring. * These two steps are merged into a single processing routine. */ { @@ -463,9 +463,9 @@ do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo, * 1. 180 degree rotation; * 2. Transposition; * or - * 1. Horizontal mirroring; + * 1.Qt::Horizontal mirroring; * 2. Transposition; - * 3. Horizontal mirroring. + * 3.Qt::Horizontal mirroring. * These steps are merged into a single processing routine. */ { |