summaryrefslogtreecommitdiffstats
path: root/src/imageutils/jpegcontent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/imageutils/jpegcontent.cpp')
-rw-r--r--src/imageutils/jpegcontent.cpp128
1 files changed, 64 insertions, 64 deletions
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