summaryrefslogtreecommitdiffstats
path: root/src/gvcore/pngformattype.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gvcore/pngformattype.cpp')
-rw-r--r--src/gvcore/pngformattype.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/gvcore/pngformattype.cpp b/src/gvcore/pngformattype.cpp
index 36c1064..d89032a 100644
--- a/src/gvcore/pngformattype.cpp
+++ b/src/gvcore/pngformattype.cpp
@@ -1,36 +1,36 @@
-// this code is copied from Qt, with code added to actually call consumer
+// this code is copied from TQt, with code added to actually call consumer
// methods that inform about the progress of loading
/****************************************************************************
**
**
-** Implementation of PNG QImage IOHandler
+** Implementation of PNG TQImage IOHandler
**
** Created : 970521
**
** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
-** This file is part of the kernel module of the Qt GUI Toolkit.
+** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
-** LICENSE.QPL included in the packaging of this file.
+** LICENSE.TQPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
-** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
-** licenses may use this file in accordance with the Qt Commercial License
+** Licensees holding valid TQt Enterprise Edition or TQt Professional Edition
+** licenses may use this file in accordance with the TQt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
-** information about Qt Commercial License Agreements.
-** See http://www.trolltech.com/qpl/ for QPL licensing information.
+** information about TQt Commercial License Agreements.
+** See http://www.trolltech.com/qpl/ for TQPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
@@ -44,12 +44,12 @@
namespace Gwenview {
-class PNGFormat : public QImageFormat {
+class PNGFormat : public TQImageFormat {
public:
PNGFormat();
virtual ~PNGFormat();
- int decode(QImage& img, QImageConsumer* consumer,
+ int decode(TQImage& img, TQImageConsumer* consumer,
const uchar* buffer, int length);
void info(png_structp png_ptr, png_infop info);
@@ -73,21 +73,21 @@ private:
png_infop info_ptr;
// Temporary locals during single data-chunk processing
- QImageConsumer* consumer;
- QImage* image;
+ TQImageConsumer* consumer;
+ TQImage* image;
int unused_data;
- QRect changed_rect;
+ TQRect changed_rect;
};
/*
- \class QPNGFormat qpngio.h
- \brief The QPNGFormat class provides an incremental image decoder for PNG
+ \class TQPNGFormat qpngio.h
+ \brief The TQPNGFormat class provides an incremental image decoder for PNG
image format.
\ingroup images
\ingroup graphics
- This subclass of QImageFormat decodes PNG format images,
+ This subclass of TQImageFormat decodes PNG format images,
including animated PNGs.
Animated PNG images are standard PNG images. The PNG standard
@@ -113,21 +113,21 @@ private:
*/
/*
- \class QPNGFormatType qasyncimageio.h
- \brief The QPNGFormatType class provides an incremental image decoder
+ \class TQPNGFormatType qasyncimageio.h
+ \brief The TQPNGFormatType class provides an incremental image decoder
for PNG image format.
\ingroup images
\ingroup graphics
\ingroup io
- This subclass of QImageFormatType recognizes PNG format images, creating
- a QPNGFormat when required. An instance of this class is created
+ This subclass of TQImageFormatType recognizes PNG format images, creating
+ a TQPNGFormat when required. An instance of this class is created
automatically before any other factories, so you should have no need for
such objects.
*/
-QImageFormat* PNGFormatType::decoderFor(
+TQImageFormat* PNGFormatType::decoderFor(
const uchar* buffer, int length)
{
if (length < 8) return 0;
@@ -192,7 +192,7 @@ static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
}
static
-void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
+void setup_qt( TQImage& image, png_structp png_ptr, png_infop info_ptr )
{
// For now, we will use the PC monitor gamma, if you own a Mac, you'd better use 1.8
const double SCREEN_GAMMA=2.2;
@@ -214,10 +214,10 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
if ( bit_depth == 1 && info_ptr->channels == 1 ) {
png_set_invert_mono( png_ptr );
png_read_update_info( png_ptr, info_ptr );
- if (!image.create( width, height, 1, 2, QImage::BigEndian ))
+ if (!image.create( width, height, 1, 2, TQImage::BigEndian ))
return;
- image.setColor( 1, qRgb(0,0,0) );
- image.setColor( 0, qRgb(255,255,255) );
+ image.setColor( 1, tqRgb(0,0,0) );
+ image.setColor( 0, tqRgb(255,255,255) );
} else if (bit_depth == 16 && png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_set_expand(png_ptr);
png_set_strip_16(png_ptr);
@@ -227,7 +227,7 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
return;
image.setAlphaBuffer(TRUE);
- if (QImage::systemByteOrder() == QImage::BigEndian)
+ if (TQImage::systemByteOrder() == TQImage::BigEndian)
png_set_swap_alpha(png_ptr);
png_read_update_info(png_ptr, info_ptr);
@@ -242,13 +242,13 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
return;
for (int i=0; i<ncols; i++) {
int c = i*255/(ncols-1);
- image.setColor( i, qRgba(c,c,c,0xff) );
+ image.setColor( i, tqRgba(c,c,c,0xff) );
}
if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ) {
const int g = info_ptr->trans_values.gray;
if (g < ncols) {
image.setAlphaBuffer(TRUE);
- image.setColor(g, image.color(g) & RGB_MASK);
+ image.setColor(g, image.color(g) & TQRGB_MASK);
}
}
}
@@ -263,13 +263,13 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
png_get_IHDR(png_ptr, info_ptr,
&width, &height, &bit_depth, &color_type, 0, 0, 0);
if (!image.create(width, height, bit_depth, info_ptr->num_palette,
- QImage::BigEndian))
+ TQImage::BigEndian))
return;
int i = 0;
if ( png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) ) {
image.setAlphaBuffer( TRUE );
while ( i < info_ptr->num_trans ) {
- image.setColor(i, qRgba(
+ image.setColor(i, tqRgba(
info_ptr->palette[i].red,
info_ptr->palette[i].green,
info_ptr->palette[i].blue,
@@ -280,7 +280,7 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
}
}
while ( i < info_ptr->num_palette ) {
- image.setColor(i, qRgba(
+ image.setColor(i, tqRgba(
info_ptr->palette[i].red,
info_ptr->palette[i].green,
info_ptr->palette[i].blue,
@@ -306,22 +306,22 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
if (!(color_type & PNG_COLOR_MASK_ALPHA)
&& !png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
png_set_filler(png_ptr, 0xff,
- QImage::systemByteOrder() == QImage::BigEndian ?
+ TQImage::systemByteOrder() == TQImage::BigEndian ?
PNG_FILLER_BEFORE : PNG_FILLER_AFTER);
// We want 4 bytes, but it isn't an alpha channel
} else {
image.setAlphaBuffer(TRUE);
}
- if ( QImage::systemByteOrder() == QImage::BigEndian ) {
+ if ( TQImage::systemByteOrder() == TQImage::BigEndian ) {
png_set_swap_alpha(png_ptr);
}
png_read_update_info(png_ptr, info_ptr);
}
- // Qt==ARGB==Big(ARGB)==Little(BGRA)
- if ( QImage::systemByteOrder() == QImage::LittleEndian ) {
+ // TQt==ARGB==Big(ARGB)==Little(BGRA)
+ if ( TQImage::systemByteOrder() == TQImage::LittleEndian ) {
png_set_bgr(png_ptr);
}
}
@@ -329,7 +329,7 @@ void setup_qt( QImage& image, png_structp png_ptr, png_infop info_ptr )
/*!
- Constructs a QPNGFormat object.
+ Constructs a TQPNGFormat object.
*/
PNGFormat::PNGFormat()
{
@@ -343,7 +343,7 @@ PNGFormat::PNGFormat()
/*!
- Destroys a QPNGFormat object.
+ Destroys a TQPNGFormat object.
*/
PNGFormat::~PNGFormat()
{
@@ -357,7 +357,7 @@ PNGFormat::~PNGFormat()
Returns the number of bytes consumed.
*/
-int PNGFormat::decode(QImage& img, QImageConsumer* cons,
+int PNGFormat::decode(TQImage& img, TQImageConsumer* cons,
const uchar* buffer, int length)
{
consumer = cons;
@@ -404,7 +404,7 @@ int PNGFormat::decode(QImage& img, QImageConsumer* cons,
}
state = Inside;
- changed_rect = QRect();
+ changed_rect = TQRect();
}
if ( !png_ptr ) return 0;
@@ -421,7 +421,7 @@ int PNGFormat::decode(QImage& img, QImageConsumer* cons,
if( !changed_rect.isNull()) {
consumer->changed( changed_rect );
- changed_rect = QRect();
+ changed_rect = TQRect();
}
if ( state != Inside ) {
@@ -445,7 +445,7 @@ void PNGFormat::row(png_structp png, png_bytep new_row,
{
uchar* old_row = image->scanLine(row_num);
png_progressive_combine_row(png, old_row, new_row);
- changed_rect |= QRect( 0, row_num, image->width(), 1 );
+ changed_rect |= TQRect( 0, row_num, image->width(), 1 );
}
@@ -458,7 +458,7 @@ void PNGFormat::end(png_structp png, png_infop info)
base_offy = offy;
first_frame = 0;
}
- image->setOffset(QPoint(offx,offy));
+ image->setOffset(TQPoint(offx,offy));
image->setDotsPerMeterX(png_get_x_pixels_per_meter(png,info));
image->setDotsPerMeterY(png_get_y_pixels_per_meter(png,info));
png_textp text_ptr;
@@ -470,10 +470,10 @@ void PNGFormat::end(png_structp png, png_infop info)
}
if( !changed_rect.isNull()) {
consumer->changed( changed_rect );
- changed_rect = QRect();
+ changed_rect = TQRect();
}
- QRect r(0,0,image->width(),image->height());
- consumer->frameDone(QPoint(offx,offy),r);
+ TQRect r(0,0,image->width(),image->height());
+ consumer->frameDone(TQPoint(offx,offy),r);
consumer->end();
state = FrameStart;
unused_data = (int)png->buffer_size; // Since libpng doesn't tell us
@@ -482,7 +482,7 @@ void PNGFormat::end(png_structp png, png_infop info)
#ifdef PNG_USER_CHUNKS_SUPPORTED
/*
-#ifndef QT_NO_IMAGE_TEXT
+#ifndef TQT_NO_IMAGE_TEXT
static bool skip(png_uint_32& max, png_bytep& data)
{
while (*data) {
@@ -506,15 +506,15 @@ int PNGFormat::user_chunk(png_structp png,
if ( 0==qstrcmp((char*)png->chunk_name, "gIFg")
&& length == 4 ) {
- //QPNGImageWriter::DisposalMethod disposal =
- // (QPNGImageWriter::DisposalMethod)data[0];
+ //TQPNGImageWriter::DisposalMethod disposal =
+ // (TQPNGImageWriter::DisposalMethod)data[0];
// ### TODO: use the disposal method
int ms_delay = ((data[2] << 8) | data[3])*10;
consumer->setFramePeriod(ms_delay);
return 1;
} else if ( 0==qstrcmp((char*)png->chunk_name, "gIFx")
&& length == 13 ) {
- if ( qstrncmp((char*)data,"NETSCAPE2.0",11)==0 ) {
+ if ( tqstrncmp((char*)data,"NETSCAPE2.0",11)==0 ) {
int looping = (data[0xC]<<8)|data[0xB];
consumer->setLooping(looping);
return 1;
@@ -546,7 +546,7 @@ int PNGFormat::user_chunk(png_structp png,
if ( !skip(length,data) ) return 0;
const char* text_utf8 = (const char*)data;
if ( !skip(length,data) ) return 0;
- QString text = QString::fromUtf8(text_utf8);
+ TQString text = TQString::fromUtf8(text_utf8);
image->setText(keyword,lang[0] ? lang : 0,text);
return 1;
}