From 8c029298d9d3f1f84b65ac4a3a16cd1fa28d9cde Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Thu, 6 Jun 2024 13:00:12 +0900 Subject: Rename image nt* related files to equivalent tq* Signed-off-by: Michele Calgaro --- doc/classchart.doc | 6 +- doc/datastreamformat.doc | 2 +- doc/dnd.doc | 16 +- doc/features.doc | 4 +- doc/html/annotated.html | 16 +- doc/html/biff-example.html | 4 +- doc/html/canvas-example.html | 28 +- doc/html/chart-optionsform-cpp.html | 2 +- doc/html/classchart.html | 6 +- doc/html/classes.html | 16 +- doc/html/datastreamformat.html | 2 +- doc/html/designer-manual-16.html | 2 +- doc/html/desktop-example.html | 14 +- doc/html/dnd.html | 18 +- doc/html/draganddrop.html | 2 +- doc/html/emb-features.html | 4 +- doc/html/functions.html | 212 +- doc/html/graphics.html | 12 +- doc/html/headerfilesynonyms | 12 +- doc/html/headers.html | 4 +- doc/html/hello-example.html | 2 +- doc/html/hierarchy.html | 16 +- doc/html/images.html | 12 +- doc/html/index | 266 +- doc/html/io.html | 2 +- doc/html/licenses.html | 4 +- doc/html/listboxcombo-example.html | 2 +- doc/html/mainclasses.html | 2 +- doc/html/mdi-example.html | 2 +- doc/html/multimedia.html | 8 +- doc/html/ntqasyncio.html | 2 +- doc/html/ntqbitmap.html | 8 +- doc/html/ntqclipboard.html | 14 +- doc/html/ntqdragobject.html | 2 +- doc/html/ntqdropsite.html | 2 +- doc/html/ntqiconset.html | 2 +- doc/html/ntqiconview.html | 2 +- doc/html/ntqimage.html | 1117 ---- doc/html/ntqimageformatplugin.html | 94 - doc/html/ntqmovie.html | 4 +- doc/html/ntqpainter.html | 12 +- doc/html/ntqpixmap.html | 46 +- doc/html/ntqpixmapcache.html | 2 +- doc/html/ntqsize.html | 2 +- doc/html/ntqstylesheet.html | 2 +- doc/html/ntqt.html | 2 +- doc/html/ntqvariant.html | 18 +- doc/html/plugins-howto.html | 2 +- doc/html/plugins.html | 2 +- doc/html/qaction-application-example.html | 2 +- doc/html/qasyncimageio-h.html | 2 +- doc/html/qdragobject-h.html | 2 +- doc/html/qembed.html | 2 +- doc/html/qgfx_qws-h.html | 2 +- doc/html/qglwidget.html | 14 +- doc/html/qimage-h.html | 470 -- doc/html/qimage-members.html | 116 - doc/html/qimageconsumer-members.html | 52 - doc/html/qimageconsumer.html | 142 - doc/html/qimagedecoder-members.html | 55 - doc/html/qimagedecoder.html | 154 - doc/html/qimagedrag-members.html | 106 - doc/html/qimagedrag.html | 120 - doc/html/qimageformat-members.html | 47 - doc/html/qimageformat.html | 87 - doc/html/qimageformatplugin-h.html | 112 - doc/html/qimageformatplugin-members.html | 50 - doc/html/qimageformattype-members.html | 50 - doc/html/qimageformattype.html | 108 - doc/html/qimageio-members.html | 72 - doc/html/qimageio.html | 372 -- doc/html/qmacmime.html | 4 +- doc/html/qmag-example.html | 8 +- doc/html/qmimesource.html | 2 +- doc/html/qmimesourcefactory.html | 10 +- doc/html/qnamespace-h.html | 2 +- doc/html/qnpinstance.html | 2 +- doc/html/qpngimagepacker.html | 2 +- doc/html/qpngio-h.html | 2 +- doc/html/qscreen.html | 4 +- doc/html/qt.dcf | 308 +- doc/html/qwindowsmime.html | 4 +- doc/html/qwindowsystem_qws-h.html | 2 +- doc/html/qwsserver.html | 2 +- doc/html/scribble-example.html | 12 +- doc/html/shared.html | 2 +- doc/html/shclass.html | 4 +- doc/html/showimg-example.html | 20 +- doc/html/simple-application-example.html | 2 +- doc/html/small-table-example-example.html | 6 +- doc/html/table-small-table-demo-main-cpp.html | 6 +- doc/html/themes-example.html | 50 +- doc/html/titleindex | 36 +- doc/html/tqcanvaspixmap.html | 8 +- doc/html/tqimage-h.html | 470 ++ doc/html/tqimage-members.html | 116 + doc/html/tqimage.html | 1117 ++++ doc/html/tqimageconsumer-members.html | 52 + doc/html/tqimageconsumer.html | 142 + doc/html/tqimagedecoder-members.html | 55 + doc/html/tqimagedecoder.html | 154 + doc/html/tqimagedrag-members.html | 106 + doc/html/tqimagedrag.html | 120 + doc/html/tqimageformat-members.html | 47 + doc/html/tqimageformat.html | 87 + doc/html/tqimageformatplugin-h.html | 112 + doc/html/tqimageformatplugin-members.html | 50 + doc/html/tqimageformatplugin.html | 94 + doc/html/tqimageformattype-members.html | 50 + doc/html/tqimageformattype.html | 108 + doc/html/tqimageio-members.html | 72 + doc/html/tqimageio.html | 372 ++ doc/html/tqwidget.html | 8 +- doc/html/tqwidgetfactory-h.html | 2 +- doc/html/whatsthis | 14 +- doc/html/xform-example.html | 2 +- doc/man/man3/tqcanvaspixmap.3qt | 2 +- doc/man/man3/tqclipboard.3qt | 4 +- doc/man/man3/tqdragobject.3qt | 2 +- doc/man/man3/tqiconview.3qt | 2 +- doc/man/man3/tqimage.3qt | 76 +- doc/man/man3/tqimageconsumer.3qt | 34 +- doc/man/man3/tqimagedecoder.3qt | 54 +- doc/man/man3/tqimagedrag.3qt | 28 +- doc/man/man3/tqimageformat.3qt | 16 +- doc/man/man3/tqimageformatplugin.3qt | 24 +- doc/man/man3/tqimageformattype.3qt | 32 +- doc/man/man3/tqimageio.3qt | 96 +- doc/man/man3/tqmacmime.3qt | 2 +- doc/man/man3/tqmimesource.3qt | 2 +- doc/man/man3/tqmimesourcefactory.3qt | 6 +- doc/man/man3/tqpixmap.3qt | 16 +- doc/man/man3/tqpngimagepacker.3qt | 2 +- doc/man/man3/tqwidget.3qt | 8 +- doc/man/man3/tqwindowsmime.3qt | 2 +- doc/plugins-howto.doc | 2 +- examples/action/application.cpp | 2 +- examples/application/application.cpp | 2 +- examples/canvas/blendshadow.cpp | 2 +- examples/canvas/canvas.cpp | 2 +- examples/canvas/main.cpp | 2 +- examples/canvas/makeimg.cpp | 2 +- examples/chart/optionsform.cpp | 2 +- examples/demo/dnd/styledbutton.cpp | 2 +- examples/demo/main.cpp | 2 +- examples/demo/opengl/gllandscape.cpp | 2 +- examples/demo/opengl/gltexobj.cpp | 2 +- examples/demo/opengl/glworkspace.cpp | 2 +- examples/demo/opengl/printpreview.ui | 2 +- examples/desktop/desktop.cpp | 2 +- examples/dragdrop/dropsite.cpp | 2 +- examples/listboxcombo/listboxcombo.cpp | 2 +- examples/mdi/application.cpp | 2 +- examples/network/remotecontrol/ipcserver.cpp | 2 +- examples/network/remotecontrol/remotectrlimpl.cpp | 2 +- examples/opengl/glpixmap/globjwin.cpp | 2 +- examples/opengl/texture/gltexobj.cpp | 2 +- examples/qmag/qmag.cpp | 2 +- examples/scribble/scribble.cpp | 2 +- examples/showimg/imagefip.cpp | 2 +- examples/showimg/imagetexteditor.cpp | 2 +- examples/showimg/main.cpp | 2 +- examples/showimg/showimg.h | 2 +- examples/table/small-table-demo/main.cpp | 2 +- examples/tablet/scribble.cpp | 2 +- examples/themes/metal.cpp | 2 +- examples/themes/wood.cpp | 2 +- examples/tux/tux.cpp | 2 +- include/ntqimage.h | 1 - include/ntqimageformatplugin.h | 1 - include/private/qimageformatinterface_p.h | 1 - include/private/tqimageformatinterface_p.h | 1 + include/tqimage.h | 1 + include/tqimageformatplugin.h | 1 + plugins/src/imageformats/jpeg/main.cpp | 2 +- plugins/src/imageformats/mng/main.cpp | 2 +- plugins/src/imageformats/png/main.cpp | 2 +- src/canvas/tqcanvas.cpp | 2 +- src/dialogs/qcolordialog.cpp | 2 +- src/dialogs/qmessagebox.cpp | 2 +- src/kernel/ntqasyncimageio.h | 2 +- src/kernel/ntqdragobject.h | 2 +- src/kernel/ntqimage.h | 425 -- src/kernel/ntqimageformatplugin.h | 67 - src/kernel/ntqnamespace.h | 2 +- src/kernel/ntqpngio.h | 2 +- src/kernel/ntqt.h | 6 +- src/kernel/qbitmap.cpp | 2 +- src/kernel/qcursor.cpp | 2 +- src/kernel/qcursor_x11.cpp | 2 +- src/kernel/qfontengine_x11.cpp | 2 +- src/kernel/qiconset.cpp | 2 +- src/kernel/qimage.cpp | 6531 --------------------- src/kernel/qimageformatinterface_p.h | 81 - src/kernel/qimageformatplugin.cpp | 184 - src/kernel/qjpegio.cpp | 2 +- src/kernel/qmngio.cpp | 4 +- src/kernel/qpainter.cpp | 2 +- src/kernel/qpicture.cpp | 2 +- src/kernel/qpixmap.cpp | 2 +- src/kernel/qpixmap_x11.cpp | 4 +- src/kernel/qpsprinter.cpp | 2 +- src/kernel/qregion_x11.cpp | 2 +- src/kernel/qrichtext.cpp | 2 +- src/kernel/qt_kernel.pri | 10 +- src/kernel/qt_pch.h | 2 +- src/kernel/qvariant.cpp | 2 +- src/kernel/tqimage.cpp | 6531 +++++++++++++++++++++ src/kernel/tqimage.h | 425 ++ src/kernel/tqimageformatinterface_p.h | 81 + src/kernel/tqimageformatplugin.cpp | 184 + src/kernel/tqimageformatplugin.h | 67 + src/kernel/tqwidget_x11.cpp | 2 +- src/opengl/qgl.cpp | 2 +- src/qt.pro | 4 +- src/styles/qmotifstyle.cpp | 2 +- src/styles/qwindowsstyle.cpp | 2 +- src/tools/qfeatures.txt | 2 +- src/widgets/qeffects.cpp | 2 +- src/widgets/qiconview.cpp | 2 +- src/widgets/qlabel.cpp | 2 +- src/widgets/qtextbrowser.cpp | 2 +- src/widgets/qtitlebar.cpp | 2 +- src/widgets/qtoolbutton.cpp | 2 +- src/workspace/qworkspace.cpp | 2 +- src/xml/qsvgdevice.cpp | 2 +- tools/designer/designer/pixmapchooser.cpp | 2 +- tools/designer/designer/pixmapcollection.cpp | 2 +- tools/designer/designer/pixmapcollectioneditor.ui | 2 +- tools/designer/designer/resource.h | 2 +- tools/designer/designer/styledbutton.cpp | 2 +- tools/designer/examples/credit/creditformbase.cpp | 2 +- tools/designer/plugins/glade/glade2ui.cpp | 2 +- tools/designer/uic/embed.cpp | 4 +- tools/designer/uic/form.cpp | 2 +- tools/designer/uilib/tqwidgetfactory.h | 2 +- tools/qembed/qembed.cpp | 4 +- tools/tqvfb/qanimationwriter.h | 2 +- tools/tqvfb/tqvfb.cpp | 2 +- tools/tqvfb/tqvfbview.cpp | 2 +- 240 files changed, 11604 insertions(+), 11604 deletions(-) delete mode 100644 doc/html/ntqimage.html delete mode 100644 doc/html/ntqimageformatplugin.html delete mode 100644 doc/html/qimage-h.html delete mode 100644 doc/html/qimage-members.html delete mode 100644 doc/html/qimageconsumer-members.html delete mode 100644 doc/html/qimageconsumer.html delete mode 100644 doc/html/qimagedecoder-members.html delete mode 100644 doc/html/qimagedecoder.html delete mode 100644 doc/html/qimagedrag-members.html delete mode 100644 doc/html/qimagedrag.html delete mode 100644 doc/html/qimageformat-members.html delete mode 100644 doc/html/qimageformat.html delete mode 100644 doc/html/qimageformatplugin-h.html delete mode 100644 doc/html/qimageformatplugin-members.html delete mode 100644 doc/html/qimageformattype-members.html delete mode 100644 doc/html/qimageformattype.html delete mode 100644 doc/html/qimageio-members.html delete mode 100644 doc/html/qimageio.html create mode 100644 doc/html/tqimage-h.html create mode 100644 doc/html/tqimage-members.html create mode 100644 doc/html/tqimage.html create mode 100644 doc/html/tqimageconsumer-members.html create mode 100644 doc/html/tqimageconsumer.html create mode 100644 doc/html/tqimagedecoder-members.html create mode 100644 doc/html/tqimagedecoder.html create mode 100644 doc/html/tqimagedrag-members.html create mode 100644 doc/html/tqimagedrag.html create mode 100644 doc/html/tqimageformat-members.html create mode 100644 doc/html/tqimageformat.html create mode 100644 doc/html/tqimageformatplugin-h.html create mode 100644 doc/html/tqimageformatplugin-members.html create mode 100644 doc/html/tqimageformatplugin.html create mode 100644 doc/html/tqimageformattype-members.html create mode 100644 doc/html/tqimageformattype.html create mode 100644 doc/html/tqimageio-members.html create mode 100644 doc/html/tqimageio.html delete mode 120000 include/ntqimage.h delete mode 120000 include/ntqimageformatplugin.h delete mode 120000 include/private/qimageformatinterface_p.h create mode 120000 include/private/tqimageformatinterface_p.h create mode 120000 include/tqimage.h create mode 120000 include/tqimageformatplugin.h delete mode 100644 src/kernel/ntqimage.h delete mode 100644 src/kernel/ntqimageformatplugin.h delete mode 100644 src/kernel/qimage.cpp delete mode 100644 src/kernel/qimageformatinterface_p.h delete mode 100644 src/kernel/qimageformatplugin.cpp create mode 100644 src/kernel/tqimage.cpp create mode 100644 src/kernel/tqimage.h create mode 100644 src/kernel/tqimageformatinterface_p.h create mode 100644 src/kernel/tqimageformatplugin.cpp create mode 100644 src/kernel/tqimageformatplugin.h diff --git a/doc/classchart.doc b/doc/classchart.doc index daf469551..42bbaf228 100644 --- a/doc/classchart.doc +++ b/doc/classchart.doc @@ -260,9 +260,9 @@ - - - + + + diff --git a/doc/datastreamformat.doc b/doc/datastreamformat.doc index 690060055..7a62e965f 100644 --- a/doc/datastreamformat.doc +++ b/doc/datastreamformat.doc @@ -156,7 +156,7 @@ and to read back into the same TQt integer type when reading. \i If the image is null a "null image" marker is saved; otherwise the image is saved in PNG or BMP format (depending on the stream version). If you want control of the format, - stream the image into a QBuffer (using QImageIO) and stream + stream the image into a QBuffer (using TQImageIO) and stream that. \endlist \row \i TQMap diff --git a/doc/dnd.doc b/doc/dnd.doc index 27ac5937d..6da6117a5 100644 --- a/doc/dnd.doc +++ b/doc/dnd.doc @@ -60,7 +60,7 @@ QTextEdit widget source code. To start a drag, for example in a \link TQWidget::mouseMoveEvent() mouse motion event\endlink, create an object of the QDragObject subclass appropriate for your media, such as QTextDrag for text and -QImageDrag for images. Then call the drag() method. This is all you +TQImageDrag for images. Then call the drag() method. This is all you need for simple dragging of existing types. For example, to start dragging some text from a widget: @@ -107,7 +107,7 @@ void MyWidget::dragEnterEvent(QDragEnterEvent* event) { event->accept( QTextDrag::canDecode(event) || - QImageDrag::canDecode(event) + TQImageDrag::canDecode(event) ); } @@ -116,7 +116,7 @@ void MyWidget::dropEvent(QDropEvent* event) TQImage image; TQString text; - if ( QImageDrag::decode(event, image) ) { + if ( TQImageDrag::decode(event, image) ) { insertImageAt(image, event->pos()); } else if ( QTextDrag::decode(event, text) ) { insertTextAt(text, event->pos()); @@ -213,9 +213,9 @@ source provides a list of MIME types that it can produce (ordered from most appropriate to least appropriate), and the drop target chooses which of those it can accept. For example, QTextDrag provides support for the "\c{text/plain}" MIME type (ordinary unformatted text), and -the Unicode formats "\c{text/utf16}" and "\c{text/utf8}"; QImageDrag +the Unicode formats "\c{text/utf16}" and "\c{text/utf8}"; TQImageDrag provides for "\c{image/*}", where \c{*} is any image format that -\l QImageIO supports; and the QUriDrag subclass provides +\l TQImageIO supports; and the QUriDrag subclass provides "\c{text/uri-list}", a standard format for transferring a list of filenames (or URLs). @@ -244,13 +244,13 @@ QByteArray encodedData(const char* mimetype) const \endlink members, and provide a set-method to encode the media data and static members canDecode() and decode() to decode incoming data, similar to -\link QImageDrag::canDecode() +\link TQImageDrag::canDecode() bool canDecode(QMimeSource*) const \endlink and -\link QImageDrag::decode() +\link TQImageDrag::decode() QByteArray decode(QMimeSource*) const \endlink -of QImageDrag. +of TQImageDrag. Of course, you can provide drag-only or drop-only support for a media type by omitting some of these methods. diff --git a/doc/features.doc b/doc/features.doc index b7e7b4bb5..01c1f7434 100644 --- a/doc/features.doc +++ b/doc/features.doc @@ -59,7 +59,7 @@ The available options are: \table \header \i Macro \i Disables \i Set automatically by -\header \i31 Images (\l QImageIO) +\header \i31 Images (\l TQImageIO) \row \i TQT_NO_IMAGEIO_BMP \i Microsoft Bitmap image file format. \i   @@ -81,7 +81,7 @@ The available options are: \i Asynchronous I/O (\l QAsyncIO) \i   \row \i TQT_NO_ASYNC_IMAGE_IO - \i Asynchronous Image I/O and GIF image support (\l QImageDecoder, ...) + \i Asynchronous Image I/O and GIF image support (\l TQImageDecoder, ...) \i   \row \i TQT_NO_MOVIE \i Animation support (\l QMovie) diff --git a/doc/html/annotated.html b/doc/html/annotated.html index 3b9f0da0c..017f1840c 100644 --- a/doc/html/annotated.html +++ b/doc/html/annotated.html @@ -207,14 +207,14 @@ body { background: #ffffff; color: black; } TQIconSetSet of icons with different styles and sizes TQIconViewArea with movable labelled icons TQIconViewItemSingle item in a TQIconView -TQImageHardware-independent pixmap representation with direct access to the pixel data -TQImageConsumerAbstraction used by TQImageDecoder -TQImageDecoderIncremental image decoder for all supported image formats -TQImageDragDrag and drop object for transferring images -TQImageFormatIncremental image decoder for a specific image format -TQImageFormatPluginAbstract base for custom image format plugins -TQImageFormatTypeFactory that makes TQImageFormat objects -TQImageIOParameters for loading and saving images +TQImageHardware-independent pixmap representation with direct access to the pixel data +TQImageConsumerAbstraction used by TQImageDecoder +TQImageDecoderIncremental image decoder for all supported image formats +TQImageDragDrag and drop object for transferring images +TQImageFormatIncremental image decoder for a specific image format +TQImageFormatPluginAbstract base for custom image format plugins +TQImageFormatTypeFactory that makes TQImageFormat objects +TQImageIOParameters for loading and saving images TQInputDialogSimple convenience dialog to get a single value from the user TQIntCacheTemplate class that provides a cache based on long keys TQIntCacheIteratorIterator for TQIntCache collections diff --git a/doc/html/biff-example.html b/doc/html/biff-example.html index 3ad0b2ddb..d65b9d673 100644 --- a/doc/html/biff-example.html +++ b/doc/html/biff-example.html @@ -147,9 +147,9 @@ how two images (hasmail_bmp_data and nomail_bmp_data, both fro void Biff::paintEvent( TQPaintEvent * ) { if ( gotMail ) - bitBlt( this, 0, 0, &hasNewMail ); + bitBlt( this, 0, 0, &hasNewMail ); else - bitBlt( this, 0, 0, &noNewMail ); + bitBlt( this, 0, 0, &noNewMail ); } diff --git a/doc/html/canvas-example.html b/doc/html/canvas-example.html index 32d05b269..70b9d2000 100644 --- a/doc/html/canvas-example.html +++ b/doc/html/canvas-example.html @@ -142,7 +142,7 @@ private: #include <ntqpainter.h> #include <ntqprinter.h> #include <ntqlabel.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqprogressdialog.h> #include "canvas.h" @@ -174,21 +174,21 @@ static const int imageRTTI = 984376; class ImageItem: public TQCanvasRectangle { public: - ImageItem( TQImage img, TQCanvas *canvas ); + ImageItem( TQImage img, TQCanvas *canvas ); int rtti () const { return imageRTTI; } bool hit( const TQPoint&) const; protected: void drawShape( TQPainter & ); private: - TQImage image; + TQImage image; TQPixmap pixmap; }; -ImageItem::ImageItem( TQImage img, TQCanvas *canvas ) +ImageItem::ImageItem( TQImage img, TQCanvas *canvas ) : TQCanvasRectangle( canvas ), image(img) { - setSize( image.width(), image.height() ); + setSize( image.width(), image.height() ); #if !defined(TQ_WS_QWS) pixmap.convertFromImage(image, OrderedAlphaDither); @@ -211,9 +211,9 @@ bool ImageItem::hit( const TQPoint int ix = p.x()-int(x()); int iy = p.y()-int(y()); - if ( !image.valid( ix , iy ) ) + if ( !image.valid( ix , iy ) ) return FALSE; - TQRgb pixel = image.pixel( ix, iy ); + TQRgb pixel = image.pixel( ix, iy ); return tqAlpha( pixel ) != 0; } @@ -680,7 +680,7 @@ void Main::addButterfly() if ( butterfly_fn.isEmpty() ) return; if ( !butterflyimg ) { - butterflyimg = new TQImage[4]; + butterflyimg = new TQImage[4]; butterflyimg[0].load( butterfly_fn ); butterflyimg[1] = butterflyimg[0].smoothScale( int(butterflyimg[0].width()*0.75), int(butterflyimg[0].height()*0.75) ); @@ -690,8 +690,8 @@ void Main::addButterfly() int(butterflyimg[0].height()*0.25) ); } TQCanvasPolygonalItem* i = new ImageItem(butterflyimg[rand()%4],&canvas); - i->move(rand()%(canvas.width()-butterflyimg->width()), - rand()%(canvas.height()-butterflyimg->height())); + i->move(rand()%(canvas.width()-butterflyimg->width()), + rand()%(canvas.height()-butterflyimg->height())); i->setZ(rand()%256+250); i->show(); } @@ -701,7 +701,7 @@ void Main::addLogo() if ( logo_fn.isEmpty() ) return; if ( !logoimg ) { - logoimg = new TQImage[4]; + logoimg = new TQImage[4]; logoimg[0].load( logo_fn ); logoimg[1] = logoimg[0].smoothScale( int(logoimg[0].width()*0.75), int(logoimg[0].height()*0.75) ); @@ -711,8 +711,8 @@ void Main::addLogo() int(logoimg[0].height()*0.25) ); } TQCanvasPolygonalItem* i = new ImageItem(logoimg[rand()%4],&canvas); - i->move(rand()%(canvas.width()-logoimg->width()), - rand()%(canvas.height()-logoimg->width())); + i->move(rand()%(canvas.width()-logoimg->width()), + rand()%(canvas.height()-logoimg->width())); i->setZ(rand()%256+256); i->show(); } @@ -888,7 +888,7 @@ void Main::addRectangle() #include <ntqmessagebox.h> #include <ntqmenubar.h> #include <ntqapplication.h> -#include <ntqimage.h> +#include <tqimage.h> #include "canvas.h" diff --git a/doc/html/chart-optionsform-cpp.html b/doc/html/chart-optionsform-cpp.html index c5e964054..f3881942e 100644 --- a/doc/html/chart-optionsform-cpp.html +++ b/doc/html/chart-optionsform-cpp.html @@ -38,7 +38,7 @@ body { background: #ffffff; color: black; } #include <ntqcombobox.h> #include <ntqfontdialog.h> #include <ntqframe.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqlabel.h> #include <ntqlayout.h> #include <ntqpushbutton.h> diff --git a/doc/html/classchart.html b/doc/html/classchart.html index 5d72ef831..5c4d2bf7f 100644 --- a/doc/html/classchart.html +++ b/doc/html/classchart.html @@ -250,9 +250,9 @@ body { background: #ffffff; color: black; } - - - + + + diff --git a/doc/html/classes.html b/doc/html/classes.html index c8eda66fa..30b661c67 100644 --- a/doc/html/classes.html +++ b/doc/html/classes.html @@ -64,7 +64,7 @@ classes, see TQt's Main Classes. TQDir -TQImage +TQImage TQPNGImagePacker @@ -75,7 +75,7 @@ classes, see TQt's Main Classes. TQDirectPainter -TQImageConsumer +TQImageConsumer TQPoint @@ -86,7 +86,7 @@ classes, see TQt's Main Classes. TQDns -TQImageDecoder +TQImageDecoder TQPointArray @@ -97,7 +97,7 @@ classes, see TQt's Main Classes. TQDockArea -TQImageDrag +TQImageDrag TQPopupMenu @@ -108,7 +108,7 @@ classes, see TQt's Main Classes. TQDockWindow -TQImageFormat +TQImageFormat TQPrinter @@ -119,7 +119,7 @@ classes, see TQt's Main Classes. TQDomAttr -TQImageFormatPlugin +TQImageFormatPlugin TQProcess @@ -130,7 +130,7 @@ classes, see TQt's Main Classes. TQDomCDATASection -TQImageFormatType +TQImageFormatType TQProgressBar @@ -141,7 +141,7 @@ classes, see TQt's Main Classes. TQDomCharacterData -TQImageIO +TQImageIO TQProgressDialog diff --git a/doc/html/datastreamformat.html b/doc/html/datastreamformat.html index a0ed8cf20..4d8bf78fe 100644 --- a/doc/html/datastreamformat.html +++ b/doc/html/datastreamformat.html @@ -146,7 +146,7 @@ The null string is represented as (TQ_UINT32) 0.
  • If the image is null a "null image" marker is saved; otherwise the image is saved in PNG or BMP format (depending on the stream version). If you want control of the format, -stream the image into a TQBuffer (using TQImageIO) and stream +stream the image into a TQBuffer (using TQImageIO) and stream that. TQMap diff --git a/doc/html/designer-manual-16.html b/doc/html/designer-manual-16.html index db2286702..884083ec8 100644 --- a/doc/html/designer-manual-16.html +++ b/doc/html/designer-manual-16.html @@ -228,7 +228,7 @@ body { background: #ffffff; color: black; } <include location="local" impldecl="in implementation">pixmapchooser.h</include> <include location="local" impldecl="in implementation">project.h</include> <include location="global" impldecl="in implementation">ntqfileinfo.h</include> - <include location="global" impldecl="in implementation">ntqimage.h</include> + <include location="global" impldecl="in implementation">tqimage.h</include> <include location="global" impldecl="in declaration">ntqpixmap.h</include> <include location="local" impldecl="in implementation">pixmapcollectioneditor.ui.h</include> </includes> diff --git a/doc/html/desktop-example.html b/doc/html/desktop-example.html index 4f1d37b0d..9f839629b 100644 --- a/doc/html/desktop-example.html +++ b/doc/html/desktop-example.html @@ -49,7 +49,7 @@ any other. ** *****************************************************************************/ -#include <ntqimage.h> +#include <tqimage.h> #include <ntqbitmap.h> #include <ntqpainter.h> #include <ntqapplication.h> @@ -161,11 +161,11 @@ void rotate() int i; const int w = 64; const int h = 64; - TQImage image( w, h, 8, 128 ); // create image + TQImage image( w, h, 8, 128 ); // create image for ( i=0; i<128; i++ ) // build color table - image.setColor( i, tqRgb(i,0,0) ); + image.setColor( i, tqRgb(i,0,0) ); for ( int y=0; y<h; y++ ) { // set image pixels - uchar *p = image.scanLine(y); + uchar *p = image.scanLine(y); for ( int x=0; x<w; x++ ) *p++ = (x+y)%128; } @@ -236,7 +236,7 @@ public: void dragEnterEvent( TQDragEnterEvent *e ) { - if ( TQImageDrag::canDecode(e) ) + if ( TQImageDrag::canDecode(e) ) e->accept(); } @@ -252,7 +252,7 @@ public: void dropEvent( TQDropEvent * e ) { TQPixmap pmp; - if ( TQImageDrag::decode( e, pmp ) ) { + if ( TQImageDrag::decode( e, pmp ) ) { setBackgroundPixmap( pmp ); update(); } @@ -296,7 +296,7 @@ void DesktopWidget::paintEvent( begin( &offscreen ); drawShadeText( &p, -br.x(), -br.y(), text, c2, c3, 3 ); p.end(); - bitBlt( this, x, y, &offscreen ); + bitBlt( this, x, y, &offscreen ); } void desktopWidget( const char *s = "Trolltech" ) diff --git a/doc/html/dnd.html b/doc/html/dnd.html index 502f5a55a..5614b21a2 100644 --- a/doc/html/dnd.html +++ b/doc/html/dnd.html @@ -64,7 +64,7 @@ sophistication): qt/examples/iconview/simple_dd, qt/examples/dragdr

    To start a drag, for example in a mouse motion event, create an object of the TQDragObject subclass appropriate for your media, such as TQTextDrag for text and -TQImageDrag for images. Then call the drag() method. This is all you +TQImageDrag for images. Then call the drag() method. This is all you need for simple dragging of existing types.

    For example, to start dragging some text from a widget:

    @@ -108,16 +108,16 @@ void MyWidget::dragEnterEvent(TQDragEnterEvent* event)
     {
         event->accept(
             TQTextDrag::canDecode(event) ||
    -        TQImageDrag::canDecode(event)
    +        TQImageDrag::canDecode(event)
         );
     }
     
     void MyWidget::dropEvent(TQDropEvent* event)
     {
    -    TQImage image;
    +    TQImage image;
         TQString text;
     
    -    if ( TQImageDrag::decode(event, image) ) {
    +    if ( TQImageDrag::decode(event, image) ) {
             insertImageAt(image, event->pos());
         } else if ( TQTextDrag::decode(event, text) ) {
             insertTextAt(text, event->pos());
    @@ -212,9 +212,9 @@ source provides a list of MIME types that it can produce (ordered from
     most appropriate to least appropriate), and the drop target chooses
     which of those it can accept. For example, TQTextDrag provides support
     for the "text/plain" MIME type (ordinary unformatted text), and
    -the Unicode formats "text/utf16" and "text/utf8"; TQImageDrag
    +the Unicode formats "text/utf16" and "text/utf8"; TQImageDrag
     provides for "image/*", where * is any image format that
    -TQImageIO supports; and the TQUriDrag subclass provides
    +TQImageIO supports; and the TQUriDrag subclass provides
     "text/uri-list", a standard format for transferring a list of
     filenames (or URLs).
     

    To implement drag-and-drop of some type of information for which there @@ -234,9 +234,9 @@ is sufficient. TQByteArray encodedData(const char* mimetype) const members, and provide a set-method to encode the media data and static members canDecode() and decode() to decode incoming data, similar to -bool canDecode(TQMimeSource*) const and -TQByteArray decode(TQMimeSource*) const -of TQImageDrag. +bool canDecode(TQMimeSource*) const and +TQByteArray decode(TQMimeSource*) const +of TQImageDrag. Of course, you can provide drag-only or drop-only support for a media type by omitting some of these methods.

    Subclasses of TQStoredDrag provide a set-method to encode the media diff --git a/doc/html/draganddrop.html b/doc/html/draganddrop.html index 96123311f..abc15b817 100644 --- a/doc/html/draganddrop.html +++ b/doc/html/draganddrop.html @@ -45,7 +45,7 @@ TQt. TQDropEventEvent which is sent when a drag and drop is completed TQIconDragSupports drag and drop operations within a TQIconView TQIconDragItemEncapsulates a drag item -TQImageDragDrag and drop object for transferring images +TQImageDragDrag and drop object for transferring images TQMacMimeMaps open-standard MIME to Mac flavors TQMimeSourceAbstraction of objects which provide formatted data of a certain MIME type TQStoredDragSimple stored-value drag object for arbitrary MIME data diff --git a/doc/html/emb-features.html b/doc/html/emb-features.html index 252fe36aa..035040abf 100644 --- a/doc/html/emb-features.html +++ b/doc/html/emb-features.html @@ -46,7 +46,7 @@ dependencies are expressed in ntqfeatures.h.

    The available options are:

    -
    Macro Disables Set automatically by -
    Images (TQImageIO) +
    Images (TQImageIO)
    TQT_NO_IMAGEIO_BMP Microsoft Bitmap image file format.   @@ -67,7 +67,7 @@ dependencies are expressed in ntqfeatures.h. Asynchronous I/O (TQAsyncIO)  
    TQT_NO_ASYNC_IMAGE_IO -Asynchronous Image I/O and GIF image support (TQImageDecoder, ...) +Asynchronous Image I/O and GIF image support (TQImageDecoder, ...)  
    TQT_NO_MOVIE Animation support (TQMovie) diff --git a/doc/html/functions.html b/doc/html/functions.html index 2bf662c5f..339fd403a 100644 --- a/doc/html/functions.html +++ b/doc/html/functions.html @@ -136,7 +136,7 @@ abort: TQLayout
  • all: TQMacMime TQWindowsMime
  • allColumnsShowFocus: TQListView
  • allGray: - TQImage
  • allItems: + TQImage
  • allItems: TQCanvas
  • allWidgets: TQApplication
  • alloc: TQColor TQScreen
  • allocation: @@ -271,10 +271,10 @@ back: TQDataTable
  • bind: TQSocketDevice
  • bindValue: TQSqlQuery
  • bitBlt: - TQImage TQPaintDevice
  • bitOrder: - TQImage
  • bitmap: + TQImage TQPaintDevice
  • bitOrder: + TQImage
  • bitmap: TQCursor
  • bits: - TQImage
  • blank: + TQImage
  • blank: TQScreen
  • blockSignals: TQObject
  • blocking: TQSocketDevice
  • blue: @@ -307,7 +307,7 @@ back: TQColorGroup TQMessageBox
  • byteOrder: TQDataStream
  • bytesAvailable: TQFtp TQHttp TQSocket TQSocketDevice
  • bytesPerLine: - TQImage
  • bytesToWrite: + TQImage
  • bytesToWrite: TQSocket
  • bytesWritten: TQSocket
  • c: @@ -321,7 +321,7 @@ c: TQAxScript TQAxScriptManager
  • canCast: TQVariant
  • canConvert: TQMacMime TQWindowsMime
  • canDecode: - TQColorDrag TQIconDrag TQImageDrag TQTextDrag TQUriDrag
  • canDelete: + TQColorDrag TQIconDrag TQImageDrag TQTextDrag TQUriDrag
  • canDelete: TQSqlCursor
  • canEncode: TQTextCodec
  • canInsert: TQSqlCursor
  • canReadLine: @@ -364,7 +364,7 @@ c: TQComboBox TQListBox TQMenuData TQPopupMenu
  • changeSize: TQSpacerItem
  • changeTab: TQTabDialog TQTabWidget
  • changed: - TQImageConsumer
  • channel: + TQImageConsumer
  • channel: TQCopChannel
  • charAt: TQTextEdit
  • charWidth: TQFontMetrics
  • characters: @@ -454,12 +454,12 @@ c: TQListView
  • collidesWith: TQCanvasItem
  • collisions: TQCanvas TQCanvasItem
  • color: - TQBrush TQCanvasText TQColorGroup TQImage TQPalette TQPen TQStyleOption TQStyleSheetItem TQTextEdit
  • colorGroup: + TQBrush TQCanvasText TQColorGroup TQImage TQPalette TQPen TQStyleOption TQStyleSheetItem TQTextEdit
  • colorGroup: TQWidget
  • colorMode: TQPrinter
  • colorNames: TQColor
  • colorSpec: TQApplication
  • colorTable: - TQImage
  • colormap: + TQImage
  • colormap: TQGLWidget
  • columnAlignment: TQListView
  • columnAt: TQGridView TQTable
  • columnClicked: @@ -540,9 +540,9 @@ c: TQAccessibleInterface
  • controlPoints: TQCanvasSpline
  • controllingUnknown: TQAxAggregated
  • convertBitOrder: - TQImage
  • convertDepth: - TQImage
  • convertDepthWithPalette: - TQImage
  • convertFromImage: + TQImage
  • convertDepth: + TQImage
  • convertDepthWithPalette: + TQImage
  • convertFromImage: TQPixmap
  • convertFromMime: TQMacMime TQWindowsMime
  • convertFromPlainText: TQStyleSheet
  • convertSeparators: @@ -554,7 +554,7 @@ c: TQMacMime TQWindowsMime
  • convertorName: TQMacMime TQWindowsMime
  • coords: TQRect
  • copy: - TQBitArray TQCString TQImage TQLineEdit TQMemArray TQPalette TQPicture TQPointArray TQTextEdit TQUrlOperator
  • copyAvailable: + TQBitArray TQCString TQImage TQLineEdit TQMemArray TQPalette TQPicture TQPointArray TQTextEdit TQUrlOperator
  • copyAvailable: TQTextEdit
  • copyBlt: TQPixmap
  • cornerWidget: TQScrollView TQTabWidget
  • count: @@ -563,9 +563,9 @@ c: TQMacMime
  • country: TQLocale
  • countryToString: TQLocale
  • create: - TQAxFactory TQGLContext TQGfxDriverFactory TQGfxDriverPlugin TQImage TQKbdDriverFactory TQKbdDriverPlugin TQMouseDriverFactory TQMouseDriverPlugin TQNPlugin TQSqlDriverPlugin TQStyleFactory TQStylePlugin TQWidget TQWidgetFactory TQWidgetPlugin
  • createAggregate: + TQAxFactory TQGLContext TQGfxDriverFactory TQGfxDriverPlugin TQImage TQKbdDriverFactory TQKbdDriverPlugin TQMouseDriverFactory TQMouseDriverPlugin TQNPlugin TQSqlDriverPlugin TQStyleFactory TQStylePlugin TQWidget TQWidgetFactory TQWidgetPlugin
  • createAggregate: TQAxBindable
  • createAlphaMask: - TQImage
  • createAttribute: + TQImage
  • createAttribute: TQDomDocument
  • createAttributeNS: TQDomDocument
  • createCDATASection: TQDomDocument
  • createComment: @@ -581,7 +581,7 @@ c: TQTextCodecPlugin
  • createForName: TQTextCodecPlugin
  • createGfx: TQScreen
  • createHeuristicMask: - TQImage TQPixmap
  • createHostWindow: + TQImage TQPixmap
  • createHostWindow: TQAxWidget
  • createObject: TQAxFactory
  • createObjectWrapper: TQAxFactory
  • createPixmap: @@ -679,11 +679,11 @@ dark: TQFont
  • decimals: TQDoubleValidator
  • declHandler: TQXmlReader
  • decode: - TQColorDrag TQImageDecoder TQImageDrag TQImageFormat TQTextDrag TQUriDrag TQUrl
  • decodeLocalFiles: + TQColorDrag TQImageDecoder TQImageDrag TQImageFormat TQTextDrag TQUriDrag TQUrl
  • decodeLocalFiles: TQUriDrag
  • decodeName: TQFile
  • decodeToUnicodeUris: TQUriDrag
  • decoderFor: - TQImageFormatType
  • decomposition: + TQImageFormatType
  • decomposition: TQChar
  • decompositionTag: TQChar
  • defaultButtonPressed: TQTabDialog
  • defaultDepth: @@ -697,7 +697,7 @@ dark: TQListView
  • defaultSheet: TQStyleSheet
  • defaultValue: TQSqlFieldInfo
  • defineIOHandler: - TQImageIO
  • definesFontItalic: + TQImageIO
  • definesFontItalic: TQStyleSheetItem
  • definesFontStrikeOut: TQStyleSheetItem
  • definesFontUnderline: TQStyleSheetItem
  • del: @@ -712,10 +712,10 @@ dark: TQObject
  • deleteNetworkProtocol: TQUrlOperator
  • delta: TQWheelEvent
  • depth: - TQDirectPainter TQGLFormat TQImage TQListViewItem TQPaintDeviceMetrics TQPixmap TQScreen
  • dequeue: + TQDirectPainter TQGLFormat TQImage TQListViewItem TQPaintDeviceMetrics TQPixmap TQScreen
  • dequeue: TQPtrQueue
  • descent: TQFontMetrics
  • description: - TQImageIO
  • deselect: + TQImageIO
  • deselect: TQLineEdit
  • designable: TQMetaProperty
  • desktop: TQApplication
  • desktopSettingsAware: @@ -724,7 +724,7 @@ dark: TQColor
  • destroyed: TQObject
  • det: TQWMatrix
  • detach: - TQBitArray TQGLColormap TQIconSet TQImage TQMap TQMemArray TQPicture TQPixmap
  • device: + TQBitArray TQGLColormap TQIconSet TQImage TQMap TQMemArray TQPicture TQPixmap
  • device: TQDataStream TQGLContext TQPainter TQTabletEvent TQTextStream
  • deviceHeight: TQScreen
  • deviceIsPixmap: TQGLContext
  • deviceWidth: @@ -772,8 +772,8 @@ dark: TQTextEdit
  • done: TQDialog TQFtp TQHttp
  • doneCurrent: TQGLContext TQGLWidget
  • dotsPerMeterX: - TQImage
  • dotsPerMeterY: - TQImage
  • doubleBuffer: + TQImage
  • dotsPerMeterY: + TQImage
  • doubleBuffer: TQGLFormat TQGLWidget
  • doubleClickInterval: TQApplication
  • doubleClicked: TQIconView TQListBox TQListView TQTable TQTextEdit
  • downRect: @@ -868,7 +868,7 @@ echoMode: TQFile
  • encodedData: TQDropEvent TQIconDrag TQMimeSource TQStoredDrag
  • encodedPathAndQuery: TQUrl
  • end: - TQImageConsumer TQLineEdit TQMap TQMemArray TQMultiLineEdit TQNPStream TQPainter TQValueList TQValueVector
  • endCDATA: + TQImageConsumer TQLineEdit TQMap TQMemArray TQMultiLineEdit TQNPStream TQPainter TQValueList TQValueVector
  • endCDATA: TQXmlLexicalHandler
  • endDTD: TQXmlLexicalHandler
  • endDocument: TQXmlContentHandler
  • endEdit: @@ -950,11 +950,11 @@ falseText: TQSqlRecord
  • fieldToWidget: TQSqlForm
  • fileHighlighted: TQFileDialog
  • fileName: - TQFileInfo TQImageIO TQSound TQUrl
  • filePath: + TQFileInfo TQImageIO TQSound TQUrl
  • filePath: TQDir TQFileInfo TQMimeSourceFactory
  • fileSelected: TQFileDialog
  • filesSelected: TQFileDialog
  • fill: - TQBitArray TQCString TQImage TQMemArray TQPixmap TQPtrVector TQString TQTextStream
  • fillRect: + TQBitArray TQCString TQImage TQMemArray TQPixmap TQPtrVector TQString TQTextStream
  • fillRect: TQPainter
  • filter: TQDataBrowser TQDataTable TQDir TQSqlCursor TQWSInputMethod
  • filterSelected: TQFileDialog
  • find: @@ -1012,8 +1012,8 @@ falseText: TQColorGroup
  • foregroundColor: TQWidget
  • form: TQDataBrowser TQDataView
  • format: - TQDropEvent TQGLContext TQGLWidget TQImageDecoder TQImageIO TQMimeSource
  • formatName: - TQImageDecoder TQImageFormatType
  • formatValue: + TQDropEvent TQGLContext TQGLWidget TQImageDecoder TQImageIO TQMimeSource
  • formatName: + TQImageDecoder TQImageFormatType
  • formatValue: TQSqlDriver
  • forward: TQTextBrowser
  • forwardAvailable: TQTextBrowser
  • frame: @@ -1021,7 +1021,7 @@ falseText: TQDirectPainter
  • frameChanged: TQFrame
  • frameCount: TQCanvasSprite
  • frameDone: - TQImageConsumer
  • frameGeometry: + TQImageConsumer
  • frameGeometry: TQWidget
  • frameImage: TQMovie
  • frameNumber: TQMovie
  • framePixmap: @@ -1037,7 +1037,7 @@ falseText: TQValueList
  • fromLatin1: TQString
  • fromLocal8Bit: TQString
  • fromMimeSource: - TQImage TQPixmap
  • fromPage: + TQImage TQPixmap
  • fromPage: TQPrinter
  • fromRawData: TQXmlInputSource
  • fromStrList: TQStringList
  • fromString: @@ -1051,7 +1051,7 @@ falseText: TQCustomMenuItem
  • functions: TQAxScript TQAxScriptManager
  • gamma: - TQImageIO
  • generateDocumentation: + TQImageIO
  • generateDocumentation: TQAxBase
  • generateFontDisplayLists: TQGLContext
  • geometry: TQLayoutItem TQWidget
  • get: @@ -1119,7 +1119,7 @@ hScrollBarMode: TQSplitter
  • hasAcceptableInput: TQLineEdit
  • hasAlpha: TQPixmap
  • hasAlphaBuffer: - TQImage
  • hasAlphaChannel: + TQImage
  • hasAlphaChannel: TQPixmap
  • hasApplyButton: TQTabDialog
  • hasAttribute: TQDomElement
  • hasAttributeNS: @@ -1169,7 +1169,7 @@ hScrollBarMode: TQListView
  • headerSection: TQStyleOption
  • headerWidth: TQHeader
  • height: - TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQWidget
  • heightForWidth: + TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQWidget
  • heightForWidth: TQBoxLayout TQGridLayout TQLayoutItem TQMenuBar TQTextEdit TQWidget
  • heightMM: TQPaintDeviceMetrics
  • help: TQWizard
  • helpButton: @@ -1221,9 +1221,9 @@ icon: TQWidget
  • imEndEvent: TQWidget
  • imStartEvent: TQWidget
  • image: - TQCanvasPixmapArray TQCanvasSprite TQClipboard TQImageDecoder TQImageIO
  • imageAdvanced: + TQCanvasPixmapArray TQCanvasSprite TQClipboard TQImageDecoder TQImageIO
  • imageAdvanced: TQCanvasSprite
  • imageFormat: - TQImage TQImageIO TQPixmap
  • implementation: + TQImage TQImageIO TQPixmap
  • implementation: TQDomDocument
  • importNode: TQDomDocument
  • inFont: TQFontMetrics
  • inSort: @@ -1250,8 +1250,8 @@ icon: TQGLWidget
  • initializeRemote: TQAxBase
  • initialized: TQGLContext
  • inputFormatList: - TQImage
  • inputFormats: - TQImage TQImageDecoder TQImageIO
  • inputMask: + TQImage
  • inputFormats: + TQImage TQImageDecoder TQImageIO
  • inputMask: TQLineEdit
  • insert: TQAsciiCache TQAsciiDict TQButtonGroup TQCString TQCache TQDataBrowser TQDict TQIntCache TQIntDict TQLineEdit TQMap TQPixmapCache TQPtrDict TQPtrList TQPtrVector TQSqlCursor TQSqlForm TQSqlPropertyMap TQSqlRecord TQString TQTextEdit TQTranslator TQValueList TQValueVector
  • insertAfter: TQDomNode
  • insertAndMark: @@ -1288,7 +1288,7 @@ icon: TQSqlPropertyMap
  • installEditorFactory: TQDataTable
  • installEventFilter: TQObject
  • installIOHandler: - TQImageFormatPlugin
  • installIconFactory: + TQImageFormatPlugin
  • installIconFactory: TQIconSet
  • installPropertyMap: TQDataTable TQSqlForm
  • installTranslator: TQApplication
  • instance: @@ -1304,9 +1304,9 @@ icon: TQListViewItem
  • inverseWorldMatrix: TQCanvasView
  • invert: TQWMatrix
  • invertPixels: - TQImage
  • invertSelection: + TQImage
  • invertSelection: TQIconView TQListBox TQListView
  • ioDevice: - TQImageIO
  • isA: + TQImageIO
  • isA: TQObject
  • isAccepted: TQCloseEvent TQContextMenuEvent TQDropEvent TQIMEvent TQIconDragEvent TQKeyEvent TQMouseEvent TQTabletEvent TQWheelEvent
  • isActionAccepted: TQDropEvent
  • isActive: @@ -1380,7 +1380,7 @@ icon: TQWSWindow
  • isGenerated: TQIconSet TQSqlFieldInfo TQSqlRecord
  • isGloballyEnabled: TQToolTip
  • isGrayscale: - TQImage
  • isHidden: + TQImage
  • isHidden: TQFileInfo TQWidget
  • isHorizontalSliderPressed: TQScrollView
  • isHorizontallyStretchable: TQDockWindow
  • isIPv4Address: @@ -1407,7 +1407,7 @@ icon: TQLineEdit TQTextEdit
  • isMovingEnabled: TQDockWindow TQHeader
  • isNotation: TQDomNode TQDomNotation
  • isNull: - TQAxBase TQCString TQChar TQDate TQDateTime TQDomImplementation TQDomNode TQGuardedPtr TQHostAddress TQIconSet TQImage TQMemArray TQMovie TQPicture TQPixmap TQPoint TQPtrVector TQRect TQRegion TQSize TQSqlCursor TQSqlField TQSqlQuery TQSqlRecord TQSqlResult TQString TQTime TQUuid TQVariant
  • isNumber: + TQAxBase TQCString TQChar TQDate TQDateTime TQDomImplementation TQDomNode TQGuardedPtr TQHostAddress TQIconSet TQImage TQMemArray TQMovie TQPicture TQPixmap TQPoint TQPtrVector TQRect TQRegion TQSize TQSqlCursor TQSqlField TQSqlQuery TQSqlRecord TQSqlResult TQString TQTime TQUuid TQVariant
  • isNumber: TQChar
  • isOn: TQAction TQButton TQCheckBox TQCheckListItem TQPushButton TQRadioButton
  • isOpen: TQAssistantClient TQIODevice TQListView TQListViewItem TQSqlDatabase TQSqlDriver
  • isOpenError: @@ -1512,7 +1512,7 @@ join: TQStringList
  • joinStyle: TQPen
  • joining: TQChar
  • jumpTable: - TQImage
  • + TQImage
  • key: TQAccel TQFont TQIconViewItem TQKeyEvent TQListViewItem TQMapConstIterator TQMapIterator TQTableItem
  • keyMap: TQWSServer
  • keyPressEvent: @@ -1522,7 +1522,7 @@ key: TQTabBar
  • keyboardGrabber: TQWidget
  • keyboardHandler: TQWSServer
  • keys: - TQGfxDriverFactory TQGfxDriverPlugin TQHttpHeader TQImageFormatPlugin TQKbdDriverFactory TQKbdDriverPlugin TQMap TQMouseDriverFactory TQMouseDriverPlugin TQSqlDriverPlugin TQStyleFactory TQStylePlugin TQWidgetPlugin
  • keysToValue: + TQGfxDriverFactory TQGfxDriverPlugin TQHttpHeader TQImageFormatPlugin TQKbdDriverFactory TQKbdDriverPlugin TQMap TQMouseDriverFactory TQMouseDriverPlugin TQSqlDriverPlugin TQStyleFactory TQStylePlugin TQWidgetPlugin
  • keysToValue: TQMetaProperty
  • kill: TQProcess
  • killLine: TQMultiLineEdit
  • killTimer: @@ -1597,10 +1597,10 @@ label: TQListViewItem
  • listViewItem: TQStyleOption
  • listen: TQSocketDevice
  • load: - TQAxScript TQAxScriptManager TQImage TQLibrary TQPicture TQPixmap TQTranslator
  • loadCharmap: + TQAxScript TQAxScriptManager TQImage TQLibrary TQPicture TQPixmap TQTranslator
  • loadCharmap: TQTextCodec
  • loadCharmapFile: TQTextCodec
  • loadFromData: - TQImage TQPixmap
  • loadImages: + TQImage TQPixmap
  • loadImages: TQWidgetFactory
  • local8Bit: TQString
  • localData: TQThreadStorage
  • localFileToUri: @@ -1727,7 +1727,7 @@ m11: TQWidget
  • minorVersion: TQHttpHeader TQHttpRequestHeader TQHttpResponseHeader
  • minute: TQTime
  • mirror: - TQImage
  • mirrored: + TQImage
  • mirrored: TQChar
  • mirroredChar: TQChar
  • mixedColor: TQPlatinumStyle
  • mkdir: @@ -1817,10 +1817,10 @@ name: TQMemArray
  • nullText: TQDataTable TQSqlDriver
  • numBitPlanes: TQColor
  • numBytes: - TQImage
  • numCaptures: + TQImage
  • numCaptures: TQRegExp
  • numClassInfo: TQMetaObject
  • numColors: - TQImage TQPaintDeviceMetrics
  • numCols: + TQImage TQPaintDeviceMetrics
  • numCols: TQDataTable TQGridLayout TQGridView TQScreen TQTable TQTableSelection
  • numColumns: TQListBox
  • numCopies: TQPrinter
  • numDigits: @@ -1839,7 +1839,7 @@ name: object: TQAccessibleObject TQAxAggregated
  • objectTrees: TQObject
  • offset: - TQDirectPainter TQDockWindow TQHeader TQImage
  • offsetX: + TQDirectPainter TQDockWindow TQHeader TQImage
  • offsetX: TQCanvasPixmap
  • offsetY: TQCanvasPixmap
  • ok: TQServerSocket
  • okRename: @@ -1877,7 +1877,7 @@ object: TQString
  • operator type *: TQAsciiCacheIterator TQAsciiDictIterator TQCacheIterator TQDictIterator TQIntCacheIterator TQIntDictIterator TQPtrDictIterator TQPtrListIterator TQPtrQueue TQPtrStack
  • operator!: TQString
  • operator!=: - TQBrush TQCString TQChar TQColor TQColorGroup TQDate TQDateTime TQDir TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQFont TQGuardedPtr TQImage TQKeySequence TQMapConstIterator TQMapIterator TQMemArray TQPalette TQPen TQPoint TQPtrList TQRect TQRegExp TQRegion TQSize TQSizePolicy TQString TQTableSelection TQTime TQTranslatorMessage TQUuid TQValueList TQValueListConstIterator TQValueListIterator TQVariant TQWMatrix
  • operator&: + TQBrush TQCString TQChar TQColor TQColorGroup TQDate TQDateTime TQDir TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQFont TQGuardedPtr TQImage TQKeySequence TQMapConstIterator TQMapIterator TQMemArray TQPalette TQPen TQPoint TQPtrList TQRect TQRegExp TQRegion TQSize TQSizePolicy TQString TQTableSelection TQTime TQTranslatorMessage TQUuid TQValueList TQValueListConstIterator TQValueListIterator TQVariant TQWMatrix
  • operator&: TQBitArray TQRect TQRegion
  • operator&=: TQBitArray TQRect TQRegion
  • operator(): TQAsciiCacheIterator TQAsciiDictIterator TQCacheIterator TQDictIterator TQIntCacheIterator TQIntDictIterator TQPtrDictIterator TQPtrListIterator
  • operator*: @@ -1893,13 +1893,13 @@ object: TQPoint TQSize
  • operator/=: TQPoint TQSize
  • operator<: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage TQUuid
  • operator<<: - TQBitArray TQBrush TQCString TQColor TQColorGroup TQCursor TQDataStream TQDate TQDateTime TQDockArea TQDomNode TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator<=: + TQBitArray TQBrush TQCString TQColor TQColorGroup TQCursor TQDataStream TQDate TQDateTime TQDockArea TQDomNode TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator<=: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage
  • operator=: - TQAsciiCacheIterator TQAsciiDict TQBitArray TQBitVal TQBitmap TQBrush TQCString TQCacheIterator TQColor TQColorGroup TQCursor TQDeepCopy TQDict TQDir TQDomAttr TQDomCDATASection TQDomCharacterData TQDomComment TQDomDocument TQDomDocumentFragment TQDomDocumentType TQDomElement TQDomEntity TQDomEntityReference TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQDomNotation TQDomProcessingInstruction TQDomText TQFileInfo TQFont TQFontInfo TQFontMetrics TQGLColormap TQGuardedPtr TQHostAddress TQHttpHeader TQIconSet TQImage TQIntCacheIterator TQIntDict fnord TQKeySequence TQLayoutIterator TQListViewItemIterator TQLocale TQMap TQMemArray TQMovie TQObjectList TQObjectListIterator TQPair TQPalette TQPen TQPicture TQPixmap TQPointArray TQPtrDict TQPtrList TQPtrListIterator TQPtrQueue TQPtrStack TQPtrVector TQRegExp TQRegion TQSqlCursor TQSqlError TQSqlField TQSqlFieldInfo TQSqlIndex TQSqlQuery TQSqlRecord TQStrList TQString TQStyleSheetItem TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueVector TQVariant
  • operator==: - TQBrush TQCString TQChar TQColor TQColorGroup TQDate TQDateTime TQDir TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQFont TQGuardedPtr TQHostAddress TQImage TQKeySequence TQMapConstIterator TQMapIterator TQMemArray TQPalette TQPen TQPoint TQPtrList TQPtrVector TQRect TQRegExp TQRegion TQSize TQSizePolicy TQSqlField TQSqlFieldInfo TQString TQTableSelection TQTime TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueListConstIterator TQValueListIterator TQValueVector TQVariant TQWMatrix
  • operator>: + TQAsciiCacheIterator TQAsciiDict TQBitArray TQBitVal TQBitmap TQBrush TQCString TQCacheIterator TQColor TQColorGroup TQCursor TQDeepCopy TQDict TQDir TQDomAttr TQDomCDATASection TQDomCharacterData TQDomComment TQDomDocument TQDomDocumentFragment TQDomDocumentType TQDomElement TQDomEntity TQDomEntityReference TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQDomNotation TQDomProcessingInstruction TQDomText TQFileInfo TQFont TQFontInfo TQFontMetrics TQGLColormap TQGuardedPtr TQHostAddress TQHttpHeader TQIconSet TQImage TQIntCacheIterator TQIntDict fnord TQKeySequence TQLayoutIterator TQListViewItemIterator TQLocale TQMap TQMemArray TQMovie TQObjectList TQObjectListIterator TQPair TQPalette TQPen TQPicture TQPixmap TQPointArray TQPtrDict TQPtrList TQPtrListIterator TQPtrQueue TQPtrStack TQPtrVector TQRegExp TQRegion TQSqlCursor TQSqlError TQSqlField TQSqlFieldInfo TQSqlIndex TQSqlQuery TQSqlRecord TQStrList TQString TQStyleSheetItem TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueVector TQVariant
  • operator==: + TQBrush TQCString TQChar TQColor TQColorGroup TQDate TQDateTime TQDir TQDomImplementation TQDomNamedNodeMap TQDomNode TQDomNodeList TQFont TQGuardedPtr TQHostAddress TQImage TQKeySequence TQMapConstIterator TQMapIterator TQMemArray TQPalette TQPen TQPoint TQPtrList TQPtrVector TQRect TQRegExp TQRegion TQSize TQSizePolicy TQSqlField TQSqlFieldInfo TQString TQTableSelection TQTime TQTranslatorMessage TQUrl TQUrlInfo TQUuid TQValueList TQValueListConstIterator TQValueListIterator TQValueVector TQVariant TQWMatrix
  • operator>: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage TQUuid
  • operator>=: TQCString TQChar TQDate TQDateTime TQString TQTime TQTranslatorMessage
  • operator>>: - TQBitArray TQBrush TQCString TQColor TQCursor TQDataStream TQDate TQDateTime TQDockArea TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator[]: + TQBitArray TQBrush TQCString TQColor TQCursor TQDataStream TQDate TQDateTime TQDockArea TQFont TQImage TQKeySequence TQMainWindow TQMap TQMemArray TQPalette TQPen TQPicture TQPixmap TQPoint TQPointArray TQRect TQRegion TQSize TQSplitter TQString TQTextStream TQTime TQUuid TQValueList TQWMatrix
  • operator[]: TQAsciiCache TQAsciiDict TQBitArray TQCache TQDict TQDir TQIntCache TQIntDict TQKeySequence TQMap TQMemArray TQPtrDict TQPtrVector TQString TQValueList TQValueVector
  • operator^: TQBitArray TQRegion
  • operator^=: TQBitArray TQRegion
  • operator|: @@ -1912,8 +1912,8 @@ object: TQDockWindow
  • origin: TQGridLayout
  • outputFileName: TQPrinter
  • outputFormatList: - TQImage
  • outputFormats: - TQImage TQImageIO
  • outputToFile: + TQImage
  • outputFormats: + TQImage TQImageIO
  • outputToFile: TQPrinter
  • overflow: TQLCDNumber
  • overlayContext: TQGLWidget
  • overlayTransparentColor: @@ -1966,7 +1966,7 @@ packImage: TQTextEdit
  • paragraphRect: TQTextEdit
  • paragraphs: TQTextEdit
  • parameters: - TQImageIO
  • parent: + TQImageIO
  • parent: TQListViewItem TQObject
  • parentNode: TQDomNode
  • parentWidget: TQToolTip TQWidget
  • parse: @@ -1987,8 +1987,8 @@ packImage: TQFileInfo
  • permissions: TQUrlInfo
  • picture: TQIconViewItem TQLabel
  • pixel: - TQColor TQImage
  • pixelIndex: - TQImage
  • pixelMetric: + TQColor TQImage
  • pixelIndex: + TQImage
  • pixelMetric: TQStyle
  • pixelSize: TQFont TQFontInfo
  • pixelType: TQScreen
  • pixmap: @@ -2119,7 +2119,7 @@ tqAddPostRoutine: TQErrorMessage
  • tqt_find_obj_child: TQObject
  • qualifiedNames: TQDns
  • quality: - TQImageIO
  • query: + TQImageIO
  • query: TQUrl
  • queryAccessibleInterface: TQAccessible
  • queryChild: TQAccessibleInterface
  • queryInterface: @@ -2151,7 +2151,7 @@ rBottom: TQFtp
  • rawMode: TQFont TQFontInfo
  • rawName: TQFont
  • read: - TQAsciiDict TQDict TQImageIO TQIntDict TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTextStream
  • readAll: + TQAsciiDict TQDict TQImageIO TQIntDict TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTextStream
  • readAll: TQFile TQFtp TQHttp TQIODevice
  • readBlock: TQFtp TQHttp TQIODevice TQSocket TQSocketDevice
  • readBoolEntry: TQSettings
  • readBufferSize: @@ -2186,7 +2186,7 @@ rBottom: TQDataView TQSqlDatabase TQSqlDriver
  • recordInfo: TQSqlDatabase TQSqlDriver
  • recordType: TQDns
  • rect: - TQAccessibleInterface TQCanvas TQCanvasRectangle TQDirectPainter TQIconViewItem TQImage TQPaintEvent TQPixmap TQRect TQStyleOption TQTab TQWidget
  • rects: + TQAccessibleInterface TQCanvas TQCanvasRectangle TQDirectPainter TQIconViewItem TQImage TQPaintEvent TQPixmap TQRect TQStyleOption TQTab TQWidget
  • rects: TQRegion
  • red: TQColor
  • redirect: TQPainter
  • redo: @@ -2198,7 +2198,7 @@ rBottom: TQRegExpValidator
  • region: TQDirectPainter TQPaintEvent TQWSDecoration
  • registerClass: TQAxFactory
  • registerDecoderFactory: - TQImageDecoder
  • registerEngine: + TQImageDecoder
  • registerEngine: TQAxScriptManager
  • registerNetworkProtocol: TQNetworkProtocol
  • registerSocketNotifier: TQEventLoop
  • registerSqlDriver: @@ -2282,7 +2282,7 @@ rBottom: TQGLContext
  • rereadDir: TQFileDialog
  • reserve: TQString TQValueVector
  • reset: - TQDataTable TQGLContext TQIODevice TQIconSet TQImage TQMetaProperty TQProgressBar TQProgressDialog TQSqlResult TQTextStream TQUrl TQWMatrix TQWSInputMethod TQXmlInputSource TQXmlNamespaceSupport
  • resetGroup: + TQDataTable TQGLContext TQIODevice TQIconSet TQImage TQMetaProperty TQProgressBar TQProgressDialog TQSqlResult TQTextStream TQUrl TQWMatrix TQWSInputMethod TQXmlInputSource TQXmlNamespaceSupport
  • resetGroup: TQSettings
  • resetInputContext: TQWidget
  • resetRawData: TQMemArray
  • resetReason: @@ -2355,13 +2355,13 @@ rBottom: TQPoint
  • sRect: TQHeader
  • save: - TQDomNode TQImage TQPainter TQPicture TQPixmap TQScreen TQTranslator
  • saveState: + TQDomNode TQImage TQPainter TQPicture TQPixmap TQScreen TQTranslator
  • saveState: TQApplication
  • scale: - TQImage TQPainter TQSize TQWMatrix
  • scaleFont: + TQImage TQPainter TQSize TQWMatrix
  • scaleFont: TQStyleSheet
  • scaleHeight: - TQImage
  • scaleWidth: - TQImage
  • scanLine: - TQImage
  • screen: + TQImage
  • scaleWidth: + TQImage
  • scanLine: + TQImage
  • screen: TQDesktopWidget
  • screenGeometry: TQDesktopWidget
  • screenGfx: TQScreen
  • screenNumber: @@ -2448,7 +2448,7 @@ sRect: TQCanvas
  • setAllColumnsShowFocus: TQListView
  • setAlpha: TQGLFormat
  • setAlphaBuffer: - TQImage
  • setAnchor: + TQImage
  • setAnchor: TQStyleSheetItem
  • setAngles: TQCanvasEllipse
  • setAnimated: TQCanvasItem
  • setApplyButton: @@ -2537,7 +2537,7 @@ sRect: TQGridLayout
  • setColStretch: TQGridLayout
  • setCollapsible: TQSplitter
  • setColor: - TQBrush TQCanvasText TQColorDrag TQColorGroup TQImage TQPalette TQPen TQStyleSheetItem TQTextEdit
  • setColorMode: + TQBrush TQCanvasText TQColorDrag TQColorGroup TQImage TQPalette TQPen TQStyleSheetItem TQTextEdit
  • setColorMode: TQPrinter
  • setColorSpec: TQApplication
  • setColormap: TQGLWidget
  • setColumn: @@ -2616,7 +2616,7 @@ sRect: TQToolTipGroup
  • setDepth: TQGLFormat
  • setDescending: TQSqlIndex
  • setDescription: - TQImageIO
  • setDesktopBackground: + TQImageIO
  • setDesktopBackground: TQWSServer
  • setDesktopSettingsAware: TQApplication
  • setDevice: TQDataStream TQTextStream
  • setDir: @@ -2633,8 +2633,8 @@ sRect: TQMainWindow
  • setDockWindowsMovable: TQMainWindow
  • setDocumentLocator: TQXmlContentHandler
  • setDotsPerMeterX: - TQImage
  • setDotsPerMeterY: - TQImage
  • setDoubleBuffer: + TQImage
  • setDotsPerMeterY: + TQImage
  • setDoubleBuffer: TQGLFormat
  • setDoubleBuffering: TQCanvas
  • setDoubleClickInterval: TQApplication
  • setDown: @@ -2673,7 +2673,7 @@ sRect: TQFont TQTextEdit
  • setFeature: TQXmlReader TQXmlSimpleReader
  • setFile: TQFileInfo TQUrlInfo
  • setFileName: - TQImageIO TQUrl
  • setFileNames: + TQImageIO TQUrl
  • setFileNames: TQUriDrag
  • setFilePath: TQMimeSourceFactory
  • setFilter: TQDataBrowser TQDataTable TQDir TQFileDialog TQSqlCursor
  • setFilters: @@ -2700,18 +2700,18 @@ sRect: TQStyleSheetItem
  • setFontWeight: TQStyleSheetItem
  • setForm: TQDataBrowser TQDataView
  • setFormat: - TQGLContext TQImageIO TQSyntaxHighlighter
  • setForwardOnly: + TQGLContext TQImageIO TQSyntaxHighlighter
  • setForwardOnly: TQSqlQuery TQSqlResult
  • setFrame: TQCanvasSprite TQLineEdit
  • setFrameAnimation: TQCanvasSprite
  • setFramePeriod: - TQImageConsumer
  • setFrameRect: + TQImageConsumer
  • setFrameRect: TQFrame
  • setFrameShadow: TQFrame
  • setFrameShape: TQFrame
  • setFrameStyle: TQFrame
  • setFromTo: TQPrinter
  • setFullPage: TQPrinter
  • setGamma: - TQImageIO
  • setGenerated: + TQImageIO
  • setGenerated: TQSqlCursor TQSqlFieldInfo TQSqlRecord
  • setGeometry: TQBoxLayout TQGridLayout TQLayout TQLayoutItem TQSpacerItem TQWidget TQWidgetItem
  • setGlobalMouseTracking: TQApplication
  • setGlobalStrut: @@ -2737,7 +2737,7 @@ sRect: TQSqlDatabase
  • setHour: TQTimeEdit
  • setHsv: TQColor
  • setIODevice: - TQImageIO
  • setIcon: + TQImageIO
  • setIcon: TQMessageBox TQWidget
  • setIconPixmap: TQMessageBox
  • setIconProvider: TQFileDialog
  • setIconSet: @@ -2746,7 +2746,7 @@ sRect: TQWidget
  • setId: TQMenuData
  • setIdentifier: TQTab
  • setImage: - TQCanvasPixmapArray TQClipboard TQImageDrag TQImageIO TQMimeSourceFactory
  • setInactive: + TQCanvasPixmapArray TQClipboard TQImageDrag TQImageIO TQMimeSourceFactory
  • setInactive: TQPalette
  • setIndent: TQLabel
  • setIndicator: TQProgressBar
  • setIndicatorFollowsStyle: @@ -2797,7 +2797,7 @@ sRect: TQThreadStorage
  • setLogicalFontSize: TQStyleSheetItem
  • setLogicalFontSizeStep: TQStyleSheetItem
  • setLooping: - TQImageConsumer
  • setLoops: + TQImageConsumer
  • setLoops: TQSound
  • setMainWidget: TQApplication
  • setManagerProperty: TQSessionManager
  • setMapping: @@ -2854,14 +2854,14 @@ sRect: TQSqlField TQSqlRecord
  • setNullText: TQDataTable
  • setNum: TQCString TQLabel TQString
  • setNumColors: - TQImage
  • setNumCols: + TQImage
  • setNumCols: TQGridView TQTable
  • setNumCopies: TQPrinter
  • setNumDigits: TQLCDNumber
  • setNumRows: TQGridView TQTable
  • setNumber: TQSqlError
  • setOctMode: TQLCDNumber
  • setOffset: - TQCanvasPixmap TQDockWindow TQHeader TQImage
  • setOkButton: + TQCanvasPixmap TQDockWindow TQHeader TQImage
  • setOkButton: TQTabDialog
  • setOn: TQAction TQButton TQCheckListItem TQPushButton TQToolButton
  • setOpaqueMoving: TQDockWindow TQMainWindow
  • setOpaqueResize: @@ -2892,7 +2892,7 @@ sRect: TQTextEdit
  • setPaperSource: TQPrinter
  • setParagraphBackgroundColor: TQTextEdit
  • setParameters: - TQImageIO
  • setPassword: + TQImageIO
  • setPassword: TQSqlDatabase TQUrl
  • setPath: TQDir TQSettings TQUrl
  • setPattern: TQRegExp
  • setPen: @@ -2900,7 +2900,7 @@ sRect: TQProgressBar
  • setPermissions: TQUrlInfo
  • setPicture: TQIconViewItem TQLabel
  • setPixel: - TQImage
  • setPixelAlignment: + TQImage
  • setPixelAlignment: TQPNGImagePacker
  • setPixelSize: TQFont
  • setPixmap: TQBrush TQButton TQCheckBox TQClipboard TQDragObject TQIconSet TQIconViewItem TQLabel TQListViewItem TQMimeSourceFactory TQPushButton TQRadioButton TQSplashScreen TQTable TQTableItem
  • setPixmapRect: @@ -2928,7 +2928,7 @@ sRect: TQAxBase
  • setProtocol: TQUrl
  • setProtocolDetail: TQNetworkOperation
  • setQuality: - TQImageIO
  • setQuery: + TQImageIO
  • setQuery: TQSqlResult TQUrl
  • setRadioButtonExclusive: TQButtonGroup
  • setRange: TQDateEdit TQDoubleValidator TQIntValidator TQRangeControl TQSlider TQTimeEdit
  • setRasterOp: @@ -2996,7 +2996,7 @@ sRect: TQListView
  • setShowToolTips: TQIconView TQListView
  • setShown: TQWidget
  • setSize: - TQCanvasEllipse TQCanvasRectangle TQDataTable TQImageConsumer TQRect TQUrlInfo
  • setSizeGripEnabled: + TQCanvasEllipse TQCanvasRectangle TQDataTable TQImageConsumer TQRect TQUrlInfo
  • setSizeGripEnabled: TQDialog TQStatusBar
  • setSizeIncrement: TQWidget
  • setSizeLimit: TQComboBox
  • setSizePolicy: @@ -3022,7 +3022,7 @@ sRect: TQApplication
  • setState: TQAxScriptEngine TQButton TQCheckListItem TQIODevice TQNetworkOperation
  • setStaticBackground: TQScrollView
  • setStatus: - TQIODevice TQImageIO
  • setStatusTip: + TQIODevice TQImageIO
  • setStatusTip: TQAction
  • setStencil: TQGLFormat
  • setSteps: TQRangeControl
  • setStereo: @@ -3055,7 +3055,7 @@ sRect: TQPainter
  • setTabToolTip: TQTabWidget
  • setTagName: TQDomElement
  • setText: - TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQClipboard TQIconViewItem TQImage TQLabel TQLineEdit TQListBoxItem TQListViewItem TQMessageBox TQMimeSourceFactory TQPushButton TQRadioButton TQTab TQTable TQTableItem TQTextDrag TQTextEdit
  • setTextFlags: + TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQClipboard TQIconViewItem TQImage TQLabel TQLineEdit TQListBoxItem TQListViewItem TQMessageBox TQMimeSourceFactory TQPushButton TQRadioButton TQTab TQTable TQTableItem TQTextDrag TQTextEdit
  • setTextFlags: TQCanvasText
  • setTextFormat: TQLabel TQMessageBox TQTextEdit
  • setTextLabel: TQToolButton
  • setTextPosition: @@ -3187,7 +3187,7 @@ sRect: TQTextCodec
  • simplifyWhiteSpace: TQCString TQString
  • singleShot: TQTimer
  • size: - TQAsciiCache TQAsciiDict TQBitArray TQCache TQCanvas TQCanvasRectangle TQDict TQDirectPainter TQFile TQFileInfo TQFontMetrics TQGLColormap TQIODevice TQIconViewItem TQImage TQIntCache TQIntDict TQMap TQMemArray TQPicture TQPixmap TQPtrDict TQPtrVector TQRect TQResizeEvent TQSocket TQSqlQuery TQSqlResult TQUrlInfo TQValueList TQValueVector TQWidget
  • sizeChange: + TQAsciiCache TQAsciiDict TQBitArray TQCache TQCanvas TQCanvasRectangle TQDict TQDirectPainter TQFile TQFileInfo TQFontMetrics TQGLColormap TQIODevice TQIconViewItem TQImage TQIntCache TQIntDict TQMap TQMemArray TQPicture TQPixmap TQPtrDict TQPtrVector TQRect TQResizeEvent TQSocket TQSqlQuery TQSqlResult TQUrlInfo TQValueList TQValueVector TQWidget
  • sizeChange: TQHeader
  • sizeFromContents: TQStyle
  • sizeHint: TQBoxLayout TQCanvasView TQCustomMenuItem TQGridLayout TQLayoutItem TQLineEdit TQProgressDialog TQSizeGrip TQSpacerItem TQTableItem TQWidget TQWidgetItem
  • sizeIncrement: @@ -3206,7 +3206,7 @@ sRect: TQMetaObject
  • slotUpdate: TQIconView
  • smallDecimalPoint: TQLCDNumber
  • smoothScale: - TQImage
  • smoothSizes: + TQImage
  • smoothSizes: TQFontDatabase
  • socket: TQServerSocket TQSocket TQSocketDevice TQSocketNotifier
  • socketDevice: TQServerSocket TQSocket
  • sort: @@ -3261,7 +3261,7 @@ sRect: TQCheckListItem
  • stateChanged: TQAxScript TQButton TQCheckBox TQFtp TQHttp TQPushButton TQRadioButton
  • statistics: TQAsciiCache TQAsciiDict TQCache TQDict TQIntCache TQIntDict TQPtrDict
  • status: - TQIODevice TQImageIO TQNPInstance
  • statusBar: + TQIODevice TQImageIO TQNPInstance
  • statusBar: TQMainWindow
  • statusCode: TQHttpResponseHeader
  • statusTip: TQAction
  • stayTopLevel: @@ -3312,14 +3312,14 @@ sRect: TQGLContext TQGLWidget
  • swapCells: TQTable
  • swapColumns: TQTable
  • swapRGB: - TQImage
  • swapRows: + TQImage
  • swapRows: TQTable
  • sync: TQTextEdit
  • syncX: TQApplication
  • syntaxHighlighter: TQTextEdit
  • system: TQLocale
  • systemBitOrder: - TQImage
  • systemByteOrder: - TQImage
  • systemId: + TQImage
  • systemByteOrder: + TQImage
  • systemId: TQDomDocumentType TQDomEntity TQDomNotation TQXmlParseException
  • tab: TQStyleOption TQTabBar
  • tabArray: @@ -3351,18 +3351,18 @@ tab: TQBitArray
  • testOption: TQGLFormat
  • testWFlags: TQWidget
  • text: - TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQCheckListItem TQClipboard TQColorGroup TQComboBox TQComboTableItem TQDataTable TQDomElement TQIMEvent TQIconViewItem TQImage TQKeyEvent TQLabel TQLineEdit TQListBox TQListBoxItem TQListViewItem TQMenuData TQMessageBox TQPopupMenu TQPushButton TQRadioButton TQSpinBox TQSqlError TQTab TQTable TQTableItem TQTextEdit TQWhatsThis
  • textChanged: + TQAccessibleInterface TQAction TQButton TQCanvasText TQCheckBox TQCheckListItem TQClipboard TQColorGroup TQComboBox TQComboTableItem TQDataTable TQDomElement TQIMEvent TQIconViewItem TQImage TQKeyEvent TQLabel TQLineEdit TQListBox TQListBoxItem TQListViewItem TQMenuData TQMessageBox TQPopupMenu TQPushButton TQRadioButton TQSpinBox TQSqlError TQTab TQTable TQTableItem TQTextEdit TQWhatsThis
  • textChanged: TQComboBox TQLineEdit TQSpinBox TQTextEdit
  • textCursor: TQTextEdit
  • textEdit: TQSyntaxHighlighter
  • textFlags: TQCanvasText
  • textFor: TQToolTip TQWhatsThis
  • textFormat: TQLabel TQMessageBox TQTextEdit
  • textKeys: - TQImage
  • textLabel: + TQImage
  • textLabel: TQToolButton
  • textLanguages: - TQImage
  • textLine: + TQImage
  • textLine: TQMultiLineEdit
  • textList: - TQImage
  • textPosition: + TQImage
  • textPosition: TQToolButton
  • textRect: TQIconViewItem
  • texts: TQDns
  • tickInterval: @@ -3511,7 +3511,7 @@ ucs2: TQXmlDTDHandler
  • unpause: TQMovie
  • unregisterClass: TQAxFactory
  • unregisterDecoderFactory: - TQImageDecoder
  • unregisterSocketNotifier: + TQImageDecoder
  • unregisterSocketNotifier: TQEventLoop
  • unsetCursor: TQWidget
  • unsetDevice: TQDataStream TQTextStream
  • unsetFont: @@ -3555,7 +3555,7 @@ ucs2: TQString
  • vScrollBarMode: TQScrollView
  • valid: - TQImage
  • validChunk: + TQImage
  • validChunk: TQCanvas
  • validate: TQDoubleValidator TQIntValidator TQRegExpValidator TQValidator
  • validateLicenseKey: TQAxFactory
  • validator: @@ -3610,7 +3610,7 @@ wait: TQMacStyle
  • widgetToField: TQSqlForm
  • widgets: TQWidgetFactory
  • width: - TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPen TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQTextStream TQWidget
  • widthChanged: + TQCanvas TQCanvasEllipse TQCanvasRectangle TQCanvasSprite TQDirectPainter TQFontMetrics TQIconViewItem TQImage TQListBoxItem TQListBoxPixmap TQListBoxText TQListViewItem TQPaintDeviceMetrics TQPen TQPixmap TQRect TQScreen TQSimpleRichText TQSize TQTextStream TQWidget
  • widthChanged: TQListViewItem
  • widthMM: TQPaintDeviceMetrics
  • widthUsed: TQSimpleRichText
  • wildcard: @@ -3638,7 +3638,7 @@ wait: TQTextEdit
  • wrapping: TQDial TQSpinBox
  • writable: TQMetaProperty
  • write: - TQAsciiDict TQDict TQImageIO TQIntDict TQNPInstance TQNPStream TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTranslatorMessage
  • writeBlock: + TQAsciiDict TQDict TQImageIO TQIntDict TQNPInstance TQNPStream TQPtrDict TQPtrList TQPtrQueue TQPtrStack TQPtrVector TQTranslatorMessage
  • writeBlock: TQBuffer TQIODevice TQSocket TQSocketDevice
  • writeBytes: TQDataStream
  • writeEntry: TQSettings
  • writeField: @@ -3674,7 +3674,7 @@ x: TQPaintDevice
  • x11SetAppDpiY: TQPaintDevice
  • x11Visual: TQPaintDevice
  • xForm: - TQBitmap TQImage TQPainter TQPixmap
  • xFormDev: + TQBitmap TQImage TQPainter TQPixmap
  • xFormDev: TQPainter
  • xOffset: TQDirectPainter
  • xTilt: TQTabletEvent
  • xVelocity: diff --git a/doc/html/graphics.html b/doc/html/graphics.html index dc0b78815..7b0fe30e0 100644 --- a/doc/html/graphics.html +++ b/doc/html/graphics.html @@ -68,12 +68,12 @@ coordinate system.
  • TQGLFormatThe display format of an OpenGL rendering context
    TQGLWidgetWidget for rendering OpenGL graphics
    TQIconSetSet of icons with different styles and sizes -
    TQImageHardware-independent pixmap representation with direct access to the pixel data -
    TQImageConsumerAbstraction used by TQImageDecoder -
    TQImageDecoderIncremental image decoder for all supported image formats -
    TQImageFormatIncremental image decoder for a specific image format -
    TQImageFormatTypeFactory that makes TQImageFormat objects -
    TQImageIOParameters for loading and saving images +
    TQImageHardware-independent pixmap representation with direct access to the pixel data +
    TQImageConsumerAbstraction used by TQImageDecoder +
    TQImageDecoderIncremental image decoder for all supported image formats +
    TQImageFormatIncremental image decoder for a specific image format +
    TQImageFormatTypeFactory that makes TQImageFormat objects +
    TQImageIOParameters for loading and saving images
    TQMovieIncremental loading of animations or images, signalling as it progresses
    TQPaintDeviceThe base class of objects that can be painted
    TQPaintDeviceMetricsInformation about a paint device diff --git a/doc/html/headerfilesynonyms b/doc/html/headerfilesynonyms index abd705512..a5ec23a2d 100644 --- a/doc/html/headerfilesynonyms +++ b/doc/html/headerfilesynonyms @@ -3,10 +3,10 @@ qaccessibleobject.h ntqaccessible.h qactiongroup.h ntqaction.h qasciicacheiterator.h ntqasciicache.h qasciidictiterator.h ntqasciidict.h -qimageconsumer.h ntqasyncimageio.h -qimageformat.h ntqasyncimageio.h -qimageformattype.h ntqasyncimageio.h -qimagedecoder.h ntqasyncimageio.h +tqimageconsumer.h ntqasyncimageio.h +tqimageformat.h ntqasyncimageio.h +tqimageformattype.h ntqasyncimageio.h +tqimagedecoder.h ntqasyncimageio.h qaxaggregated.h qaxbindable.h qaxscriptengine.h qaxscript.h qaxscriptmanager.h qaxscript.h @@ -52,7 +52,7 @@ tqdomentityreference.h tqdom.h tqdomprocessinginstruction.h tqdom.h qstoreddrag.h ntqdragobject.h qtextdrag.h ntqdragobject.h -qimagedrag.h ntqdragobject.h +tqimagedrag.h ntqdragobject.h quridrag.h ntqdragobject.h qcolordrag.h ntqdragobject.h qtimerevent.h ntqevent.h @@ -90,7 +90,7 @@ qiconfactory.h ntqiconset.h qicondragitem.h ntqiconview.h qicondrag.h ntqiconview.h qiconviewitem.h ntqiconview.h -qimageio.h ntqimage.h +tqimageio.h tqimage.h qintcacheiterator.h ntqintcache.h qintdictiterator.h ntqintdict.h qglayoutiterator.h ntqlayout.h diff --git a/doc/html/headers.html b/doc/html/headers.html index 529d153e5..161bf2c47 100644 --- a/doc/html/headers.html +++ b/doc/html/headers.html @@ -126,8 +126,8 @@ body { background: #ffffff; color: black; }
  • ntqhttp.h
  • ntqiconset.h
  • ntqiconview.h -
  • ntqimage.h -
  • ntqimageformatplugin.h +
  • tqimage.h +
  • tqimageformatplugin.h
  • ntqinputdialog.h
  • ntqintcache.h
  • ntqintdict.h diff --git a/doc/html/hello-example.html b/doc/html/hello-example.html index 4410cb178..6145ecbce 100644 --- a/doc/html/hello-example.html +++ b/doc/html/hello-example.html @@ -175,7 +175,7 @@ void Hello::paintEvent( p.end(); // 4: Copy the pixmap to the Hello widget - bitBlt( this, pmx, pmy, &pm ); + bitBlt( this, pmx, pmy, &pm ); } diff --git a/doc/html/hierarchy.html b/doc/html/hierarchy.html index cc6be7fa6..ade4f42f8 100644 --- a/doc/html/hierarchy.html +++ b/doc/html/hierarchy.html @@ -120,13 +120,13 @@ classes in the TQt API.
  • TQIconDragItem
  • TQIconFactory
  • TQIconSet -
  • TQImage -
  • TQImageConsumer -
  • TQImageDecoder -
  • TQImageFormat -
  • TQImageFormatPlugin -
  • TQImageFormatType -
  • TQImageIO +
  • TQImage +
  • TQImageConsumer +
  • TQImageDecoder +
  • TQImageFormat +
  • TQImageFormatPlugin +
  • TQImageFormatType +
  • TQImageIO
  • TQIntCacheIterator
  • TQIntDictIterator
  • TQIODevice @@ -328,7 +328,7 @@ classes in the TQt API.
  • TQDragObject
  • TQGLFormatThe display format of an OpenGL rendering context
    TQGLWidgetWidget for rendering OpenGL graphics
    TQIconSetSet of icons with different styles and sizes -
    TQImageHardware-independent pixmap representation with direct access to the pixel data -
    TQImageConsumerAbstraction used by TQImageDecoder -
    TQImageDecoderIncremental image decoder for all supported image formats -
    TQImageFormatIncremental image decoder for a specific image format -
    TQImageFormatTypeFactory that makes TQImageFormat objects -
    TQImageIOParameters for loading and saving images +
    TQImageHardware-independent pixmap representation with direct access to the pixel data +
    TQImageConsumerAbstraction used by TQImageDecoder +
    TQImageDecoderIncremental image decoder for all supported image formats +
    TQImageFormatIncremental image decoder for a specific image format +
    TQImageFormatTypeFactory that makes TQImageFormat objects +
    TQImageIOParameters for loading and saving images
    TQMovieIncremental loading of animations or images, signalling as it progresses
    TQPaintDeviceThe base class of objects that can be painted
    TQPaintDeviceMetricsInformation about a paint device diff --git a/doc/html/index b/doc/html/index index aa89ed74d..4703912b4 100644 --- a/doc/html/index +++ b/doc/html/index @@ -3123,136 +3123,136 @@ "QIconViewItem::x" qiconviewitem.html#x "QIconViewItem::y" qiconviewitem.html#y "QIconViewItem::~QIconViewItem" qiconviewitem.html#~QIconViewItem -"TQImage" ntqimage.html -"TQImage::Endian" ntqimage.html#Endian -"TQImage::ScaleMode" ntqimage.html#ScaleMode -"TQImage::allGray" ntqimage.html#allGray -"TQImage::bitOrder" ntqimage.html#bitOrder -"TQImage::bits" ntqimage.html#bits -"TQImage::bytesPerLine" ntqimage.html#bytesPerLine -"TQImage::color" ntqimage.html#color -"TQImage::colorTable" ntqimage.html#colorTable -"TQImage::convertBitOrder" ntqimage.html#convertBitOrder -"TQImage::convertDepth" ntqimage.html#convertDepth -"TQImage::convertDepthWithPalette" ntqimage.html#convertDepthWithPalette -"TQImage::copy" ntqimage.html#copy -"TQImage::create" ntqimage.html#create -"TQImage::createAlphaMask" ntqimage.html#createAlphaMask -"TQImage::createHeuristicMask" ntqimage.html#createHeuristicMask -"TQImage::depth" ntqimage.html#depth -"TQImage::detach" ntqimage.html#detach -"TQImage::dotsPerMeterX" ntqimage.html#dotsPerMeterX -"TQImage::dotsPerMeterY" ntqimage.html#dotsPerMeterY -"TQImage::fill" ntqimage.html#fill -"TQImage::fromMimeSource" ntqimage.html#fromMimeSource -"TQImage::hasAlphaBuffer" ntqimage.html#hasAlphaBuffer -"TQImage::height" ntqimage.html#height -"TQImage::imageFormat" ntqimage.html#imageFormat -"TQImage::inputFormatList" ntqimage.html#inputFormatList -"TQImage::inputFormats" ntqimage.html#inputFormats -"TQImage::invertPixels" ntqimage.html#invertPixels -"TQImage::isGrayscale" ntqimage.html#isGrayscale -"TQImage::isNull" ntqimage.html#isNull -"TQImage::jumpTable" ntqimage.html#jumpTable -"TQImage::load" ntqimage.html#load -"TQImage::loadFromData" ntqimage.html#loadFromData -"TQImage::mirror" ntqimage.html#mirror -"TQImage::numBytes" ntqimage.html#numBytes -"TQImage::numColors" ntqimage.html#numColors -"TQImage::offset" ntqimage.html#offset -"TQImage::operator!=" ntqimage.html#operator!-eq -"TQImage::operator=" ntqimage.html#operator-eq -"TQImage::operator==" ntqimage.html#operator-eq-eq -"TQImage::outputFormatList" ntqimage.html#outputFormatList -"TQImage::outputFormats" ntqimage.html#outputFormats -"TQImage::pixel" ntqimage.html#pixel -"TQImage::pixelIndex" ntqimage.html#pixelIndex -"TQImage::rect" ntqimage.html#rect -"TQImage::reset" ntqimage.html#reset -"TQImage::save" ntqimage.html#save -"TQImage::scale" ntqimage.html#scale -"TQImage::scaleHeight" ntqimage.html#scaleHeight -"TQImage::scaleWidth" ntqimage.html#scaleWidth -"TQImage::scanLine" ntqimage.html#scanLine -"TQImage::setAlphaBuffer" ntqimage.html#setAlphaBuffer -"TQImage::setColor" ntqimage.html#setColor -"TQImage::setDotsPerMeterX" ntqimage.html#setDotsPerMeterX -"TQImage::setDotsPerMeterY" ntqimage.html#setDotsPerMeterY -"TQImage::setNumColors" ntqimage.html#setNumColors -"TQImage::setOffset" ntqimage.html#setOffset -"TQImage::setPixel" ntqimage.html#setPixel -"TQImage::setText" ntqimage.html#setText -"TQImage::size" ntqimage.html#size -"TQImage::smoothScale" ntqimage.html#smoothScale -"TQImage::swapRGB" ntqimage.html#swapRGB -"TQImage::systemBitOrder" ntqimage.html#systemBitOrder -"TQImage::systemByteOrder" ntqimage.html#systemByteOrder -"TQImage::text" ntqimage.html#text -"TQImage::textKeys" ntqimage.html#textKeys -"TQImage::textLanguages" ntqimage.html#textLanguages -"TQImage::textList" ntqimage.html#textList -"TQImage::valid" ntqimage.html#valid -"TQImage::width" ntqimage.html#width -"TQImage::xForm" ntqimage.html#xForm -"TQImage::~TQImage" ntqimage.html#~TQImage -"QImageConsumer" qimageconsumer.html -"QImageConsumer::changed" qimageconsumer.html#changed -"QImageConsumer::end" qimageconsumer.html#end -"QImageConsumer::frameDone" qimageconsumer.html#frameDone -"QImageConsumer::setFramePeriod" qimageconsumer.html#setFramePeriod -"QImageConsumer::setLooping" qimageconsumer.html#setLooping -"QImageConsumer::setSize" qimageconsumer.html#setSize -"QImageDecoder" qimagedecoder.html -"QImageDecoder::decode" qimagedecoder.html#decode -"QImageDecoder::format" qimagedecoder.html#format -"QImageDecoder::formatName" qimagedecoder.html#formatName -"QImageDecoder::image" qimagedecoder.html#image -"QImageDecoder::inputFormats" qimagedecoder.html#inputFormats -"QImageDecoder::registerDecoderFactory" qimagedecoder.html#registerDecoderFactory -"QImageDecoder::unregisterDecoderFactory" qimagedecoder.html#unregisterDecoderFactory -"QImageDecoder::~QImageDecoder" qimagedecoder.html#~QImageDecoder -"QImageDrag" qimagedrag.html -"QImageDrag::canDecode" qimagedrag.html#canDecode -"QImageDrag::decode" qimagedrag.html#decode -"QImageDrag::setImage" qimagedrag.html#setImage -"QImageDrag::~QImageDrag" qimagedrag.html#~QImageDrag -"QImageFormat" qimageformat.html -"QImageFormat::decode" qimageformat.html#decode -"QImageFormatPlugin" ntqimageformatplugin.html -"QImageFormatPlugin::installIOHandler" ntqimageformatplugin.html#installIOHandler -"QImageFormatPlugin::keys" ntqimageformatplugin.html#keys -"QImageFormatPlugin::~QImageFormatPlugin" ntqimageformatplugin.html#~QImageFormatPlugin -"QImageFormatType" qimageformattype.html -"QImageFormatType::decoderFor" qimageformattype.html#decoderFor -"QImageFormatType::formatName" qimageformattype.html#formatName -"QImageFormatType::~QImageFormatType" qimageformattype.html#~QImageFormatType -"QImageIO" qimageio.html -"QImageIO::defineIOHandler" qimageio.html#defineIOHandler -"QImageIO::description" qimageio.html#description -"QImageIO::fileName" qimageio.html#fileName -"QImageIO::format" qimageio.html#format -"QImageIO::gamma" qimageio.html#gamma -"QImageIO::image" qimageio.html#image -"QImageIO::imageFormat" qimageio.html#imageFormat -"QImageIO::init" qimageio.html#init -"QImageIO::inputFormats" qimageio.html#inputFormats -"QImageIO::ioDevice" qimageio.html#ioDevice -"QImageIO::outputFormats" qimageio.html#outputFormats -"QImageIO::parameters" qimageio.html#parameters -"QImageIO::quality" qimageio.html#quality -"QImageIO::read" qimageio.html#read -"QImageIO::setDescription" qimageio.html#setDescription -"QImageIO::setFileName" qimageio.html#setFileName -"QImageIO::setFormat" qimageio.html#setFormat -"QImageIO::setGamma" qimageio.html#setGamma -"QImageIO::setIODevice" qimageio.html#setIODevice -"QImageIO::setImage" qimageio.html#setImage -"QImageIO::setParameters" qimageio.html#setParameters -"QImageIO::setQuality" qimageio.html#setQuality -"QImageIO::setStatus" qimageio.html#setStatus -"QImageIO::status" qimageio.html#status -"QImageIO::write" qimageio.html#write -"QImageIO::~QImageIO" qimageio.html#~QImageIO +"TQImage" tqimage.html +"TQImage::Endian" tqimage.html#Endian +"TQImage::ScaleMode" tqimage.html#ScaleMode +"TQImage::allGray" tqimage.html#allGray +"TQImage::bitOrder" tqimage.html#bitOrder +"TQImage::bits" tqimage.html#bits +"TQImage::bytesPerLine" tqimage.html#bytesPerLine +"TQImage::color" tqimage.html#color +"TQImage::colorTable" tqimage.html#colorTable +"TQImage::convertBitOrder" tqimage.html#convertBitOrder +"TQImage::convertDepth" tqimage.html#convertDepth +"TQImage::convertDepthWithPalette" tqimage.html#convertDepthWithPalette +"TQImage::copy" tqimage.html#copy +"TQImage::create" tqimage.html#create +"TQImage::createAlphaMask" tqimage.html#createAlphaMask +"TQImage::createHeuristicMask" tqimage.html#createHeuristicMask +"TQImage::depth" tqimage.html#depth +"TQImage::detach" tqimage.html#detach +"TQImage::dotsPerMeterX" tqimage.html#dotsPerMeterX +"TQImage::dotsPerMeterY" tqimage.html#dotsPerMeterY +"TQImage::fill" tqimage.html#fill +"TQImage::fromMimeSource" tqimage.html#fromMimeSource +"TQImage::hasAlphaBuffer" tqimage.html#hasAlphaBuffer +"TQImage::height" tqimage.html#height +"TQImage::imageFormat" tqimage.html#imageFormat +"TQImage::inputFormatList" tqimage.html#inputFormatList +"TQImage::inputFormats" tqimage.html#inputFormats +"TQImage::invertPixels" tqimage.html#invertPixels +"TQImage::isGrayscale" tqimage.html#isGrayscale +"TQImage::isNull" tqimage.html#isNull +"TQImage::jumpTable" tqimage.html#jumpTable +"TQImage::load" tqimage.html#load +"TQImage::loadFromData" tqimage.html#loadFromData +"TQImage::mirror" tqimage.html#mirror +"TQImage::numBytes" tqimage.html#numBytes +"TQImage::numColors" tqimage.html#numColors +"TQImage::offset" tqimage.html#offset +"TQImage::operator!=" tqimage.html#operator!-eq +"TQImage::operator=" tqimage.html#operator-eq +"TQImage::operator==" tqimage.html#operator-eq-eq +"TQImage::outputFormatList" tqimage.html#outputFormatList +"TQImage::outputFormats" tqimage.html#outputFormats +"TQImage::pixel" tqimage.html#pixel +"TQImage::pixelIndex" tqimage.html#pixelIndex +"TQImage::rect" tqimage.html#rect +"TQImage::reset" tqimage.html#reset +"TQImage::save" tqimage.html#save +"TQImage::scale" tqimage.html#scale +"TQImage::scaleHeight" tqimage.html#scaleHeight +"TQImage::scaleWidth" tqimage.html#scaleWidth +"TQImage::scanLine" tqimage.html#scanLine +"TQImage::setAlphaBuffer" tqimage.html#setAlphaBuffer +"TQImage::setColor" tqimage.html#setColor +"TQImage::setDotsPerMeterX" tqimage.html#setDotsPerMeterX +"TQImage::setDotsPerMeterY" tqimage.html#setDotsPerMeterY +"TQImage::setNumColors" tqimage.html#setNumColors +"TQImage::setOffset" tqimage.html#setOffset +"TQImage::setPixel" tqimage.html#setPixel +"TQImage::setText" tqimage.html#setText +"TQImage::size" tqimage.html#size +"TQImage::smoothScale" tqimage.html#smoothScale +"TQImage::swapRGB" tqimage.html#swapRGB +"TQImage::systemBitOrder" tqimage.html#systemBitOrder +"TQImage::systemByteOrder" tqimage.html#systemByteOrder +"TQImage::text" tqimage.html#text +"TQImage::textKeys" tqimage.html#textKeys +"TQImage::textLanguages" tqimage.html#textLanguages +"TQImage::textList" tqimage.html#textList +"TQImage::valid" tqimage.html#valid +"TQImage::width" tqimage.html#width +"TQImage::xForm" tqimage.html#xForm +"TQImage::~TQImage" tqimage.html#~TQImage +"TQImageConsumer" tqimageconsumer.html +"TQImageConsumer::changed" tqimageconsumer.html#changed +"TQImageConsumer::end" tqimageconsumer.html#end +"TQImageConsumer::frameDone" tqimageconsumer.html#frameDone +"TQImageConsumer::setFramePeriod" tqimageconsumer.html#setFramePeriod +"TQImageConsumer::setLooping" tqimageconsumer.html#setLooping +"TQImageConsumer::setSize" tqimageconsumer.html#setSize +"TQImageDecoder" tqimagedecoder.html +"TQImageDecoder::decode" tqimagedecoder.html#decode +"TQImageDecoder::format" tqimagedecoder.html#format +"TQImageDecoder::formatName" tqimagedecoder.html#formatName +"TQImageDecoder::image" tqimagedecoder.html#image +"TQImageDecoder::inputFormats" tqimagedecoder.html#inputFormats +"TQImageDecoder::registerDecoderFactory" tqimagedecoder.html#registerDecoderFactory +"TQImageDecoder::unregisterDecoderFactory" tqimagedecoder.html#unregisterDecoderFactory +"TQImageDecoder::~TQImageDecoder" tqimagedecoder.html#~TQImageDecoder +"TQImageDrag" tqimagedrag.html +"TQImageDrag::canDecode" tqimagedrag.html#canDecode +"TQImageDrag::decode" tqimagedrag.html#decode +"TQImageDrag::setImage" tqimagedrag.html#setImage +"TQImageDrag::~TQImageDrag" tqimagedrag.html#~TQImageDrag +"TQImageFormat" tqimageformat.html +"TQImageFormat::decode" tqimageformat.html#decode +"TQImageFormatPlugin" tqimageformatplugin.html +"TQImageFormatPlugin::installIOHandler" tqimageformatplugin.html#installIOHandler +"TQImageFormatPlugin::keys" tqimageformatplugin.html#keys +"TQImageFormatPlugin::~TQImageFormatPlugin" tqimageformatplugin.html#~TQImageFormatPlugin +"TQImageFormatType" tqimageformattype.html +"TQImageFormatType::decoderFor" tqimageformattype.html#decoderFor +"TQImageFormatType::formatName" tqimageformattype.html#formatName +"TQImageFormatType::~TQImageFormatType" tqimageformattype.html#~TQImageFormatType +"TQImageIO" tqimageio.html +"TQImageIO::defineIOHandler" tqimageio.html#defineIOHandler +"TQImageIO::description" tqimageio.html#description +"TQImageIO::fileName" tqimageio.html#fileName +"TQImageIO::format" tqimageio.html#format +"TQImageIO::gamma" tqimageio.html#gamma +"TQImageIO::image" tqimageio.html#image +"TQImageIO::imageFormat" tqimageio.html#imageFormat +"TQImageIO::init" tqimageio.html#init +"TQImageIO::inputFormats" tqimageio.html#inputFormats +"TQImageIO::ioDevice" tqimageio.html#ioDevice +"TQImageIO::outputFormats" tqimageio.html#outputFormats +"TQImageIO::parameters" tqimageio.html#parameters +"TQImageIO::quality" tqimageio.html#quality +"TQImageIO::read" tqimageio.html#read +"TQImageIO::setDescription" tqimageio.html#setDescription +"TQImageIO::setFileName" tqimageio.html#setFileName +"TQImageIO::setFormat" tqimageio.html#setFormat +"TQImageIO::setGamma" tqimageio.html#setGamma +"TQImageIO::setIODevice" tqimageio.html#setIODevice +"TQImageIO::setImage" tqimageio.html#setImage +"TQImageIO::setParameters" tqimageio.html#setParameters +"TQImageIO::setQuality" tqimageio.html#setQuality +"TQImageIO::setStatus" tqimageio.html#setStatus +"TQImageIO::status" tqimageio.html#status +"TQImageIO::write" tqimageio.html#write +"TQImageIO::~TQImageIO" tqimageio.html#~TQImageIO "QInputDialog" ntqinputdialog.html "QInputDialog::Type" ntqinputdialog.html#Type "QInputDialog::comboBox" ntqinputdialog.html#comboBox @@ -8255,7 +8255,7 @@ "appearance" appearance.html "application" application.html "basic" basic.html -"bitBlt" ntqimage.html#bitBlt +"bitBlt" tqimage.html#bitBlt "bitBlt" ntqpaintdevice.html#bitBlt "collection" collection.html "copyBlt" ntqpixmap.html#copyBlt @@ -8311,7 +8311,7 @@ "operator<<" ntqdockarea.html#operator-lt-lt "operator<<" tqdomnode.html#operator-lt-lt "operator<<" ntqfont.html#operator-lt-lt -"operator<<" ntqimage.html#operator-lt-lt +"operator<<" tqimage.html#operator-lt-lt "operator<<" ntqkeysequence.html#operator-lt-lt "operator<<" ntqmainwindow.html#operator-lt-lt "operator<<" tqmap.html#operator-lt-lt @@ -8355,7 +8355,7 @@ "operator>>" ntqdatetime.html#operator-gt-gt "operator>>" ntqdockarea.html#operator-gt-gt "operator>>" ntqfont.html#operator-gt-gt -"operator>>" ntqimage.html#operator-gt-gt +"operator>>" tqimage.html#operator-gt-gt "operator>>" ntqkeysequence.html#operator-gt-gt "operator>>" ntqmainwindow.html#operator-gt-gt "operator>>" tqmap.html#operator-gt-gt diff --git a/doc/html/io.html b/doc/html/io.html index 35cc7807b..758080efa 100644 --- a/doc/html/io.html +++ b/doc/html/io.html @@ -49,7 +49,7 @@ devices, processes, files etc. as well as manipulating files and directories.
    TQHttpHeaderHeader information for HTTP
    TQHttpRequestHeaderRequest header information for HTTP
    TQHttpResponseHeaderResponse header information for HTTP -
    TQImageIOParameters for loading and saving images +
    TQImageIOParameters for loading and saving images
    TQIODeviceThe base class of I/O devices
    TQLocalFsImplementation of a TQNetworkProtocol that works on the local file system
    TQMacMimeMaps open-standard MIME to Mac flavors diff --git a/doc/html/licenses.html b/doc/html/licenses.html index 0f37a03d6..3969286ab 100644 --- a/doc/html/licenses.html +++ b/doc/html/licenses.html @@ -50,7 +50,7 @@ copies and that both that copyright notice and this permission notice appear in supporting documentation. This software is provided "as is" without express or implied warranty.


    Copyright (C) 1999 Serika Kurusugawa. All rights reserved. @@ -313,7 +313,7 @@ license that technology. Such countries include Canada, Japan, the USA, France, Germany, Italy and the UK.

    GIF support may be removed completely in a future version of TQt. We recommend using the MNG or PNG format.

    diff --git a/doc/html/listboxcombo-example.html b/doc/html/listboxcombo-example.html index 3c41545a7..40829a8e2 100644 --- a/doc/html/listboxcombo-example.html +++ b/doc/html/listboxcombo-example.html @@ -97,7 +97,7 @@ protected slots: #include <ntqstring.h> #include <ntqpixmap.h> #include <ntqlabel.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpainter.h> #include <ntqstyle.h> diff --git a/doc/html/mainclasses.html b/doc/html/mainclasses.html index 7cc02d0de..9ce5c66f5 100644 --- a/doc/html/mainclasses.html +++ b/doc/html/mainclasses.html @@ -151,7 +151,7 @@ classes), see TQt's Classes.

    TQDataView -TQImage +TQImage TQPrinter diff --git a/doc/html/mdi-example.html b/doc/html/mdi-example.html index 52e941fa8..09489ad9b 100644 --- a/doc/html/mdi-example.html +++ b/doc/html/mdi-example.html @@ -135,7 +135,7 @@ private: #include "application.h" #include <ntqworkspace.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <ntqtoolbar.h> #include <ntqtoolbutton.h> diff --git a/doc/html/multimedia.html b/doc/html/multimedia.html index 4d8fcc2e7..d9b66d4dc 100644 --- a/doc/html/multimedia.html +++ b/doc/html/multimedia.html @@ -35,10 +35,10 @@ body { background: #ffffff; color: black; }

    These classes provide support for graphics, sound, animation etc.

    -
    TQImageConsumerAbstraction used by TQImageDecoder -
    TQImageDecoderIncremental image decoder for all supported image formats -
    TQImageFormatIncremental image decoder for a specific image format -
    TQImageFormatTypeFactory that makes TQImageFormat objects +
    TQImageConsumerAbstraction used by TQImageDecoder +
    TQImageDecoderIncremental image decoder for all supported image formats +
    TQImageFormatIncremental image decoder for a specific image format +
    TQImageFormatTypeFactory that makes TQImageFormat objects
    TQMovieIncremental loading of animations or images, signalling as it progresses
    TQSoundAccess to the platform audio facilities
    diff --git a/doc/html/ntqasyncio.html b/doc/html/ntqasyncio.html index f9bc8c6ca..a93b1f76e 100644 --- a/doc/html/ntqasyncio.html +++ b/doc/html/ntqasyncio.html @@ -53,7 +53,7 @@ body { background: #ffffff; color: black; }

    The TQt classes for asynchronous input/output provide a simple mechanism to allow large files or slow data sources to be processed without using large amounts of memory or blocking the user interface. -

    This facility is used in TQt to drive animated images. See TQImageConsumer. +

    This facility is used in TQt to drive animated images. See TQImageConsumer.


    Member Function Documentation

    TQAsyncIO::~TQAsyncIO () [virtual] diff --git a/doc/html/ntqbitmap.html b/doc/html/ntqbitmap.html index f0e55c2de..9566a5025 100644 --- a/doc/html/ntqbitmap.html +++ b/doc/html/ntqbitmap.html @@ -114,7 +114,7 @@ Constructs a bitmap with width w and height h and sets the contents to bits.

    The isXbitmap flag should be TRUE if bits was generated by the X11 bitmap program. The X bitmap bit order is little endian. -The TQImage documentation discusses bit order of monochrome images. +The TQImage documentation discusses bit order of monochrome images.

    Example (creates an arrow bitmap):

             uchar arrow_bits[] = { 0x3f, 0x1f, 0x0f, 0x1f, 0x3b, 0x71, 0xe0, 0xc0 };
    @@ -129,7 +129,7 @@ This is an overloaded member function, provided for convenience. It behaves esse
     bits.
     

    The isXbitmap flag should be TRUE if bits was generated by the X11 bitmap program. The X bitmap bit order is little endian. -The TQImage documentation discusses bit order of monochrome images. +The TQImage documentation discusses bit order of monochrome images.

    TQBitmap::TQBitmap ( const TQBitmap & bitmap )

    @@ -158,12 +158,12 @@ reference to this bitmap.

    Dithering will be performed if the pixmap has a TQPixmap::depth() greater than 1. -

    TQBitmap & TQBitmap::operator= ( const TQImage & image ) +

    TQBitmap & TQBitmap::operator= ( const TQImage & image )

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

    Converts the image image to a bitmap and assigns the result to this bitmap. Returns a reference to the bitmap. -

    Dithering will be performed if the image has a TQImage::depth() +

    Dithering will be performed if the image has a TQImage::depth() greater than 1.

    TQBitmap TQBitmap::xForm ( const TQWMatrix & matrix ) const diff --git a/doc/html/ntqclipboard.html b/doc/html/ntqclipboard.html index c8f1e6c81..9e91d9e04 100644 --- a/doc/html/ntqclipboard.html +++ b/doc/html/ntqclipboard.html @@ -203,7 +203,7 @@ TQClipboard::Clipboard.

    This signal is emitted when the clipboard data is changed. -

    TQImage TQClipboard::image ( Mode mode ) const +

    TQImage TQClipboard::image ( Mode mode ) const

    Returns the clipboard image, or returns a null image if the clipboard does not contain an image or if it contains an image in @@ -213,9 +213,9 @@ clipboard is used. If mode is TQClipboard::Clipboard, the image is retrieved from the global clipboard. If mode is TQClipboard::Selection, the image is retrieved from the global mouse selection. -

    See also setImage(), pixmap(), data(), and TQImage::isNull(). +

    See also setImage(), pixmap(), data(), and TQImage::isNull(). -

    TQImage TQClipboard::image () const +

    TQImage TQClipboard::image () const

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

    This function uses the TQClipboard::image() function which takes @@ -303,7 +303,7 @@ If selectionModeEnabled() returns TRUE, the mode argument is TQClipboard::Selection, otherwise the mode argument is TQClipboard::Clipboard. -

    void TQClipboard::setImage ( const TQImage & image, Mode mode ) +

    void TQClipboard::setImage ( const TQImage & image, Mode mode )

    Copies image into the clipboard.

    The mode argument is used to control which part of the system @@ -313,12 +313,12 @@ TQClipboard::Selection, the data is stored in the global mouse selection.

    This is shorthand for:

    -        setData( new TQImageDrag(image), mode )
    +        setData( new TQImageDrag(image), mode )
         

    See also image(), setPixmap(), and setData(). -

    void TQClipboard::setImage ( const TQImage & image ) +

    void TQClipboard::setImage ( const TQImage & image )

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

    This function uses the TQClipboard::setImage() function which takes @@ -332,7 +332,7 @@ TQClipboard::Clipboard.

    Copies pixmap into the clipboard. Note that this is slower than setImage() because it needs to convert the TQPixmap to a -TQImage first. +TQImage first.

    The mode argument is used to control which part of the system clipboard is used. If mode is TQClipboard::Clipboard, the pixmap is stored in the global clipboard. If mode is diff --git a/doc/html/ntqdragobject.html b/doc/html/ntqdragobject.html index 9309cadca..4c2268641 100644 --- a/doc/html/ntqdragobject.html +++ b/doc/html/ntqdragobject.html @@ -36,7 +36,7 @@ transfer. More...

    #include <ntqdragobject.h>

    Inherits TQObject and TQMimeSource. -

    Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag. +

    Inherited by TQStoredDrag, TQTextDrag, TQImageDrag, and TQIconDrag.

    List of all member functions.

    Public Members

      diff --git a/doc/html/ntqdropsite.html b/doc/html/ntqdropsite.html index 261335d65..84244c7eb 100644 --- a/doc/html/ntqdropsite.html +++ b/doc/html/ntqdropsite.html @@ -49,7 +49,7 @@ The TQDropSite class provides nothing and does nothing.

      It was used in TQt 1.x to do some drag and drop; that has since been folded into TQWidget.

      For detailed information about drag-and-drop, see the TQDragObject class. -

      See also TQDragObject, TQTextDrag, and TQImageDrag. +

      See also TQDragObject, TQTextDrag, and TQImageDrag.


      Member Function Documentation

      TQDropSite::TQDropSite ( TQWidget * self ) diff --git a/doc/html/ntqiconset.html b/doc/html/ntqiconset.html index 72672fd08..46df95e3e 100644 --- a/doc/html/ntqiconset.html +++ b/doc/html/ntqiconset.html @@ -104,7 +104,7 @@ produces results very similar to those used in Microsoft Windows 95. The Active appearance is identical to the Normal appearance unless you use setPixmap() to set it to something special. -

      When scaling icons, TQIconSet uses smooth scaling, which can partially blend the color component +

      When scaling icons, TQIconSet uses smooth scaling, which can partially blend the color component of pixmaps. If the results look poor, the best solution is to supply pixmaps in both large and small sizes.

      You can use the static function setIconSize() to set the preferred diff --git a/doc/html/ntqiconview.html b/doc/html/ntqiconview.html index b1d6f5b48..9aa536a61 100644 --- a/doc/html/ntqiconview.html +++ b/doc/html/ntqiconview.html @@ -274,7 +274,7 @@ subclass TQIconView and reimplement TQIconView::dragObject

      In this example we create a TQTextDrag object, (derived from TQDragObject), containing the item's label and return it as the drag -object. We could just as easily have created a TQImageDrag from the +object. We could just as easily have created a TQImageDrag from the item's pixmap and returned that instead.

      TQIconViews and their TQIconViewItems can also be the targets of drag and drops. To make the TQIconView itself able to accept drops connect diff --git a/doc/html/ntqimage.html b/doc/html/ntqimage.html deleted file mode 100644 index da2d76a9a..000000000 --- a/doc/html/ntqimage.html +++ /dev/null @@ -1,1117 +0,0 @@ - - - - - -TQImage Class - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      TQImage Class Reference

      - -

      The TQImage class provides a hardware-independent pixmap -representation with direct access to the pixel data. -More... -

      #include <ntqimage.h> -

      List of all member functions. -

      Public Members

      -
        -
      • enum Endian { IgnoreEndian, BigEndian, LittleEndian }
      • -
      • TQImage ()
      • -
      • TQImage ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
      • -
      • TQImage ( const TQSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
      • -
      • TQImage ( const TQString & fileName, const char * format = 0 )
      • -
      • TQImage ( const char * const xpm[] )
      • -
      • TQImage ( const TQByteArray & array )
      • -
      • TQImage ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder )
      • -
      • TQImage ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder )
      • -
      • TQImage ( const TQImage & image )
      • -
      • ~TQImage ()
      • -
      • TQImage & operator= ( const TQImage & image )
      • -
      • TQImage & operator= ( const TQPixmap & pixmap )
      • -
      • bool operator== ( const TQImage & i ) const
      • -
      • bool operator!= ( const TQImage & i ) const
      • -
      • void detach ()
      • -
      • TQImage copy () const
      • -
      • TQImage copy ( int x, int y, int w, int h, int conversion_flags = 0 ) const
      • -
      • TQImage copy ( const TQRect & r ) const
      • -
      • bool isNull () const
      • -
      • int width () const
      • -
      • int height () const
      • -
      • TQSize size () const
      • -
      • TQRect rect () const
      • -
      • int depth () const
      • -
      • int numColors () const
      • -
      • Endian bitOrder () const
      • -
      • TQRgb color ( int i ) const
      • -
      • void setColor ( int i, TQRgb c )
      • -
      • void setNumColors ( int numColors )
      • -
      • bool hasAlphaBuffer () const
      • -
      • void setAlphaBuffer ( bool enable )
      • -
      • bool allGray () const
      • -
      • bool isGrayscale () const
      • -
      • uchar * bits () const
      • -
      • uchar * scanLine ( int i ) const
      • -
      • uchar ** jumpTable () const
      • -
      • TQRgb * colorTable () const
      • -
      • int numBytes () const
      • -
      • int bytesPerLine () const
      • -
      • bool create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
      • -
      • bool create ( const TQSize &, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
      • -
      • void reset ()
      • -
      • void fill ( uint pixel )
      • -
      • void invertPixels ( bool invertAlpha = TRUE )
      • -
      • TQImage convertDepth ( int depth ) const
      • -
      • TQImage convertDepthWithPalette ( int d, TQRgb * palette, int palette_count, int conversion_flags = 0 ) const
      • -
      • TQImage convertDepth ( int depth, int conversion_flags ) const
      • -
      • TQImage convertBitOrder ( Endian bitOrder ) const
      • -
      • enum ScaleMode { ScaleFree, ScaleMin, ScaleMax }
      • -
      • TQImage smoothScale ( int w, int h, ScaleMode mode = ScaleFree ) const
      • -
      • TQImage smoothScale ( const TQSize & s, ScaleMode mode = ScaleFree ) const
      • -
      • TQImage scale ( int w, int h, ScaleMode mode = ScaleFree ) const
      • -
      • TQImage scale ( const TQSize & s, ScaleMode mode = ScaleFree ) const
      • -
      • TQImage scaleWidth ( int w ) const
      • -
      • TQImage scaleHeight ( int h ) const
      • -
      • TQImage xForm ( const TQWMatrix & matrix ) const
      • -
      • TQImage createAlphaMask ( int conversion_flags = 0 ) const
      • -
      • TQImage createHeuristicMask ( bool clipTight = TRUE ) const
      • -
      • TQImage mirror () const
      • -
      • TQImage mirror ( bool horizontal, bool vertical ) const
      • -
      • TQImage swapRGB () const
      • -
      • bool load ( const TQString & fileName, const char * format = 0 )
      • -
      • bool loadFromData ( const uchar * buf, uint len, const char * format = 0 )
      • -
      • bool loadFromData ( TQByteArray buf, const char * format = 0 )
      • -
      • bool save ( const TQString & fileName, const char * format, int quality = -1 ) const
      • -
      • bool save ( TQIODevice * device, const char * format, int quality = -1 ) const
      • -
      • bool valid ( int x, int y ) const
      • -
      • int pixelIndex ( int x, int y ) const
      • -
      • TQRgb pixel ( int x, int y ) const
      • -
      • void setPixel ( int x, int y, uint index_or_rgb )
      • -
      • int dotsPerMeterX () const
      • -
      • int dotsPerMeterY () const
      • -
      • void setDotsPerMeterX ( int x )
      • -
      • void setDotsPerMeterY ( int y )
      • -
      • TQPoint offset () const
      • -
      • void setOffset ( const TQPoint & p )
      • -
      • TQValueList<TQImageTextKeyLang> textList () const
      • -
      • TQStringList textLanguages () const
      • -
      • TQStringList textKeys () const
      • -
      • TQString text ( const char * key, const char * lang = 0 ) const
      • -
      • TQString text ( const TQImageTextKeyLang & kl ) const
      • -
      • void setText ( const char * key, const char * lang, const TQString & s )
      • -
      -

      Static Public Members

      - -

      Related Functions

      -
        -
      • TQDataStream & operator<< ( TQDataStream & s, const TQImage & image )
      • -
      • TQDataStream & operator>> ( TQDataStream & s, TQImage & image )
      • -
      • void bitBlt ( TQImage * dst, int dx, int dy, const TQImage * src, int sx, int sy, int sw, int sh, int conversion_flags )
      • -
      -

      Detailed Description

      - - -The TQImage class provides a hardware-independent pixmap -representation with direct access to the pixel data. -

      - - - -

      It is one of the two classes TQt provides for dealing with images, -the other being TQPixmap. TQImage is designed and optimized for I/O -and for direct pixel access/manipulation. TQPixmap is designed and -optimized for drawing. There are (slow) functions to convert -between TQImage and TQPixmap: TQPixmap::convertToImage() and -TQPixmap::convertFromImage(). -

      An image has the parameters width, height and depth (bits per -pixel, bpp), a color table and the actual pixels. TQImage supports 1-bpp, 8-bpp and 32-bpp image -data. 1-bpp and 8-bpp images use a color lookup table; the pixel -value is a color table index. -

      32-bpp images encode an RGB value in 24 bits and ignore the color -table. The most significant byte is used for the alpha buffer. -

      An entry in the color table is an RGB triplet encoded as a uint. Use the tqRed(), tqGreen() and tqBlue() functions (ntqcolor.h) to access the components, and tqRgb to make an RGB triplet (see the TQColor class -documentation). -

      1-bpp (monochrome) images have a color table with a most two -colors. There are two different formats: big endian (MSB first) or -little endian (LSB first) bit order. To access a single bit you -will must do some bit shifts: -

      -    TQImage image;
      -    // sets bit at (x,y) to 1
      -    if ( image.bitOrder() == TQImage::LittleEndian )
      -        *(image.scanLine(y) + (x >> 3)) |= 1 << (x & 7);
      -    else
      -        *(image.scanLine(y) + (x >> 3)) |= 1 << (7 - (x & 7));
      -    
      - -

      If this looks complicated, it might be a good idea to convert the -1-bpp image to an 8-bpp image using convertDepth(). -

      8-bpp images are much easier to work with than 1-bpp images -because they have a single byte per pixel: -

      -    TQImage image;
      -    // set entry 19 in the color table to yellow
      -    image.setColor( 19, tqRgb(255,255,0) );
      -    // set 8 bit pixel at (x,y) to value yellow (in color table)
      -    *(image.scanLine(y) + x) = 19;
      -    
      - -

      32-bpp images ignore the color table; instead, each pixel contains -the RGB triplet. 24 bits contain the RGB value; the most -significant byte is reserved for the alpha buffer. -

      -    TQImage image;
      -    // sets 32 bit pixel at (x,y) to yellow.
      -    uint *p = (uint *)image.scanLine(y) + x;
      -    *p = tqRgb(255,255,0);
      -    
      - -

      On TQt/Embedded, scanlines are aligned to the pixel depth and may -be padded to any degree, while on all other platforms, the -scanlines are 32-bit aligned for all depths. The constructor -taking a uchar* argument always expects 32-bit aligned data. -On TQt/Embedded, an additional constructor allows the number of -bytes-per-line to be specified. -

      TQImage supports a variety of methods for getting information about -the image, for example, colorTable(), allGray(), isGrayscale(), -bitOrder(), bytesPerLine(), depth(), dotsPerMeterX() and -dotsPerMeterY(), hasAlphaBuffer(), numBytes(), numColors(), and -width() and height(). -

      Pixel colors are retrieved with pixel() and set with setPixel(). -

      TQImage also supports a number of functions for creating a new -image that is a transformed version of the original. For example, -copy(), convertBitOrder(), convertDepth(), createAlphaMask(), -createHeuristicMask(), mirror(), scale(), smoothScale(), swapRGB() -and xForm(). There are also functions for changing attributes of -an image in-place, for example, setAlphaBuffer(), setColor(), -setDotsPerMeterX() and setDotsPerMeterY() and setNumColors(). -

      Images can be loaded and saved in the supported formats. Images -are saved to a file with save(). Images are loaded from a file -with load() (or in the constructor) or from an array of data with -loadFromData(). The lists of supported formats are available from -inputFormatList() and outputFormatList(). -

      Strings of text may be added to images using setText(). -

      The TQImage class uses explicit sharing, -similar to that used by TQMemArray. -

      New image formats can be added as plugins. -

      See also TQImageIO, TQPixmap, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. - -


      Member Type Documentation

      -

      TQImage::Endian

      - -

      This enum type is used to describe the endianness of the CPU and -graphics hardware. -

        -
      • TQImage::IgnoreEndian - Endianness does not matter. Useful for some -operations that are independent of endianness. -
      • TQImage::BigEndian - Network byte order, as on SPARC and Motorola CPUs. -
      • TQImage::LittleEndian - PC/Alpha byte order. -
      -

      TQImage::ScaleMode

      - -

      The functions scale() and smoothScale() use different modes for -scaling the image. The purpose of these modes is to retain the -ratio of the image if this is required. -

      -
        -
      • TQImage::ScaleFree - The image is scaled freely: the resulting image -fits exactly into the specified size; the ratio will not -necessarily be preserved. -
      • TQImage::ScaleMin - The ratio of the image is preserved and the -resulting image is guaranteed to fit into the specified size -(it is as large as possible within these constraints) - the -image might be smaller than the requested size. -
      • TQImage::ScaleMax - The ratio of the image is preserved and the -resulting image fills the whole specified rectangle (it is as -small as possible within these constraints) - the image might -be larger than the requested size. -
      -

      Member Function Documentation

      -

      TQImage::TQImage () -

      -Constructs a null image. -

      See also isNull(). - -

      TQImage::TQImage ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) -

      -Constructs an image with w width, h height, depth bits -per pixel, numColors colors and bit order bitOrder. -

      Using this constructor is the same as first constructing a null -image and then calling the create() function. -

      See also create(). - -

      TQImage::TQImage ( const TQSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) -

      -Constructs an image with size size pixels, depth depth bits, -numColors and bitOrder endianness. -

      Using this constructor is the same as first constructing a null -image and then calling the create() function. -

      See also create(). - -

      TQImage::TQImage ( const TQString & fileName, const char * format = 0 ) -

      -Constructs an image and tries to load the image from the file fileName. -

      If format is specified, the loader attempts to read the image -using the specified format. If format is not specified (which -is the default), the loader reads a few bytes from the header to -guess the file format. -

      If the loading of the image failed, this object is a null image. -

      The TQImageIO documentation lists the supported image formats and -explains how to add extra formats. -

      See also load(), isNull(), and TQImageIO. - -

      TQImage::TQImage ( const char * const xpm[] ) -

      -Constructs an image from xpm, which must be a valid XPM image. -

      Errors are silently ignored. -

      Note that it's possible to squeeze the XPM variable a little bit -by using an unusual declaration: -

      -        static const char * const start_xpm[]={
      -            "16 15 8 1",
      -            "a c #cec6bd",
      -        ....
      -    
      - -

      The extra const makes the entire definition read-only, which is -slightly more efficient (e.g. when the code is in a shared -library) and ROMable when the application is to be stored in ROM. - -

      TQImage::TQImage ( const TQByteArray & array ) -

      -Constructs an image from the binary data array. It tries to -guess the file format. -

      If the loading of the image failed, this object is a null image. -

      See also loadFromData(), isNull(), and imageFormat(). - -

      TQImage::TQImage ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder ) -

      -Constructs an image w pixels wide, h pixels high with a -color depth of depth, that uses an existing memory buffer, yourdata. The buffer must remain valid throughout the life of the -TQImage. The image does not delete the buffer at destruction. -

      If colortable is 0, a color table sufficient for numColors -will be allocated (and destructed later). -

      Note that yourdata must be 32-bit aligned. -

      The endianness is given in bitOrder. - -

      TQImage::TQImage ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder ) -

      -Constructs an image that uses an existing memory buffer. The -buffer must remain valid for the life of the TQImage. The image -does not delete the buffer at destruction. The buffer is passed as -yourdata. The image's width is w and its height is h. The -color depth is depth. bpl specifies the number of bytes per -line. -

      If colortable is 0, a color table sufficient for numColors -will be allocated (and destructed later). -

      The endianness is specified by bitOrder. -

      Warning: This constructor is only available on TQt/Embedded. - -

      TQImage::TQImage ( const TQImage & image ) -

      -Constructs a shallow copy of image. - -

      TQImage::~TQImage () -

      -Destroys the image and cleans up. - -

      bool TQImage::allGray () const -

      -Returns TRUE if all the colors in the image are shades of gray -(i.e. their red, green and blue components are equal); otherwise -returns FALSE. -

      This function is slow for large 16-bit (TQt/Embedded only) and 32-bit images. -

      See also isGrayscale(). - -

      Endian TQImage::bitOrder () const -

      - -

      Returns the bit order for the image. -

      If it is a 1-bpp image, this function returns either -TQImage::BigEndian or TQImage::LittleEndian. -

      If it is not a 1-bpp image, this function returns -TQImage::IgnoreEndian. -

      See also depth(). - -

      uchar * TQImage::bits () const -

      - -

      Returns a pointer to the first pixel data. This is equivalent to -scanLine(0). -

      See also numBytes(), scanLine(), and jumpTable(). - -

      Example: opengl/texture/gltexobj.cpp. -

      int TQImage::bytesPerLine () const -

      - -

      Returns the number of bytes per image scanline. This is equivalent -to numBytes()/height(). -

      See also numBytes() and scanLine(). - -

      TQRgb TQImage::color ( int i ) const -

      - -

      Returns the color in the color table at index i. The first -color is at index 0. -

      A color value is an RGB triplet. Use the tqRed(), tqGreen() and tqBlue() functions (defined in ntqcolor.h) to -get the color value components. -

      See also setColor(), numColors(), and TQColor. - -

      Example: themes/wood.cpp. -

      TQRgb * TQImage::colorTable () const -

      - -

      Returns a pointer to the color table. -

      See also numColors(). - -

      TQImage TQImage::convertBitOrder ( Endian bitOrder ) const -

      -Converts the bit order of the image to bitOrder and returns the -converted image. The original image is not changed. -

      Returns *this if the bitOrder is equal to the image bit -order, or a null image if this image cannot -be converted. -

      See also bitOrder(), systemBitOrder(), and isNull(). - -

      TQImage TQImage::convertDepth ( int depth, int conversion_flags ) const -

      -Converts the depth (bpp) of the image to depth and returns the -converted image. The original image is not changed. -

      The depth argument must be 1, 8, 16 (TQt/Embedded only) or 32. -

      Returns *this if depth is equal to the image depth, or a -null image if this image cannot be -converted. -

      If the image needs to be modified to fit in a lower-resolution -result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. -

      See also TQt::ImageConversionFlags, depth(), and isNull(). - -

      TQImage TQImage::convertDepth ( int depth ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      -

      TQImage TQImage::convertDepthWithPalette ( int d, TQRgb * palette, int palette_count, int conversion_flags = 0 ) const -

      -Returns an image with depth d, using the palette_count -colors pointed to by palette. If d is 1 or 8, the returned -image will have its color table ordered the same as palette. -

      If the image needs to be modified to fit in a lower-resolution -result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. -

      Note: currently no closest-color search is made. If colors are -found that are not in the palette, the palette may not be used at -all. This result should not be considered valid because it may -change in future implementations. -

      Currently inefficient for non-32-bit images. -

      See also TQt::ImageConversionFlags. - -

      TQImage TQImage::copy () const -

      -Returns a deep copy of the image. -

      See also detach(). - -

      TQImage TQImage::copy ( int x, int y, int w, int h, int conversion_flags = 0 ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Returns a deep copy of a sub-area of -the image. -

      The returned image is always w by h pixels in size, and is -copied from position x, y in this image. In areas beyond -this image pixels are filled with pixel 0. -

      If the image needs to be modified to fit in a lower-resolution -result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. -

      See also bitBlt() and TQt::ImageConversionFlags. - -

      TQImage TQImage::copy ( const TQRect & r ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Returns a deep copy of a sub-area of -the image. -

      The returned image always has the size of the rectangle r. In -areas beyond this image pixels are filled with pixel 0. - -

      bool TQImage::create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) -

      -Sets the image width, height, depth, its number of colors -(in numColors), and bit order. Returns TRUE if successful, or -FALSE if the parameters are incorrect or if memory cannot be -allocated. -

      The width and height is limited to 32767. depth must be -1, 8, or 32. If depth is 1, bitOrder must be set to -either TQImage::LittleEndian or TQImage::BigEndian. For other depths -bitOrder must be TQImage::IgnoreEndian. -

      This function allocates a color table and a buffer for the image -data. The image data is not initialized. -

      The image buffer is allocated as a single block that consists of a -table of scanline pointers (jumpTable()) -and the image data (bits()). -

      See also fill(), width(), height(), depth(), numColors(), bitOrder(), jumpTable(), scanLine(), bits(), bytesPerLine(), and numBytes(). - -

      bool TQImage::create ( const TQSize &, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      -

      TQImage TQImage::createAlphaMask ( int conversion_flags = 0 ) const -

      -Builds and returns a 1-bpp mask from the alpha buffer in this -image. Returns a null image if alpha buffer mode is disabled. -

      See TQPixmap::convertFromImage() for a description of the conversion_flags argument. -

      The returned image has little-endian bit order, which you can -convert to big-endianness using convertBitOrder(). -

      See also createHeuristicMask(), hasAlphaBuffer(), and setAlphaBuffer(). - -

      TQImage TQImage::createHeuristicMask ( bool clipTight = TRUE ) const -

      -Creates and returns a 1-bpp heuristic mask for this image. It -works by selecting a color from one of the corners, then chipping -away pixels of that color starting at all the edges. -

      The four corners vote for which color is to be masked away. In -case of a draw (this generally means that this function is not -applicable to the image), the result is arbitrary. -

      The returned image has little-endian bit order, which you can -convert to big-endianness using convertBitOrder(). -

      If clipTight is TRUE the mask is just large enough to cover the -pixels; otherwise, the mask is larger than the data pixels. -

      This function disregards the alpha buffer. -

      See also createAlphaMask(). - -

      int TQImage::depth () const -

      - -

      Returns the depth of the image. -

      The image depth is the number of bits used to encode a single -pixel, also called bits per pixel (bpp) or bit planes of an image. -

      The supported depths are 1, 8, 16 (TQt/Embedded only) and 32. -

      See also convertDepth(). - -

      void TQImage::detach () -

      -Detaches from shared image data and makes sure that this image is -the only one referring to the data. -

      If multiple images share common data, this image makes a copy of -the data and detaches itself from the sharing mechanism. -Nothing is done if there is just a single reference. -

      See also copy(). - -

      Example: themes/wood.cpp. -

      int TQImage::dotsPerMeterX () const -

      - -

      Returns the number of pixels that fit horizontally in a physical -meter. This and dotsPerMeterY() define the intended scale and -aspect ratio of the image. -

      See also setDotsPerMeterX(). - -

      int TQImage::dotsPerMeterY () const -

      - -

      Returns the number of pixels that fit vertically in a physical -meter. This and dotsPerMeterX() define the intended scale and -aspect ratio of the image. -

      See also setDotsPerMeterY(). - -

      void TQImage::fill ( uint pixel ) -

      -Fills the entire image with the pixel value pixel. -

      If the depth of this image is 1, only the -lowest bit is used. If you say fill(0), fill(2), etc., the image -is filled with 0s. If you say fill(1), fill(3), etc., the image is -filled with 1s. If the depth is 8, the lowest 8 bits are used. -

      If the depth is 32 and the image has no alpha buffer, the pixel -value is written to each pixel in the image. If the image has an -alpha buffer, only the 24 RGB bits are set and the upper 8 bits -(alpha value) are left unchanged. -

      Note: TQImage::pixel() returns the color of the pixel at the given -coordinates; TQColor::pixel() returns the pixel value of the -underlying window system (essentially an index value), so normally -you will want to use TQImage::pixel() to use a color from an -existing image or TQColor::rgb() to use a specific color. -

      See also invertPixels(), depth(), hasAlphaBuffer(), and create(). - -

      TQImage TQImage::fromMimeSource ( const TQString & abs_name ) [static] -

      Convenience function. Gets the data associated with the absolute -name abs_name from the default mime source factory and decodes it -to an image. -

      See also TQMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode(). - -

      bool TQImage::hasAlphaBuffer () const -

      - -

      Returns TRUE if alpha buffer mode is enabled; otherwise returns -FALSE. -

      See also setAlphaBuffer(). - -

      int TQImage::height () const -

      - -

      Returns the height of the image. -

      See also width(), size(), and rect(). - -

      Examples: canvas/canvas.cpp and opengl/texture/gltexobj.cpp. -

      const char * TQImage::imageFormat ( const TQString & fileName ) [static] -

      -Returns a string that specifies the image format of the file fileName, or 0 if the file cannot be read or if the format is not -recognized. -

      The TQImageIO documentation lists the guaranteed supported image -formats, or use TQImage::inputFormats() and TQImage::outputFormats() -to get lists that include the installed formats. -

      See also load() and save(). - -

      TQStringList TQImage::inputFormatList () [static] -

      -Returns a list of image formats that are supported for image -input. -

      Note that if you want to iterate over the list, you should iterate -over a copy, e.g. -

      -    TQStringList list = myImage.inputFormatList();
      -    TQStringList::Iterator it = list.begin();
      -    while( it != list.end() ) {
      -        myProcessing( *it );
      -        ++it;
      -    }
      -    
      - -

      See also outputFormatList(), inputFormats(), and TQImageIO. - -

      Example: showimg/showimg.cpp. -

      TQStrList TQImage::inputFormats () [static] -

      -Returns a list of image formats that are supported for image -input. -

      See also outputFormats(), inputFormatList(), and TQImageIO. - -

      void TQImage::invertPixels ( bool invertAlpha = TRUE ) -

      -Inverts all pixel values in the image. -

      If the depth is 32: if invertAlpha is TRUE, the alpha bits are -also inverted, otherwise they are left unchanged. -

      If the depth is not 32, the argument invertAlpha has no -meaning. -

      Note that inverting an 8-bit image means to replace all pixels -using color index i with a pixel using color index 255 minus i. Similarly for a 1-bit image. The color table is not changed. -

      See also fill(), depth(), and hasAlphaBuffer(). - -

      bool TQImage::isGrayscale () const -

      -For 16-bit (TQt/Embedded only) and 32-bit images, this function is -equivalent to allGray(). -

      For 8-bpp images, this function returns TRUE if color(i) is -TQRgb(i,i,i) for all indices of the color table; otherwise returns -FALSE. -

      See also allGray() and depth(). - -

      bool TQImage::isNull () const -

      - -

      Returns TRUE if it is a null image; otherwise returns FALSE. -

      A null image has all parameters set to zero and no allocated data. - -

      Example: showimg/showimg.cpp. -

      uchar ** TQImage::jumpTable () const -

      - -

      Returns a pointer to the scanline pointer table. -

      This is the beginning of the data block for the image. -

      See also bits() and scanLine(). - -

      bool TQImage::load ( const TQString & fileName, const char * format = 0 ) -

      -Loads an image from the file fileName. Returns TRUE if the -image was successfully loaded; otherwise returns FALSE. -

      If format is specified, the loader attempts to read the image -using the specified format. If format is not specified (which -is the default), the loader reads a few bytes from the header to -guess the file format. -

      The TQImageIO documentation lists the supported image formats and -explains how to add extra formats. -

      See also loadFromData(), save(), imageFormat(), TQPixmap::load(), and TQImageIO. - -

      bool TQImage::loadFromData ( const uchar * buf, uint len, const char * format = 0 ) -

      -Loads an image from the first len bytes of binary data in buf. Returns TRUE if the image was successfully loaded; otherwise -returns FALSE. -

      If format is specified, the loader attempts to read the image -using the specified format. If format is not specified (which -is the default), the loader reads a few bytes from the header to -guess the file format. -

      The TQImageIO documentation lists the supported image formats and -explains how to add extra formats. -

      See also load(), save(), imageFormat(), TQPixmap::loadFromData(), and TQImageIO. - -

      bool TQImage::loadFromData ( TQByteArray buf, const char * format = 0 ) -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Loads an image from the TQByteArray buf. - -

      TQImage TQImage::mirror () const -

      -Returns a TQImage which is a vertically mirrored copy of this -image. The original TQImage is not changed. - -

      TQImage TQImage::mirror ( bool horizontal, bool vertical ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Returns a mirror of the image, mirrored in the horizontal and/or -the vertical direction depending on whether horizontal and vertical are set to TRUE or FALSE. The original image is not -changed. -

      See also smoothScale(). - -

      int TQImage::numBytes () const -

      - -

      Returns the number of bytes occupied by the image data. -

      See also bytesPerLine() and bits(). - -

      int TQImage::numColors () const -

      - -

      Returns the size of the color table for the image. -

      Notice that numColors() returns 0 for 16-bpp (TQt/Embedded only) -and 32-bpp images because these images do not use color tables, -but instead encode pixel values as RGB triplets. -

      See also setNumColors() and colorTable(). - -

      Example: themes/wood.cpp. -

      TQPoint TQImage::offset () const -

      - -

      Returns the number of pixels by which the image is intended to be -offset by when positioning relative to other images. - -

      bool TQImage::operator!= ( const TQImage & i ) const -

      -Returns TRUE if this image and image i have different contents; -otherwise returns FALSE. The comparison can be slow, unless there -is some obvious difference, such as different widths, in which -case the function will return quickly. -

      See also operator=(). - -

      TQImage & TQImage::operator= ( const TQImage & image ) -

      -Assigns a shallow copy of image to -this image and returns a reference to this image. -

      See also copy(). - -

      TQImage & TQImage::operator= ( const TQPixmap & pixmap ) -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Sets the image bits to the pixmap contents and returns a -reference to the image. -

      If the image shares data with other images, it will first -dereference the shared data. -

      Makes a call to TQPixmap::convertToImage(). - -

      bool TQImage::operator== ( const TQImage & i ) const -

      -Returns TRUE if this image and image i have the same contents; -otherwise returns FALSE. The comparison can be slow, unless there -is some obvious difference, such as different widths, in which -case the function will return quickly. -

      See also operator=(). - -

      TQStringList TQImage::outputFormatList () [static] -

      -Returns a list of image formats that are supported for image -output. -

      Note that if you want to iterate over the list, you should iterate -over a copy, e.g. -

      -    TQStringList list = myImage.outputFormatList();
      -    TQStringList::Iterator it = list.begin();
      -    while( it != list.end() ) {
      -        myProcessing( *it );
      -        ++it;
      -    }
      -    
      - -

      See also inputFormatList(), outputFormats(), and TQImageIO. - -

      TQStrList TQImage::outputFormats () [static] -

      -Returns a list of image formats that are supported for image -output. -

      See also inputFormats(), outputFormatList(), and TQImageIO. - -

      Example: showimg/showimg.cpp. -

      TQRgb TQImage::pixel ( int x, int y ) const -

      -Returns the color of the pixel at the coordinates (x, y). -

      If (x, y) is not on the image, the -results are undefined. -

      See also setPixel(), tqRed(), tqGreen(), tqBlue(), and valid(). - -

      Examples: canvas/canvas.cpp and qmag/qmag.cpp. -

      int TQImage::pixelIndex ( int x, int y ) const -

      -Returns the pixel index at the given coordinates. -

      If (x, y) is not valid, or if the -image is not a paletted image (depth() > 8), the results are -undefined. -

      See also valid() and depth(). - -

      TQRect TQImage::rect () const -

      - -

      Returns the enclosing rectangle (0, 0, width(), height()) of the -image. -

      See also width(), height(), and size(). - -

      void TQImage::reset () -

      -Resets all image parameters and deallocates the image data. - -

      bool TQImage::save ( const TQString & fileName, const char * format, int quality = -1 ) const -

      -Saves the image to the file fileName, using the image file -format format and a quality factor of quality. quality -must be in the range 0..100 or -1. Specify 0 to obtain small -compressed files, 100 for large uncompressed files, and -1 (the -default) to use the default settings. -

      Returns TRUE if the image was successfully saved; otherwise -returns FALSE. -

      See also load(), loadFromData(), imageFormat(), TQPixmap::save(), and TQImageIO. - -

      bool TQImage::save ( TQIODevice * device, const char * format, int quality = -1 ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      This function writes a TQImage to the TQIODevice, device. This -can be used, for example, to save an image directly into a -TQByteArray: -

      -    TQImage image;
      -    TQByteArray ba;
      -    TQBuffer buffer( ba );
      -    buffer.open( IO_WriteOnly );
      -    image.save( &buffer, "PNG" ); // writes image into ba in PNG format
      -    
      - - -

      TQImage TQImage::scale ( int w, int h, ScaleMode mode = ScaleFree ) const -

      -Returns a copy of the image scaled to a rectangle of width w -and height h according to the ScaleMode mode. -

        -
      • If mode is ScaleFree, the image is scaled to (w, -h). -
      • If mode is ScaleMin, the image is scaled to a rectangle -as large as possible inside (w, h), preserving the aspect -ratio. -
      • If mode is ScaleMax, the image is scaled to a rectangle -as small as possible outside (w, h), preserving the aspect -ratio. -
      -

      If either the width w or the height h is 0 or negative, this -function returns a null image. -

      This function uses a simple, fast algorithm. If you need better -quality, use smoothScale() instead. -

      See also scaleWidth(), scaleHeight(), smoothScale(), and xForm(). - -

      TQImage TQImage::scale ( const TQSize & s, ScaleMode mode = ScaleFree ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      The requested size of the image is s. - -

      TQImage TQImage::scaleHeight ( int h ) const -

      -Returns a scaled copy of the image. The returned image has a -height of h pixels. This function automatically calculates the -width of the image so that the ratio of the image is preserved. -

      If h is 0 or negative a null image is -returned. -

      See also scale(), scaleWidth(), smoothScale(), and xForm(). - -

      Example: table/small-table-demo/main.cpp. -

      TQImage TQImage::scaleWidth ( int w ) const -

      -Returns a scaled copy of the image. The returned image has a width -of w pixels. This function automatically calculates the height -of the image so that the ratio of the image is preserved. -

      If w is 0 or negative a null image is -returned. -

      See also scale(), scaleHeight(), smoothScale(), and xForm(). - -

      uchar * TQImage::scanLine ( int i ) const -

      - -

      Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0. -

      The scanline data is aligned on a 32-bit boundary. -

      Warning: If you are accessing 32-bpp image data, cast the returned -pointer to TQRgb* (TQRgb has a 32-bit size) and use it to -read/write the pixel value. You cannot use the uchar* pointer -directly, because the pixel format depends on the byte order on -the underlying platform. Hint: use tqRed(), -tqGreen() and tqBlue(), etc. (ntqcolor.h) to access the pixels. -

      Warning: If you are accessing 16-bpp image data, you must handle -endianness yourself. (TQt/Embedded only) -

      See also bytesPerLine(), bits(), and jumpTable(). - -

      Example: desktop/desktop.cpp. -

      void TQImage::setAlphaBuffer ( bool enable ) -

      -Enables alpha buffer mode if enable is TRUE, otherwise disables -it. The default setting is disabled. -

      An 8-bpp image has 8-bit pixels. A pixel is an index into the -color table, which contains 32-bit color -values. In a 32-bpp image, the 32-bit pixels are the color values. -

      This 32-bit value is encoded as follows: The lower 24 bits are -used for the red, green, and blue components. The upper 8 bits -contain the alpha component. -

      The alpha component specifies the transparency of a pixel. 0 means -completely transparent and 255 means opaque. The alpha component -is ignored if you do not enable alpha buffer mode. -

      The alpha buffer is used to set a mask when a TQImage is translated -to a TQPixmap. -

      See also hasAlphaBuffer() and createAlphaMask(). - -

      void TQImage::setColor ( int i, TQRgb c ) -

      - -

      Sets a color in the color table at index i to c. -

      A color value is an RGB triplet. Use the tqRgb() function (defined in ntqcolor.h) to make RGB -triplets. -

      See also color(), setNumColors(), and numColors(). - -

      Examples: desktop/desktop.cpp and themes/wood.cpp. -

      void TQImage::setDotsPerMeterX ( int x ) -

      -Sets the value returned by dotsPerMeterX() to x. - -

      void TQImage::setDotsPerMeterY ( int y ) -

      -Sets the value returned by dotsPerMeterY() to y. - -

      void TQImage::setNumColors ( int numColors ) -

      -Resizes the color table to numColors colors. -

      If the color table is expanded all the extra colors will be set to -black (RGB 0,0,0). -

      See also numColors(), color(), setColor(), and colorTable(). - -

      void TQImage::setOffset ( const TQPoint & p ) -

      -Sets the value returned by offset() to p. - -

      void TQImage::setPixel ( int x, int y, uint index_or_rgb ) -

      -Sets the pixel index or color at the coordinates (x, y) to -index_or_rgb. -

      If (x, y) is not valid, the result is -undefined. -

      If the image is a paletted image (depth() <= 8) and index_or_rgb >= numColors(), the result is undefined. -

      See also pixelIndex(), pixel(), tqRgb(), tqRgba(), and valid(). - -

      void TQImage::setText ( const char * key, const char * lang, const TQString & s ) -

      -Records string s for the keyword key. The key should be a -portable keyword recognizable by other software - some suggested -values can be found in the PNG specification. s can be any text. lang -should specify the language code (see -RFC 1766) or 0. - -

      TQSize TQImage::size () const -

      - -

      Returns the size of the image, i.e. its width and height. -

      See also width(), height(), and rect(). - -

      TQImage TQImage::smoothScale ( int w, int h, ScaleMode mode = ScaleFree ) const -

      -Returns a smoothly scaled copy of the image. The returned image -has a size of width w by height h pixels if mode is ScaleFree. The modes ScaleMin and ScaleMax may be used to -preserve the ratio of the image: if mode is ScaleMin, the -returned image is guaranteed to fit into the rectangle specified -by w and h (it is as large as possible within the -constraints); if mode is ScaleMax, the returned image fits -at least into the specified rectangle (it is a small as possible -within the constraints). -

      For 32-bpp images and 1-bpp/8-bpp color images the result will be -32-bpp, whereas all-gray images -(including black-and-white 1-bpp) will produce 8-bit grayscale images with the palette spanning -256 grays from black to white. -

      This function uses code based on pnmscale.c by Jef Poskanzer. -

      pnmscale.c - read a portable anymap and scale it -

      -

      Copyright (C) 1989, 1991 by Jef Poskanzer. -

      Permission to use, copy, modify, and distribute this software and -its documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appear in all -copies and that both that copyright notice and this permission -notice appear in supporting documentation. This software is -provided "as is" without express or implied warranty. -

      See also scale() and mirror(). - -

      TQImage TQImage::smoothScale ( const TQSize & s, ScaleMode mode = ScaleFree ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      The requested size of the image is s. - -

      TQImage TQImage::swapRGB () const -

      -Returns a TQImage in which the values of the red and blue -components of all pixels have been swapped, effectively converting -an RGB image to a BGR image. The original TQImage is not changed. - -

      Endian TQImage::systemBitOrder () [static] -

      -Determines the bit order of the display hardware. Returns -TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). -

      See also systemByteOrder(). - -

      Endian TQImage::systemByteOrder () [static] -

      -Determines the host computer byte order. Returns -TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). -

      See also systemBitOrder(). - -

      TQString TQImage::text ( const char * key, const char * lang = 0 ) const -

      -Returns the string recorded for the keyword key in language lang, or in a default language if lang is 0. - -

      TQString TQImage::text ( const TQImageTextKeyLang & kl ) const -

      -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

      Returns the string recorded for the keyword and language kl. - -

      TQStringList TQImage::textKeys () const -

      -Returns the keywords for which some texts are recorded. -

      Note that if you want to iterate over the list, you should iterate -over a copy, e.g. -

      -    TQStringList list = myImage.textKeys();
      -    TQStringList::Iterator it = list.begin();
      -    while( it != list.end() ) {
      -        myProcessing( *it );
      -        ++it;
      -    }
      -    
      - -

      See also textList(), text(), setText(), and textLanguages(). - -

      TQStringList TQImage::textLanguages () const -

      -Returns the language identifiers for which some texts are -recorded. -

      Note that if you want to iterate over the list, you should iterate -over a copy, e.g. -

      -    TQStringList list = myImage.textLanguages();
      -    TQStringList::Iterator it = list.begin();
      -    while( it != list.end() ) {
      -        myProcessing( *it );
      -        ++it;
      -    }
      -    
      - -

      See also textList(), text(), setText(), and textKeys(). - -

      TQValueList<TQImageTextKeyLang> TQImage::textList () const -

      -Returns a list of TQImageTextKeyLang objects that enumerate all the -texts key/language pairs set by setText() for this image. -

      Note that if you want to iterate over the list, you should iterate -over a copy, e.g. -

      -    TQValueList<TQImageTextKeyLang> list = myImage.textList();
      -    TQValueList<TQImageTextKeyLang>::Iterator it = list.begin();
      -    while( it != list.end() ) {
      -        myProcessing( *it );
      -        ++it;
      -    }
      -    
      - - -

      bool TQImage::valid ( int x, int y ) const -

      -Returns TRUE if ( x, y ) is a valid coordinate in the image; -otherwise returns FALSE. -

      See also width(), height(), and pixelIndex(). - -

      Examples: canvas/canvas.cpp and qmag/qmag.cpp. -

      int TQImage::width () const -

      - -

      Returns the width of the image. -

      See also height(), size(), and rect(). - -

      Examples: canvas/canvas.cpp and opengl/texture/gltexobj.cpp. -

      TQImage TQImage::xForm ( const TQWMatrix & matrix ) const -

      -Returns a copy of the image that is transformed using the -transformation matrix, matrix. -

      The transformation matrix is internally adjusted to compensate -for unwanted translation, i.e. xForm() returns the smallest image -that contains all the transformed points of the original image. -

      See also scale(), TQPixmap::xForm(), TQPixmap::trueMatrix(), and TQWMatrix. - -


      Related Functions

      -

      void bitBlt ( TQImage * dst, int dx, int dy, const TQImage * src, int sx, int sy, int sw, int sh, int conversion_flags ) -

      - -

      Copies a block of pixels from src to dst. The pixels -copied from source (src) are converted according to -conversion_flags if it is incompatible with the destination -(dst). -

      sx, sy is the top-left pixel in src, dx, dy -is the top-left position in dst and sw, \sh is the -size of the copied block. -

      The copying is clipped if areas outside src or dst are -specified. -

      If sw is -1, it is adjusted to src->width(). Similarly, if sh is -1, it is adjusted to src->height(). -

      Currently inefficient for non 32-bit images. - -

      TQDataStream & operator<< ( TQDataStream & s, const TQImage & image ) -

      - -

      Writes the image image to the stream s as a PNG image, or as a -BMP image if the stream's version is 1. -

      Note that writing the stream to a file will not produce a valid image file. -

      See also TQImage::save() and Format of the TQDataStream operators. - -

      TQDataStream & operator>> ( TQDataStream & s, TQImage & image ) -

      - -

      Reads an image from the stream s and stores it in image. -

      See also TQImage::load() and Format of the TQDataStream operators. - - -


      -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/ntqimageformatplugin.html b/doc/html/ntqimageformatplugin.html deleted file mode 100644 index ebc4e0745..000000000 --- a/doc/html/ntqimageformatplugin.html +++ /dev/null @@ -1,94 +0,0 @@ - - - - - -TQImageFormatPlugin Class - - - - - - - -
      - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

      TQImageFormatPlugin Class Reference

      - -

      The TQImageFormatPlugin class provides an abstract base for custom image format plugins. -More... -

      #include <ntqimageformatplugin.h> -

      List of all member functions. -

      Public Members

      - -

      Detailed Description

      - - -The TQImageFormatPlugin class provides an abstract base for custom image format plugins. -

      -

      The image format plugin is a simple plugin interface that makes -it easy to create custom image formats that can be used -transparently by applications. -

      Writing an image format plugin is achieved by subclassing this -base class, reimplementing the pure virtual functions keys() and -installIOHandler(), and exporting the class with the -TQ_EXPORT_PLUGIN macro. See the Plugins - documentation for details. -

      See also Plugins. - -


      Member Function Documentation

      -

      TQImageFormatPlugin::TQImageFormatPlugin () -

      -Constructs an image format plugin. This is invoked automatically -by the TQ_EXPORT_PLUGIN macro. - -

      TQImageFormatPlugin::~TQImageFormatPlugin () -

      -Destroys the image format plugin. -

      You never have to call this explicitly. TQt destroys a plugin -automatically when it is no longer used. - -

      bool TQImageFormatPlugin::installIOHandler ( const TQString & format ) [pure virtual] -

      - -

      Installs a TQImageIO image I/O handler for the image format format. -

      See also keys(). - -

      TQStringList TQImageFormatPlugin::keys () const [pure virtual] -

      - -

      Returns the list of image formats this plugin supports. -

      See also installIOHandler(). - - -


      -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


      - -
      Copyright © 2007 -TrolltechTrademarks -
      TQt 3.3.8
      -
      - diff --git a/doc/html/ntqmovie.html b/doc/html/ntqmovie.html index 7564b9ef2..96545a8c8 100644 --- a/doc/html/ntqmovie.html +++ b/doc/html/ntqmovie.html @@ -260,9 +260,9 @@ Returns TRUE if the image is no longer playing: this happens when all loops of all frames are complete; otherwise returns FALSE.

      Example: movies/main.cpp. -

      const TQImage & TQMovie::frameImage () const +

      const TQImage & TQMovie::frameImage () const

      -Returns the current frame of the movie, as a TQImage. It is not +Returns the current frame of the movie, as a TQImage. It is not generally useful to keep a copy of this image. Also note that you must not call this function if the movie is finished(), since by then the image will not be available. diff --git a/doc/html/ntqpainter.html b/doc/html/ntqpainter.html index 32eea73d3..76f1b3e59 100644 --- a/doc/html/ntqpainter.html +++ b/doc/html/ntqpainter.html @@ -454,7 +454,7 @@ font etc. This function does exactly that. p.begin(&pm, this); // ... potentially flickering paint operation ... p.end(); - bitBlt(this, 0, 0, &pm); + bitBlt(this, 0, 0, &pm); } @@ -606,7 +606,7 @@ Draws an ellipse with center at (x + w/2, y + h/2) and size (w, h)< This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

      Draws the ellipse that fits inside rectangle r. -

      void TQPainter::drawImage ( int x, int y, const TQImage & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 ) +

      void TQPainter::drawImage ( int x, int y, const TQImage & image, int sx = 0, int sy = 0, int sw = -1, int sh = -1, int conversionFlags = 0 )

      Draws at (x, y) the sw by sh area of pixels from (sx, sy) in image, using conversionFlags if the image needs to be converted to a pixmap. The default value for conversionFlags is 0; see convertFromImage() for information about @@ -618,12 +618,12 @@ if device() is a TQPrinter or drawPixmap() and TQPixmap::convertFromImage().

      Example: canvas/canvas.cpp. -

      void TQPainter::drawImage ( const TQPoint &, const TQImage &, const TQRect & sr, int conversionFlags = 0 ) +

      void TQPainter::drawImage ( const TQPoint &, const TQImage &, const TQRect & sr, int conversionFlags = 0 )

      This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

      Draws the rectangle sr from the image at the given point. -

      void TQPainter::drawImage ( const TQPoint & p, const TQImage & i, int conversion_flags = 0 ) +

      void TQPainter::drawImage ( const TQPoint & p, const TQImage & i, int conversion_flags = 0 )

      This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

      Draws the image i at point p. @@ -631,7 +631,7 @@ This is an overloaded member function, provided for convenience. It behaves esse result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen.

      See also TQt::ImageConversionFlags. -

      void TQPainter::drawImage ( const TQRect & r, const TQImage & i ) +

      void TQPainter::drawImage ( const TQRect & r, const TQImage & i )

      This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

      Draws the image i into the rectangle r. The image will be @@ -710,7 +710,7 @@ The default, (-1, -1), means all the way to the bottom right of the pixmap.

      Currently the mask of the pixmap or it's alpha channel are ignored when painting on a TQPrinter. -

      See also bitBlt() and TQPixmap::setMask(). +

      See also bitBlt() and TQPixmap::setMask().

      Examples: grapher/grapher.cpp, picture/picture.cpp, qdir/qdir.cpp, qmag/qmag.cpp, showimg/showimg.cpp, t10/cannon.cpp, and xform/xform.cpp.

      void TQPainter::drawPixmap ( const TQPoint & p, const TQPixmap & pm, const TQRect & sr ) diff --git a/doc/html/ntqpixmap.html b/doc/html/ntqpixmap.html index 85e6e1910..f7bfa60fe 100644 --- a/doc/html/ntqpixmap.html +++ b/doc/html/ntqpixmap.html @@ -118,7 +118,7 @@ The TQPixmap class is an off-screen, pixel-based paint device.

      TQPixmap is one of the two classes TQt provides for dealing with -images; the other is TQImage. TQPixmap is designed and optimized +images; the other is TQImage. TQPixmap is designed and optimized for drawing; TQImage is designed and optimized for I/O and for direct pixel access/manipulation. There are (slow) functions to convert between TQImage and TQPixmap: convertToImage() and @@ -177,13 +177,13 @@ this:

      In general it is recommended to make as much use of TQPixmap's implicit sharing and the TQPixmapCache as possible. -

      See also TQBitmap, TQImage, TQImageIO, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. +

      See also TQBitmap, TQImage, TQImageIO, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.


      Member Type Documentation

      TQPixmap::ColorMode

      This enum type defines the color modes that exist for converting -TQImage objects to TQPixmap. +TQImage objects to TQPixmap.

      • TQPixmap::Auto - Select Color or Mono on a case-by-case basis.
      • TQPixmap::Color - Always create colored pixmaps. @@ -219,9 +219,9 @@ than NormalOptim and may provide a little more Constructs a null pixmap.

        See also isNull(). -

        TQPixmap::TQPixmap ( const TQImage & image ) +

        TQPixmap::TQPixmap ( const TQImage & image )

        -Constructs a pixmap from the TQImage image. +Constructs a pixmap from the TQImage image.

        See also convertFromImage().

        TQPixmap::TQPixmap ( int w, int h, int depth = -1, Optimization optimization = DefaultOptim ) @@ -307,7 +307,7 @@ This constructor is protected and used by the TQBitmap<

        Destroys the pixmap. -

        bool TQPixmap::convertFromImage ( const TQImage & img, int conversion_flags ) +

        bool TQPixmap::convertFromImage ( const TQImage & img, int conversion_flags )

        Converts image img and sets this pixmap. Returns TRUE if successful; otherwise returns FALSE. @@ -320,19 +320,19 @@ sets all the default options. converted to an image, the pixels painted with color0 will produce pixel index 0 in the image and those painted with color1 will produce pixel index 1. -

        See also convertToImage(), isTQBitmap(), TQImage::convertDepth(), defaultDepth(), and TQImage::hasAlphaBuffer(). +

        See also convertToImage(), isTQBitmap(), TQImage::convertDepth(), defaultDepth(), and TQImage::hasAlphaBuffer().

        Examples: canvas/canvas.cpp and themes/wood.cpp. -

        bool TQPixmap::convertFromImage ( const TQImage & image, ColorMode mode = Auto ) +

        bool TQPixmap::convertFromImage ( const TQImage & image, ColorMode mode = Auto )

        This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

        Converts image and sets this pixmap using color mode mode. Returns TRUE if successful; otherwise returns FALSE.

        See also TQPixmap::ColorMode. -

        TQImage TQPixmap::convertToImage () const +

        TQImage TQPixmap::convertToImage () const

        -Converts the pixmap to a TQImage. Returns a null image if it fails. +Converts the pixmap to a TQImage. Returns a null image if it fails.

        If the pixmap has 1-bit depth, the returned image will also be 1 bit deep. If the pixmap has 2- to 8-bit depth, the returned image has 8-bit depth. If the pixmap has greater than 8-bit depth, the @@ -354,11 +354,11 @@ can do things such as the following:

        This function is slow because it involves transformation to a -TQImage, non-trivial computations and a transformation back to a +TQImage, non-trivial computations and a transformation back to a TQBitmap.

        If clipTight is TRUE the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels. -

        See also TQImage::createHeuristicMask(). +

        See also TQImage::createHeuristicMask().

        int TQPixmap::defaultDepth () [static]

        @@ -377,7 +377,7 @@ Returns the default pixmap optimization setting.

        Returns the depth of the pixmap.

        The pixmap depth is also called bits per pixel (bpp) or bit planes of a pixmap. A null pixmap has depth 0. -

        See also defaultDepth(), isNull(), and TQImage::convertDepth(). +

        See also defaultDepth(), isNull(), and TQImage::convertDepth().

        void TQPixmap::detach () [virtual]

        @@ -444,7 +444,7 @@ color of the widget. Convenience function. Gets the data associated with the absolute name abs_name from the default mime source factory and decodes it to a pixmap. -

        See also TQMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode(). +

        See also TQMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode().

        Example: textedit/textedit.cpp.

        TQPixmap TQPixmap::grabWidget ( TQWidget * widget, int x = 0, int y = 0, int w = -1, int h = -1 ) [static] @@ -525,7 +525,7 @@ function returns FALSE.

        Returns a string that specifies the image format of the file fileName, or 0 if the file cannot be read or if the format cannot be recognized. -

        The TQImageIO documentation lists the supported image formats. +

        The TQImageIO documentation lists the supported image formats.

        See also load() and save().

        bool TQPixmap::isNull () const @@ -554,9 +554,9 @@ using the specified format. If format is not specified the file's format.

        See the convertFromImage() documentation for a description of the conversion_flags argument. -

        The TQImageIO documentation lists the supported image formats and +

        The TQImageIO documentation lists the supported image formats and explains how to add extra formats. -

        See also loadFromData(), save(), imageFormat(), TQImage::load(), and TQImageIO. +

        See also loadFromData(), save(), imageFormat(), TQImage::load(), and TQImageIO.

        Examples: picture/picture.cpp, scrollview/scrollview.cpp, and xform/xform.cpp.

        bool TQPixmap::load ( const TQString & fileName, const char * format = 0, ColorMode mode = Auto ) @@ -580,9 +580,9 @@ using the specified format. If format is not specified the file's format.

        See the convertFromImage() documentation for a description of the conversion_flags argument. -

        The TQImageIO documentation lists the supported image formats and +

        The TQImageIO documentation lists the supported image formats and explains how to add extra formats. -

        See also load(), save(), imageFormat(), TQImage::loadFromData(), and TQImageIO. +

        See also load(), save(), imageFormat(), TQImage::loadFromData(), and TQImageIO.

        bool TQPixmap::loadFromData ( const uchar * buf, uint len, const char * format = 0, ColorMode mode = Auto )

        @@ -617,7 +617,7 @@ Internal implementation of the virtual TQPaintDevice::metric() function. Assigns the pixmap pixmap to this pixmap and returns a reference to this pixmap. -

        TQPixmap & TQPixmap::operator= ( const TQImage & image ) +

        TQPixmap & TQPixmap::operator= ( const TQImage & image )

        This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

        Converts the image image to a pixmap that is assigned to this @@ -666,7 +666,7 @@ be in the range [0,100] or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings. Returns TRUE if successful; otherwise returns FALSE. -

        See also load(), loadFromData(), imageFormat(), TQImage::save(), and TQImageIO. +

        See also load(), loadFromData(), imageFormat(), TQImage::save(), and TQImageIO.

        Example: qmag/qmag.cpp.

        bool TQPixmap::save ( TQIODevice * device, const char * format, int quality = -1 ) const @@ -777,9 +777,9 @@ The original pixmap is not changed. for unwanted translation, i.e. xForm() returns the smallest image that contains all the transformed points of the original image.

        This function is slow because it involves transformation to a -TQImage, non-trivial computations and a transformation back to a +TQImage, non-trivial computations and a transformation back to a TQPixmap. -

        See also trueMatrix(), TQWMatrix, TQPainter::setWorldMatrix(), and TQImage::xForm(). +

        See also trueMatrix(), TQWMatrix, TQPainter::setWorldMatrix(), and TQImage::xForm().

        Examples: desktop/desktop.cpp, fileiconview/qfileiconview.cpp, movies/main.cpp, and qmag/qmag.cpp.


        Related Functions

        diff --git a/doc/html/ntqpixmapcache.html b/doc/html/ntqpixmapcache.html index e407d6806..3695a1202 100644 --- a/doc/html/ntqpixmapcache.html +++ b/doc/html/ntqpixmapcache.html @@ -67,7 +67,7 @@ displayed or changes state. In the function directly. Instead, we first check the global pixmap cache for a pixmap with the key "$qt_radio_nnn_", where nnn is a numerical value that specifies the the radio button state. If a pixmap is -found, we bitBlt() it onto the widget and return. Otherwise, we +found, we bitBlt() it onto the widget and return. Otherwise, we create a new pixmap, draw the radio button in the pixmap, and finally insert the pixmap in the global pixmap cache, using the key above. The bitBlt() is ten times faster than drawing the diff --git a/doc/html/ntqsize.html b/doc/html/ntqsize.html index de930bdbe..94bd57b5c 100644 --- a/doc/html/ntqsize.html +++ b/doc/html/ntqsize.html @@ -104,7 +104,7 @@ width of two sizes using boundedTo(). inside a given rectangle, preserving the aspect ratio.
      • TQSize::ScaleMax - The size is scaled to a rectangle as small as possible outside a given rectangle, preserving the aspect ratio. -

      See also TQSize::scale(), TQImage::scale(), and TQImage::smoothScale(). +

    See also TQSize::scale(), TQImage::scale(), and TQImage::smoothScale().


    Member Function Documentation

    TQSize::TQSize () diff --git a/doc/html/ntqstylesheet.html b/doc/html/ntqstylesheet.html index 91c2e78b0..8282c55a1 100644 --- a/doc/html/ntqstylesheet.html +++ b/doc/html/ntqstylesheet.html @@ -210,7 +210,7 @@ given in the source attribute, for example attributes width and height that determine the size of the image. If the pixmap does not fit the specified size it will be scaled automatically (by using -TQImage::smoothScale()). +TQImage::smoothScale()).
    The align attribute determines where the image is placed. By default, an image is placed inline just like a diff --git a/doc/html/ntqt.html b/doc/html/ntqt.html index b0b2048f7..b059c708b 100644 --- a/doc/html/ntqt.html +++ b/doc/html/ntqt.html @@ -300,7 +300,7 @@ options marked "(default)" are set if no other values from the list are included (since the defaults are zero):

    Color/Mono preference (ignored for TQBitmap)

      -
    • TQt::AutoColor - (default) - If the image has depth 1 and contains only +
    • TQt::AutoColor - (default) - If the image has depth 1 and contains only black and white pixels, the pixmap becomes monochrome.
    • TQt::ColorOnly - The pixmap is dithered/converted to the native display depth. diff --git a/doc/html/ntqvariant.html b/doc/html/ntqvariant.html index 7ee8ef8a3..4263afaf4 100644 --- a/doc/html/ntqvariant.html +++ b/doc/html/ntqvariant.html @@ -193,7 +193,7 @@ type that can be generated from the stored type, toT() copies and converts and leaves the object itself unchanged. If you ask for a type that cannot be generated from the stored type, the result depends on the type (see the function documentation for details). -

      Note that three data types supported by TQVariant are explicitly shared, namely TQImage, TQPointArray, and TQCString, and in these +

      Note that three data types supported by TQVariant are explicitly shared, namely TQImage, TQPointArray, and TQCString, and in these cases the toT() methods return a shallow copy. In almost all cases you must make a deep copy of the returned values before modifying them. @@ -258,7 +258,7 @@ contain.

    • TQVariant::Double - a double
    • TQVariant::Font - a TQFont
    • TQVariant::IconSet - a TQIconSet -
    • TQVariant::Image - a TQImage +
    • TQVariant::Image - a TQImage
    • TQVariant::Int - an int
    • TQVariant::KeySequence - a TQKeySequence
    • TQVariant::List - a TQValueList @@ -306,7 +306,7 @@ Constructs a new variant with a size policy value, val. Constructs a copy of the variant, p, passed as the argument to this constructor. Usually this is a deep copy, but a shallow copy is made if the stored data type is explicitly shared, as e.g. -TQImage is. +TQImage is.

      TQVariant::TQVariant ( TQDataStream & s )

      @@ -341,10 +341,10 @@ Constructs a new variant with a font value, val.

    Constructs a new variant with a pixmap value, val. -

    TQVariant::TQVariant ( const TQImage & val ) +

    TQVariant::TQVariant ( const TQImage & val )

    Constructs a new variant with an image value, val. -

    Because TQImage is explicitly shared, you may need to pass a deep copy to the variant using TQImage::copy(), e.g. if you intend +

    Because TQImage is explicitly shared, you may need to pass a deep copy to the variant using TQImage::copy(), e.g. if you intend changing the image you've passed later on.

    TQVariant::TQVariant ( const TQBrush & val ) @@ -563,7 +563,7 @@ not possible the variant is set to an empty iconset.

    Returns a reference to the stored iconset.

    See also toIconSet(). -

    TQImage & TQVariant::asImage () +

    TQImage & TQVariant::asImage ()

    Tries to convert the variant to hold an image value. If that is @@ -834,7 +834,7 @@ equal; otherwise returns FALSE. Assigns the value of the variant variant to this variant.

    This is a deep copy of the variant, but note that if the variant -holds an explicitly shared type such as TQImage, a shallow copy is +holds an explicitly shared type such as TQImage, a shallow copy is performed.

    bool TQVariant::operator== ( const TQVariant & v ) const @@ -952,9 +952,9 @@ Returns the variant as a TQIconSet if the variant IconSet; otherwise returns an icon set of null pixmaps.

    See also asIconSet(). -

    const TQImage TQVariant::toImage () const +

    const TQImage TQVariant::toImage () const

    -Returns the variant as a TQImage if the variant has type() Image; +Returns the variant as a TQImage if the variant has type() Image; otherwise returns a null image.

    See also asImage(). diff --git a/doc/html/plugins-howto.html b/doc/html/plugins-howto.html index 42ae7700c..595deb468 100644 --- a/doc/html/plugins-howto.html +++ b/doc/html/plugins-howto.html @@ -46,7 +46,7 @@ by default in the standard plugin directory.

    Base Class Default Path
    TQImageFormatPlugin +TQImageFormatPlugin pluginsbase/imageformats *
    TQSqlDriverPlugin diff --git a/doc/html/plugins.html b/doc/html/plugins.html index a5ec23cce..50f0bb247 100644 --- a/doc/html/plugins.html +++ b/doc/html/plugins.html @@ -40,7 +40,7 @@ Windows.

    TQGfxDriverPluginAbstract base for TQt/Embedded graphics driver plugins -
    TQImageFormatPluginAbstract base for custom image format plugins +
    TQImageFormatPluginAbstract base for custom image format plugins
    TQKbdDriverPluginAbstract base for TQt/Embedded keyboard driver plugins
    TQLibraryWrapper for handling shared libraries
    TQMouseDriverPluginAbstract base for TQt/Embedded mouse driver plugins diff --git a/doc/html/qaction-application-example.html b/doc/html/qaction-application-example.html index 101052362..7ac09322f 100644 --- a/doc/html/qaction-application-example.html +++ b/doc/html/qaction-application-example.html @@ -104,7 +104,7 @@ private: #include "application.h" -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <ntqtoolbar.h> #include <ntqtoolbutton.h> diff --git a/doc/html/qasyncimageio-h.html b/doc/html/qasyncimageio-h.html index b8f7bea47..ba48d90cd 100644 --- a/doc/html/qasyncimageio-h.html +++ b/doc/html/qasyncimageio-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQASYNCIMAGEIO_H #ifndef QT_H -#include "ntqimage.h" +#include "tqimage.h" #endif // QT_H #ifndef TQT_NO_ASYNC_IMAGE_IO diff --git a/doc/html/qdragobject-h.html b/doc/html/qdragobject-h.html index 9d12e6e99..31c2c1684 100644 --- a/doc/html/qdragobject-h.html +++ b/doc/html/qdragobject-h.html @@ -83,7 +83,7 @@ class TQImageDragData; #ifndef QT_H #include "tqobject.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqstrlist.h" #include "ntqcolor.h" #endif // QT_H diff --git a/doc/html/qembed.html b/doc/html/qembed.html index 0789aa4a3..256c2950e 100644 --- a/doc/html/qembed.html +++ b/doc/html/qembed.html @@ -66,7 +66,7 @@ of the supplied functions:

         #include "generated_qembed_file.h"
     
    -    TQImage myFindImage(const char* name)
    +    TQImage myFindImage(const char* name)
         {
             return qembed_findImage(name);
         }
    diff --git a/doc/html/qgfx_qws-h.html b/doc/html/qgfx_qws-h.html
    index b3efae8b4..5f8d2497a 100644
    --- a/doc/html/qgfx_qws-h.html
    +++ b/doc/html/qgfx_qws-h.html
    @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; }
     #ifndef QT_H
     #include "tqwidget.h"
     #include "ntqnamespace.h"
    -#include "ntqimage.h"
    +#include "tqimage.h"
     #include "qfontmanager_qws.h"
     #include "qmemorymanager_qws.h"
     #include "ntqpoint.h"
    diff --git a/doc/html/qglwidget.html b/doc/html/qglwidget.html
    index adc942c47..142ba2560 100644
    --- a/doc/html/qglwidget.html
    +++ b/doc/html/qglwidget.html
    @@ -284,17 +284,17 @@ returned will be empty.
     example, if the underlying hardware does not support the format
     attributes that were requested.
     
    -

    TQImage TQGLWidget::convertToGLFormat ( const TQImage & img ) [static] +

    TQImage TQGLWidget::convertToGLFormat ( const TQImage & img ) [static]

    Converts the image img into the unnamed format expected by OpenGL functions such as glTexImage2D(). The returned image is not -usable as a TQImage, but TQImage::width(), TQImage::height() and -TQImage::bits() may be used with OpenGL. The following few lines +usable as a TQImage, but TQImage::width(), TQImage::height() and +TQImage::bits() may be used with OpenGL. The following few lines are from the texture example. Most of the code is irrelevant, so we just quote the relevant bits:

    -

            TQImage tex1, tex2, buf;
    +
            TQImage tex1, tex2, buf;
             if ( !buf.load( "gllogo.bmp" ) ) {  // Load first image from file
     

    We create tex1 (and another variable) for OpenGL, and load a real @@ -303,8 +303,8 @@ image into buf.

    A few lines later, we convert buf into OpenGL format and store it in tex1. -

            glTexImage2D( GL_TEXTURE_2D, 0, 3, tex1.width(), tex1.height(), 0,
    -                      GL_RGBA, GL_UNSIGNED_BYTE, tex1.bits() );
    +

            glTexImage2D( GL_TEXTURE_2D, 0, 3, tex1.width(), tex1.height(), 0,
    +                      GL_RGBA, GL_UNSIGNED_BYTE, tex1.bits() );
     

    Note the dimension restrictions for texture images as described in the glTexImage2D() documentation. The width must be 2^m + 2*border @@ -343,7 +343,7 @@ Executes the virtual function paintGL(). Initializes OpenGL for this widget's context. Calls the virtual function initializeGL(). -

    TQImage TQGLWidget::grabFrameBuffer ( bool withAlpha = FALSE ) [virtual] +

    TQImage TQGLWidget::grabFrameBuffer ( bool withAlpha = FALSE ) [virtual]

    Returns an image of the frame buffer. If withAlpha is TRUE the alpha channel is included. diff --git a/doc/html/qimage-h.html b/doc/html/qimage-h.html deleted file mode 100644 index 7a36f4890..000000000 --- a/doc/html/qimage-h.html +++ /dev/null @@ -1,470 +0,0 @@ - - - - - -ntqimage.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqimage.h

    - -

    This is the verbatim text of the ntqimage.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqimage.h   3.3.8   edited Jan 11 14:38 $
    -**
    -** Definition of TQImage and TQImageIO classes
    -**
    -** Created : 950207
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the kernel module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQIMAGE_H
    -#define TQIMAGE_H
    -
    -#ifndef QT_H
    -#include "ntqpixmap.h"
    -#include "ntqstrlist.h"
    -#include "ntqstringlist.h"
    -#endif // QT_H
    -
    -class TQImageDataMisc; // internal
    -#ifndef TQT_NO_IMAGE_TEXT
    -class TQ_EXPORT TQImageTextKeyLang {
    -public:
    -    TQImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
    -    TQImageTextKeyLang() { }
    -
    -    TQCString key;
    -    TQCString lang;
    -
    -    bool operator< (const TQImageTextKeyLang& other) const
    -	{ return key < other.key || key==other.key && lang < other.lang; }
    -    bool operator== (const TQImageTextKeyLang& other) const
    -	{ return key==other.key && lang==other.lang; }
    -};
    -#endif //TQT_NO_IMAGE_TEXT
    -
    -
    -class TQ_EXPORT TQImage
    -{
    -public:
    -    enum Endian { IgnoreEndian, BigEndian, LittleEndian };
    -
    -    TQImage();
    -    TQImage( int width, int height, int depth, int numColors=0,
    -	    Endian bitOrder=IgnoreEndian );
    -    TQImage( const TQSize&, int depth, int numColors=0,
    -	    Endian bitOrder=IgnoreEndian );
    -#ifndef TQT_NO_IMAGEIO
    -    TQImage( const TQString &fileName, const char* format=0 );
    -    TQImage( const char * const xpm[] );
    -    TQImage( const TQByteArray &data );
    -#endif
    -    TQImage( uchar* data, int w, int h, int depth,
    -		TQRgb* colortable, int numColors,
    -		Endian bitOrder );
    -#ifdef TQ_WS_QWS
    -    TQImage( uchar* data, int w, int h, int depth, int pbl,
    -		TQRgb* colortable, int numColors,
    -		Endian bitOrder );
    -#endif
    -    TQImage( const TQImage & );
    -   ~TQImage();
    -
    -    TQImage     &operator=( const TQImage & );
    -    TQImage     &operator=( const TQPixmap & );
    -    bool	operator==( const TQImage & ) const;
    -    bool	operator!=( const TQImage & ) const;
    -    void	detach();
    -    TQImage	copy()		const;
    -    TQImage	copy(int x, int y, int w, int h, int conversion_flags=0) const;
    -    TQImage	copy(const TQRect&)	const;
    -#ifndef TQT_NO_MIME
    -    static TQImage fromMimeSource( const TQString& abs_name );
    -#endif
    -    bool	isNull()	const	{ return data->bits == 0; }
    -
    -    int		width()		const	{ return data->w; }
    -    int		height()	const	{ return data->h; }
    -    TQSize	size()		const	{ return TQSize(data->w,data->h); }
    -    TQRect	rect()		const	{ return TQRect(0,0,data->w,data->h); }
    -    int		depth()		const	{ return data->d; }
    -    int		numColors()	const	{ return data->ncols; }
    -    Endian	bitOrder()	const	{ return (Endian) data->bitordr; }
    -
    -    TQRgb	color( int i )	const;
    -    void	setColor( int i, TQRgb c );
    -    void	setNumColors( int );
    -
    -    bool	hasAlphaBuffer() const;
    -    void	setAlphaBuffer( bool );
    -
    -    bool	allGray() const;
    -    bool        isGrayscale() const;
    -
    -    uchar      *bits()		const;
    -    uchar      *scanLine( int ) const;
    -    uchar     **jumpTable()	const;
    -    TQRgb       *colorTable()	const;
    -    int		numBytes()	const;
    -    int		bytesPerLine()	const;
    -
    -#ifdef TQ_WS_QWS
    -    TQGfx * graphicsContext();
    -#endif
    -
    -    bool	create( int width, int height, int depth, int numColors=0,
    -			Endian bitOrder=IgnoreEndian );
    -    bool	create( const TQSize&, int depth, int numColors=0,
    -			Endian bitOrder=IgnoreEndian );
    -    void	reset();
    -
    -    void	fill( uint pixel );
    -    void	invertPixels( bool invertAlpha = TRUE );
    -
    -    TQImage	convertDepth( int ) const;
    -#ifndef TQT_NO_IMAGE_TRUECOLOR
    -    TQImage	convertDepthWithPalette( int, TQRgb* p, int pc, int cf=0 ) const;
    -#endif
    -    TQImage	convertDepth( int, int conversion_flags ) const;
    -    TQImage	convertBitOrder( Endian ) const;
    -
    -    enum ScaleMode {
    -	ScaleFree,
    -	ScaleMin,
    -	ScaleMax
    -    };
    -#ifndef TQT_NO_IMAGE_SMOOTHSCALE
    -    TQImage smoothScale( int w, int h, ScaleMode mode=ScaleFree ) const;
    -    TQImage smoothScale( const TQSize& s, ScaleMode mode=ScaleFree ) const;
    -#endif
    -#ifndef TQT_NO_IMAGE_TRANSFORMATION
    -    TQImage scale( int w, int h, ScaleMode mode=ScaleFree ) const;
    -    TQImage scale( const TQSize& s, ScaleMode mode=ScaleFree ) const;
    -    TQImage scaleWidth( int w ) const;
    -    TQImage scaleHeight( int h ) const;
    -    TQImage xForm( const TQWMatrix &matrix ) const;
    -#endif
    -
    -#ifndef TQT_NO_IMAGE_DITHER_TO_1
    -    TQImage	createAlphaMask( int conversion_flags=0 ) const;
    -#endif
    -#ifndef TQT_NO_IMAGE_HEURISTIC_MASK
    -    TQImage	createHeuristicMask( bool clipTight=TRUE ) const;
    -#endif
    -#ifndef TQT_NO_IMAGE_MIRROR
    -    TQImage	mirror() const;
    -    TQImage	mirror(bool horizontally, bool vertically) const;
    -#endif
    -    TQImage	swapRGB() const;
    -
    -    static Endian systemBitOrder();
    -    static Endian systemByteOrder();
    -
    -#ifndef TQT_NO_IMAGEIO
    -    static const char* imageFormat( const TQString &fileName );
    -    static TQStrList inputFormats();
    -    static TQStrList outputFormats();
    -#ifndef TQT_NO_STRINGLIST
    -    static TQStringList inputFormatList();
    -    static TQStringList outputFormatList();
    -#endif
    -    bool	load( const TQString &fileName, const char* format=0 );
    -    bool	loadFromData( const uchar *buf, uint len,
    -			      const char *format=0 );
    -    bool	loadFromData( TQByteArray data, const char* format=0 );
    -    bool	save( const TQString &fileName, const char* format,
    -		      int quality=-1 ) const;
    -    bool	save( TQIODevice * device, const char* format,
    -		      int quality=-1 ) const;
    -#endif //TQT_NO_IMAGEIO
    -
    -    bool	valid( int x, int y ) const;
    -    int		pixelIndex( int x, int y ) const;
    -    TQRgb	pixel( int x, int y ) const;
    -    void	setPixel( int x, int y, uint index_or_rgb );
    -
    -    // Auxiliary data
    -    int dotsPerMeterX() const;
    -    int dotsPerMeterY() const;
    -    void setDotsPerMeterX(int);
    -    void setDotsPerMeterY(int);
    -    TQPoint offset() const;
    -    void setOffset(const TQPoint&);
    -#ifndef TQT_NO_IMAGE_TEXT
    -    TQValueList<TQImageTextKeyLang> textList() const;
    -    TQStringList textLanguages() const;
    -    TQStringList textKeys() const;
    -    TQString text(const char* key, const char* lang=0) const;
    -    TQString text(const TQImageTextKeyLang&) const;
    -    void setText(const char* key, const char* lang, const TQString&);
    -#endif
    -private:
    -    void	init();
    -    void	reinit();
    -    void	freeBits();
    -    static void	warningIndexRange( const char *, int );
    -
    -    struct TQImageData : public TQShared {	// internal image data
    -	int	w;				// image width
    -	int	h;				// image height
    -	int	d;				// image depth
    -	int	ncols;				// number of colors
    -	int	nbytes;				// number of bytes data
    -	int	bitordr;			// bit order (1 bit depth)
    -	TQRgb   *ctbl;				// color table
    -	uchar **bits;				// image data
    -	bool	alpha;				// alpha buffer
    -	int	dpmx;				// dots per meter X (or 0)
    -	int	dpmy;				// dots per meter Y (or 0)
    -	TQPoint	offset;				// offset in pixels
    -#ifndef TQT_NO_IMAGE_TEXT
    -	TQImageDataMisc* misc;			// less common stuff
    -#endif
    -	bool    ctbl_mine;			// this allocated ctbl
    -    } *data;
    -#ifndef TQT_NO_IMAGE_TEXT
    -    TQImageDataMisc& misc() const;
    -#endif
    -#ifndef TQT_NO_IMAGEIO
    -    bool doImageIO( TQImageIO* io, int quality ) const;
    -#endif
    -    friend TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy,
    -				 const TQImage* src, int sx, int sy,
    -				 int sw, int sh, int conversion_flags );
    -};
    -
    -
    -// TQImage stream functions
    -
    -#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO)
    -TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQImage & );
    -TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQImage & );
    -#endif
    -
    -#ifndef TQT_NO_IMAGEIO
    -class TQIODevice;
    -typedef void (*image_io_handler)( TQImageIO * ); // image IO handler
    -
    -
    -struct TQImageIOData;
    -
    -
    -class TQ_EXPORT TQImageIO
    -{
    -public:
    -    TQImageIO();
    -    TQImageIO( TQIODevice	 *ioDevice, const char *format );
    -    TQImageIO( const TQString &fileName, const char* format );
    -   ~TQImageIO();
    -
    -
    -    const TQImage &image()	const	{ return im; }
    -    int		status()	const	{ return iostat; }
    -    const char *format()	const	{ return frmt; }
    -    TQIODevice  *ioDevice()	const	{ return iodev; }
    -    TQString	fileName()	const	{ return fname; }
    -    int		quality()	const;
    -    TQString	description()	const	{ return descr; }
    -    const char *parameters()	const;
    -    float gamma() const;
    -
    -    void	setImage( const TQImage & );
    -    void	setStatus( int );
    -    void	setFormat( const char * );
    -    void	setIODevice( TQIODevice * );
    -    void	setFileName( const TQString & );
    -    void	setQuality( int );
    -    void	setDescription( const TQString & );
    -    void	setParameters( const char * );
    -    void	setGamma( float );
    -
    -    bool	read();
    -    bool	write();
    -
    -    static const char* imageFormat( const TQString &fileName );
    -    static const char *imageFormat( TQIODevice * );
    -    static TQStrList inputFormats();
    -    static TQStrList outputFormats();
    -
    -    static void defineIOHandler( const char *format,
    -				 const char *header,
    -				 const char *flags,
    -				 image_io_handler read_image,
    -				 image_io_handler write_image );
    -
    -private:
    -    void	init();
    -
    -    TQImage	im;				// image
    -    int		iostat;				// IO status
    -    TQCString	frmt;				// image format
    -    TQIODevice  *iodev;				// IO device
    -    TQString	fname;				// file name
    -    char       *params;				// image parameters //### change to TQImageIOData *d in 3.0
    -    TQString     descr;				// image description
    -    TQImageIOData *d;
    -
    -private:	// Disabled copy constructor and operator=
    -#if defined(TQ_DISABLE_COPY)
    -    TQImageIO( const TQImageIO & );
    -    TQImageIO &operator=( const TQImageIO & );
    -#endif
    -};
    -
    -#endif //TQT_NO_IMAGEIO
    -
    -TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src,
    -		      int sx=0, int sy=0, int sw=-1, int sh=-1,
    -		      int conversion_flags=0 );
    -
    -
    -/*****************************************************************************
    -  TQImage member functions
    - *****************************************************************************/
    -
    -inline bool TQImage::hasAlphaBuffer() const
    -{
    -    return data->alpha;
    -}
    -
    -inline uchar *TQImage::bits() const
    -{
    -    return data->bits ? data->bits[0] : 0;
    -}
    -
    -inline uchar **TQImage::jumpTable() const
    -{
    -    return data->bits;
    -}
    -
    -inline TQRgb *TQImage::colorTable() const
    -{
    -    return data->ctbl;
    -}
    -
    -inline int TQImage::numBytes() const
    -{
    -    return data->nbytes;
    -}
    -
    -inline int TQImage::bytesPerLine() const
    -{
    -    return data->h ? data->nbytes/data->h : 0;
    -}
    -
    -inline TQImage TQImage::copy(const TQRect& r) const
    -{
    -    return copy(r.x(), r.y(), r.width(), r.height());
    -}
    -
    -inline TQRgb TQImage::color( int i ) const
    -{
    -#if defined(QT_CHECK_RANGE)
    -    if ( i >= data->ncols )
    -	warningIndexRange( "color", i );
    -#endif
    -    return data->ctbl ? data->ctbl[i] : (TQRgb)-1;
    -}
    -
    -inline void TQImage::setColor( int i, TQRgb c )
    -{
    -#if defined(QT_CHECK_RANGE)
    -    if ( i >= data->ncols )
    -	warningIndexRange( "setColor", i );
    -#endif
    -    if ( data->ctbl )
    -	data->ctbl[i] = c;
    -}
    -
    -inline uchar *TQImage::scanLine( int i ) const
    -{
    -#if defined(QT_CHECK_RANGE)
    -    if ( i >= data->h )
    -	warningIndexRange( "scanLine", i );
    -#endif
    -    return data->bits ? data->bits[i] : 0;
    -}
    -
    -inline int TQImage::dotsPerMeterX() const
    -{
    -    return data->dpmx;
    -}
    -
    -inline int TQImage::dotsPerMeterY() const
    -{
    -    return data->dpmy;
    -}
    -
    -inline TQPoint TQImage::offset() const
    -{
    -    return data->offset;
    -}
    -
    -
    -#endif // TQIMAGE_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimage-members.html b/doc/html/qimage-members.html deleted file mode 100644 index 8dfca825e..000000000 --- a/doc/html/qimage-members.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - -TQImage Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImage

    - -

    This is the complete list of member functions for -TQImage, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageconsumer-members.html b/doc/html/qimageconsumer-members.html deleted file mode 100644 index 3325c5f66..000000000 --- a/doc/html/qimageconsumer-members.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - -TQImageConsumer Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageConsumer

    - -

    This is the complete list of member functions for -TQImageConsumer, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageconsumer.html b/doc/html/qimageconsumer.html deleted file mode 100644 index c2110357f..000000000 --- a/doc/html/qimageconsumer.html +++ /dev/null @@ -1,142 +0,0 @@ - - - - - -TQImageConsumer Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageConsumer Class Reference

    - -

    The TQImageConsumer class is an abstraction used by TQImageDecoder. -More... -

    #include <ntqasyncimageio.h> -

    List of all member functions. -

    Public Members

    -
      -
    • virtual void end () = 0
    • -
    • virtual void changed ( const TQRect & ) = 0
    • -
    • virtual void frameDone () = 0
    • -
    • virtual void frameDone ( const TQPoint & offset, const TQRect & rect ) = 0
    • -
    • virtual void setLooping ( int n ) = 0
    • -
    • virtual void setFramePeriod ( int milliseconds ) = 0
    • -
    • virtual void setSize ( int, int ) = 0
    • -
    -

    Detailed Description

    - - -The TQImageConsumer class is an abstraction used by TQImageDecoder. -

    - - -

    The TQMovie class, or TQLabel::setMovie(), are easy to use and for -most situations do what you want with regards animated images. -

    A TQImageConsumer consumes information about changes to the TQImage -maintained by a TQImageDecoder. Think of the TQImage as the model or -source of the image data, with the TQImageConsumer as a view of -that data and the TQImageDecoder being the controller that -orchestrates the relationship between the model and the view. -

    You'd use the TQImageConsumer class, for example, if you were -implementing a web browser with your own image loaders. -

    See also TQImageDecoder, Graphics Classes, Image Processing Classes, and Multimedia Classes. - -


    Member Function Documentation

    -

    void TQImageConsumer::changed ( const TQRect & ) [pure virtual] -

    - -

    Called when the given area of the image has changed. - -

    void TQImageConsumer::end () [pure virtual] -

    - -

    Called when all the data from all the frames has been decoded and -revealed as changed(). - -

    void TQImageConsumer::frameDone () [pure virtual] -

    - -

    One of the two frameDone() functions will be called when a frame -of an animated image has ended and been revealed as changed(). -

    When this function is called, the current image should be -displayed. -

    The decoder will not make any further changes to the image until -the next call to TQImageFormat::decode(). - -

    void TQImageConsumer::frameDone ( const TQPoint & offset, const TQRect & rect ) [pure virtual] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    One of the two frameDone() functions will be called when a frame -of an animated image has ended and been revealed as changed(). -

    When this function is called, the area rect in the current -image should be moved by offset and displayed. -

    The decoder will not make any further changes to the image until -the next call to TQImageFormat::decode(). - -

    void TQImageConsumer::setFramePeriod ( int milliseconds ) [pure virtual] -

    - -

    Notes that the frame about to be decoded should not be displayed -until the given number of milliseconds after the time that this -function is called. Of course, the image may not have been -decoded by then, in which case the frame should not be displayed -until it is complete. A value of -1 (the assumed default) -indicates that the image should be displayed even while it is only -partially loaded. - -

    void TQImageConsumer::setLooping ( int n ) [pure virtual] -

    - -

    Called to indicate that the sequence of frames in the image -should be repeated n times, including the sequence during -decoding. -

      -
    • 0 = Forever -
    • 1 = Only display frames the first time through -
    • 2 = Repeat once after first pass through images -
    • etc. -
    -

    To make the TQImageDecoder do this, just delete it and pass the -information to it again for decoding (setLooping() will be called -again, of course, but that can be ignored), or keep copies of the -changed areas at the ends of frames. - -

    void TQImageConsumer::setSize ( int, int ) [pure virtual] -

    - -

    This function is called as soon as the size of the image has been -determined. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimagedecoder-members.html b/doc/html/qimagedecoder-members.html deleted file mode 100644 index 7777631bd..000000000 --- a/doc/html/qimagedecoder-members.html +++ /dev/null @@ -1,55 +0,0 @@ - - - - - -TQImageDecoder Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageDecoder

    - -

    This is the complete list of member functions for -TQImageDecoder, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimagedecoder.html b/doc/html/qimagedecoder.html deleted file mode 100644 index bd484b58d..000000000 --- a/doc/html/qimagedecoder.html +++ /dev/null @@ -1,154 +0,0 @@ - - - - - -TQImageDecoder Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageDecoder Class Reference

    - -

    The TQImageDecoder class is an incremental image decoder for all supported image formats. -More... -

    #include <ntqasyncimageio.h> -

    List of all member functions. -

    Public Members

    - -

    Static Public Members

    - -

    Detailed Description

    - - -The TQImageDecoder class is an incremental image decoder for all supported image formats. -

    - - -

    New formats are installed by creating objects of class -TQImageFormatType; the TQMovie class can be used for all installed -incremental image formats. TQImageDecoder is only useful for -creating new ways of feeding data to an TQImageConsumer. -

    A TQImageDecoder is a machine that decodes images. It takes encoded -image data via its decode() method and expresses its decoding by -supplying information to a TQImageConsumer. It implements its -decoding by using a TQImageFormat created by one of the -currently-existing TQImageFormatType factory objects. -

    TQImageFormatType and TQImageFormat are the classes that you might -need to implement support for additional image formats. -

    -

    TQt supports GIF reading if it is configured that way during -installation (see ntqgif.h). If it is, we are required to state that -"The Graphics Interchange Format(c) is the Copyright property of -CompuServe Incorporated. GIF(sm) is a Service Mark property of -CompuServe Incorporated." -

    Warning: If you are in a country that recognizes software patents -and in which Unisys holds a patent on LZW compression and/or -decompression and you want to use GIF, Unisys may require you to -license that technology. Such countries include Canada, Japan, -the USA, France, Germany, Italy and the UK. -

    GIF support may be removed completely in a future version of TQt. -We recommend using the MNG or PNG format. -

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. - -


    Member Function Documentation

    -

    TQImageDecoder::TQImageDecoder ( TQImageConsumer * c ) -

    -Constructs a TQImageDecoder that will send change information to -the TQImageConsumer c. - -

    TQImageDecoder::~TQImageDecoder () -

    -Destroys a TQImageDecoder. The image it built is destroyed. The -decoder built by the factory for the file format is destroyed. The -consumer for which it decoded the image is not destroyed. - -

    int TQImageDecoder::decode ( const uchar * buffer, int length ) -

    -Call this function to decode some data into image changes. The -data in buffer will be decoded, sending change information to -the TQImageConsumer of this TQImageDecoder until one of the change -functions of the consumer returns FALSE. The length of the data is -given in length. -

    Returns the number of bytes consumed: 0 if consumption is -complete, and -1 if decoding fails due to invalid data. - -

    TQImageFormatType * TQImageDecoder::format ( const char * name ) [static] -

    -Returns a TQImageFormatType by name. This might be used when the -user needs to force data to be interpreted as being in a certain -format. name is one of the formats listed by -TQImageDecoder::inputFormats(). Note that you will still need to -supply decodable data to result->decoderFor() before you can begin -decoding the data. - -

    const char * TQImageDecoder::formatName ( const uchar * buffer, int length ) [static] -

    -Call this function to find the name of the format of the given -header. The returned string is statically allocated. The function -will look at the first length characters in the buffer. -

    Returns 0 if the format is not recognized. - -

    const TQImage & TQImageDecoder::image () -

    - -

    Returns the image currently being decoded. - -

    TQStrList TQImageDecoder::inputFormats () [static] -

    -Returns a sorted list of formats for which asynchronous loading is -supported. - -

    void TQImageDecoder::registerDecoderFactory ( TQImageFormatType * f ) [static] -

    -Registers the new TQImageFormatType f. This is not needed in -application code because factories call this themselves. - -

    void TQImageDecoder::unregisterDecoderFactory ( TQImageFormatType * f ) [static] -

    -Unregisters the TQImageFormatType f. This is not needed in -application code because factories call this themselves. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimagedrag-members.html b/doc/html/qimagedrag-members.html deleted file mode 100644 index 91a8648f5..000000000 --- a/doc/html/qimagedrag-members.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - -TQImageDrag Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageDrag

    - -

    This is the complete list of member functions for -TQImageDrag, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimagedrag.html b/doc/html/qimagedrag.html deleted file mode 100644 index ed572a259..000000000 --- a/doc/html/qimagedrag.html +++ /dev/null @@ -1,120 +0,0 @@ - - - - - -TQImageDrag Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageDrag Class Reference

    - -

    The TQImageDrag class provides a drag and drop object for -transferring images. -More... -

    #include <ntqdragobject.h> -

    Inherits TQDragObject. -

    List of all member functions. -

    Public Members

    -
      -
    • TQImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )
    • -
    • TQImageDrag ( TQWidget * dragSource = 0, const char * name = 0 )
    • -
    • ~TQImageDrag ()
    • -
    • virtual void setImage ( TQImage image )
    • -
    -

    Static Public Members

    -
      -
    • bool canDecode ( const TQMimeSource * e )
    • -
    • bool decode ( const TQMimeSource * e, TQImage & img )
    • -
    • bool decode ( const TQMimeSource * e, TQPixmap & pm )
    • -
    -

    Detailed Description

    - - -

    The TQImageDrag class provides a drag and drop object for -transferring images. -

    -

    Images are offered to the receiving application in multiple -formats, determined by TQt's output - formats. -

    For more information about drag and drop, see the TQDragObject -class and the drag and drop documentation. -

    See also Drag And Drop Classes. - -


    Member Function Documentation

    -

    TQImageDrag::TQImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 ) -

    -Constructs an image drag object and sets its data to image. dragSource must be the drag source; name is the object name. - -

    TQImageDrag::TQImageDrag ( TQWidget * dragSource = 0, const char * name = 0 ) -

    -Constructs a default image drag object. dragSource must be the -drag source; name is the object name. - -

    TQImageDrag::~TQImageDrag () -

    -Destroys the image drag object and frees up all allocated -resources. - -

    bool TQImageDrag::canDecode ( const TQMimeSource * e ) [static] -

    -Returns TRUE if the information in mime source e can be decoded -into an image; otherwise returns FALSE. -

    See also decode(). - -

    Example: desktop/desktop.cpp. -

    bool TQImageDrag::decode ( const TQMimeSource * e, TQImage & img ) [static] -

    -Attempts to decode the dropped information in mime source e -into img. Returns TRUE if successful; otherwise returns FALSE. -

    See also canDecode(). - -

    Example: desktop/desktop.cpp. -

    bool TQImageDrag::decode ( const TQMimeSource * e, TQPixmap & pm ) [static] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Attempts to decode the dropped information in mime source e -into pixmap pm. Returns TRUE if successful; otherwise returns -FALSE. -

    This is a convenience function that converts to a TQPixmap via a -TQImage. -

    See also canDecode(). - -

    void TQImageDrag::setImage ( TQImage image ) [virtual] -

    -Sets the image to be dragged to image. You will need to call -this if you did not pass the image during construction. - - -

    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformat-members.html b/doc/html/qimageformat-members.html deleted file mode 100644 index f43464a9f..000000000 --- a/doc/html/qimageformat-members.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -TQImageFormat Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageFormat

    - -

    This is the complete list of member functions for -TQImageFormat, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformat.html b/doc/html/qimageformat.html deleted file mode 100644 index 471a24d8e..000000000 --- a/doc/html/qimageformat.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - -TQImageFormat Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageFormat Class Reference

    - -

    The TQImageFormat class is an incremental image decoder for a specific image format. -More... -

    #include <ntqasyncimageio.h> -

    List of all member functions. -

    Public Members

    -
      -
    • virtual int decode ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length ) = 0
    • -
    -

    Detailed Description

    - - -The TQImageFormat class is an incremental image decoder for a specific image format. -

    - - -

    By making a derived class of TQImageFormatType, which in turn -creates objects that are a subclass of TQImageFormat, you can add -support for more incremental image formats, allowing such formats -to be sources for a TQMovie or for the first frame of the image -stream to be loaded as a TQImage or TQPixmap. -

    Your new subclass must reimplement the decode() function in order -to process your new format. -

    New TQImageFormat objects are generated by new TQImageFormatType -factories. -

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. - -


    Member Function Documentation

    -

    int TQImageFormat::decode ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length ) [pure virtual] -

    - -

    New subclasses must reimplement this method. -

    It should decode some or all of the bytes from buffer into img, calling the methods of consumer as the decoding proceeds -to inform that consumer of changes to the image. The length of the -data is given in length. The consumer may be 0, in which case -the function should just process the data into img without -telling any consumer about the changes. Note that the decoder must -store enough state to be able to continue in subsequent calls to -this method - this is the essence of the incremental image -loading. -

    The function should return without processing all the data if it -reaches the end of a frame in the input. -

    The function must return the number of bytes it has processed. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformatplugin-h.html b/doc/html/qimageformatplugin-h.html deleted file mode 100644 index 312a633e5..000000000 --- a/doc/html/qimageformatplugin-h.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - -ntqimageformatplugin.h Include File - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    ntqimageformatplugin.h

    - -

    This is the verbatim text of the ntqimageformatplugin.h include file. It is provided only for illustration; the copyright remains with Trolltech. -


    -
    -/****************************************************************************
    -** $Id: qt/ntqimageformatplugin.h   3.3.8   edited Jan 11 14:38 $
    -**
    -** Definition of ???
    -**
    -** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    -**
    -** This file is part of the kernel module of the TQt GUI Toolkit.
    -**
    -** This file may be used under the terms of the GNU General Public
    -** License versions 2.0 or 3.0 as published by the Free Software
    -** Foundation and appearing in the file LICENSE.GPL included in the
    -** packaging of this file. Alternatively you may (at your option) use any
    -** later version of the GNU General Public License if such license has
    -** been publicly approved by Trolltech ASA (or its successors, if any)
    -** and the KDE Free TQt Foundation.
    -**
    -** Please review the following information to ensure GNU General
    -** Public Licensing requirements will be met:
    -** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    -** If you are unsure which license is appropriate for your use, please
    -** review the following information:
    -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    -** or contact the sales department at sales@trolltech.com.
    -**
    -** This file may be used under the terms of the Q Public License as
    -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    -** included in the packaging of this file.  Licensees holding valid TQt
    -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    -** herein.
    -**
    -**********************************************************************/
    -
    -#ifndef TQIMAGEFORMATPLUGIN_H
    -#define TQIMAGEFORMATPLUGIN_H
    -
    -#ifndef QT_H
    -#include "ntqgplugin.h"
    -#include "ntqstringlist.h"
    -#endif // QT_H
    -
    -#ifndef TQT_NO_IMAGEFORMATPLUGIN
    -class TQImageFormat;
    -class TQImageFormatPluginPrivate;
    -
    -class TQ_EXPORT TQImageFormatPlugin : public TQGPlugin
    -{
    -    TQ_OBJECT
    -public:
    -    TQImageFormatPlugin();
    -    ~TQImageFormatPlugin();
    -
    -    virtual TQStringList keys() const = 0;
    -    virtual bool loadImage( const TQString &format, const TQString &filename, TQImage *image );
    -    virtual bool saveImage( const TQString &format, const TQString &filename, const TQImage &image );
    -    virtual bool installIOHandler( const TQString &format ) = 0;
    -
    -private:
    -    TQImageFormatPluginPrivate *d;
    -};
    -#endif // TQT_NO_IMAGEFORMATPLUGIN
    -#endif // TQIMAGEFORMATPLUGIN_H
    -
    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformatplugin-members.html b/doc/html/qimageformatplugin-members.html deleted file mode 100644 index b37d95194..000000000 --- a/doc/html/qimageformatplugin-members.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - -TQImageFormatPlugin Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageFormatPlugin

    - -

    This is the complete list of member functions for -TQImageFormatPlugin, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformattype-members.html b/doc/html/qimageformattype-members.html deleted file mode 100644 index 5e554335f..000000000 --- a/doc/html/qimageformattype-members.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - -TQImageFormatType Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageFormatType

    - -

    This is the complete list of member functions for -TQImageFormatType, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageformattype.html b/doc/html/qimageformattype.html deleted file mode 100644 index 0a86776b0..000000000 --- a/doc/html/qimageformattype.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - -TQImageFormatType Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageFormatType Class Reference

    - -

    The TQImageFormatType class is a factory that makes TQImageFormat objects. -More... -

    #include <ntqasyncimageio.h> -

    List of all member functions. -

    Public Members

    - -

    Protected Members

    - -

    Detailed Description

    - - -The TQImageFormatType class is a factory that makes TQImageFormat objects. -

    - - -

    Whereas the TQImageIO class allows for complete loading of -images, TQImageFormatType allows for incremental loading of -images. -

    New image file formats are installed by creating objects of -derived classes of TQImageFormatType. They must implement -decoderFor() and formatName(). -

    TQImageFormatType is a very simple class. Its only task is to -recognize image data in some format and make a new object, -subclassed from TQImageFormat, which can decode that format. -

    The factories for formats built into TQt are automatically defined -before any other factory is initialized. If two factories would -recognize an image format, the factory created last will override -the earlier one; you can thus override current and future built-in -formats. -

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. - -


    Member Function Documentation

    -

    TQImageFormatType::TQImageFormatType () [protected] -

    -Constructs a factory. It automatically registers itself with -TQImageDecoder. - -

    TQImageFormatType::~TQImageFormatType () [virtual] -

    -Destroys a factory. It automatically unregisters itself from -TQImageDecoder. - -

    TQImageFormat * TQImageFormatType::decoderFor ( const uchar * buffer, int length ) [pure virtual] -

    - -

    Returns a decoder for decoding an image that starts with the bytes -in buffer. The length of the data is given in length. This -function should only return a decoder if it is certain that the -decoder applies to data with the given header. Returns 0 if there -is insufficient data in the header to make a positive -identification or if the data is not recognized. - -

    const char * TQImageFormatType::formatName () const [pure virtual] -

    - -

    Returns the name of the format supported by decoders from this -factory. The string is statically allocated. - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageio-members.html b/doc/html/qimageio-members.html deleted file mode 100644 index f10685839..000000000 --- a/doc/html/qimageio-members.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - -TQImageIO Member List - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    Complete Member List for TQImageIO

    - -

    This is the complete list of member functions for -TQImageIO, including inherited members. - -

    - -


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qimageio.html b/doc/html/qimageio.html deleted file mode 100644 index 7cace1518..000000000 --- a/doc/html/qimageio.html +++ /dev/null @@ -1,372 +0,0 @@ - - - - - -TQImageIO Class - - - - - - - -
    - -Home - | -All Classes - | -Main Classes - | -Annotated - | -Grouped Classes - | -Functions -

    TQImageIO Class Reference

    - -

    The TQImageIO class contains parameters for loading and -saving images. -More... -

    #include <ntqimage.h> -

    List of all member functions. -

    Public Members

    - -

    Static Public Members

    -
      -
    • const char * imageFormat ( const TQString & fileName )
    • -
    • const char * imageFormat ( TQIODevice * d )
    • -
    • TQStrList inputFormats ()
    • -
    • TQStrList outputFormats ()
    • -
    • void defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )
    • -
    -

    Detailed Description

    - - -

    The TQImageIO class contains parameters for loading and -saving images. -

    - - -

    TQImageIO contains a TQIODevice object that is used for image data -I/O. The programmer can install new image file formats in addition -to those that TQt provides. -

    TQt currently supports the following image file formats: PNG, BMP, -XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if -specially configured during compilation. The different PNM formats -are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6). -

    You don't normally need to use this class; TQPixmap::load(), -TQPixmap::save(), and TQImage contain sufficient functionality. -

    For image files that contain sequences of images, only the first -is read. See TQMovie for loading multiple images. -

    PBM, PGM, and PPM format output is always in the more condensed -raw format. PPM and PGM files with more than 256 levels of -intensity are scaled down when reading. -

    Warning: If you are in a country which recognizes software patents -and in which Unisys holds a patent on LZW compression and/or -decompression and you want to use GIF, Unisys may require you to -license the technology. Such countries include Canada, Japan, the -USA, France, Germany, Italy and the UK. -

    GIF support may be removed completely in a future version of TQt. -We recommend using the PNG format. -

    See also TQImage, TQPixmap, TQFile, TQMovie, Graphics Classes, Image Processing Classes, and Input/Output and Networking. - -


    Member Function Documentation

    -

    TQImageIO::TQImageIO () -

    -Constructs a TQImageIO object with all parameters set to zero. - -

    TQImageIO::TQImageIO ( TQIODevice * ioDevice, const char * format ) -

    -Constructs a TQImageIO object with the I/O device ioDevice and a -format tag. - -

    TQImageIO::TQImageIO ( const TQString & fileName, const char * format ) -

    -Constructs a TQImageIO object with the file name fileName and a -format tag. - -

    TQImageIO::~TQImageIO () -

    -Destroys the object and all related data. - -

    void TQImageIO::defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage ) [static] -

    -Defines an image I/O handler for the image format called format, which is recognized using the regular expression header, read using readImage and -written using writeImage. -

    flags is a string of single-character flags for this format. -The only flag defined currently is T (upper case), so the only -legal value for flags are "T" and the empty string. The "T" -flag means that the image file is a text file, and TQt should treat -all newline conventions as equivalent. (XPM files and some PPM -files are text files for example.) -

    format is used to select a handler to write a TQImage; header -is used to select a handler to read an image file. -

    If readImage is a null pointer, the TQImageIO will not be able -to read images in format. If writeImage is a null pointer, -the TQImageIO will not be able to write images in format. If -both are null, the TQImageIO object is valid but useless. -

    Example: -

    -        void readGIF( TQImageIO *image )
    -        {
    -        // read the image using the image->ioDevice()
    -        }
    -
    -        void writeGIF( TQImageIO *image )
    -        {
    -        // write the image using the image->ioDevice()
    -        }
    -
    -        // add the GIF image handler
    -
    -        TQImageIO::defineIOHandler( "GIF",
    -                                   "^GIF[0-9][0-9][a-z]",
    -                                   0,
    -                                   readGIF,
    -                                   writeGIF );
    -    
    - -

    Before the regex test, all the 0 bytes in the file header are -converted to 1 bytes. This is done because when TQt was -ASCII-based, TQRegExp could not handle 0 bytes in strings. -

    The regexp is only applied on the first 14 bytes of the file. -

    Note that TQt assumes that there is only one handler per format; if -two handlers support the same format, TQt will choose one -arbitrarily. It is not possible to have one handler support -reading, and another support writing. - -

    TQString TQImageIO::description () const -

    - -

    Returns the image description string. -

    See also setDescription(). - -

    TQString TQImageIO::fileName () const -

    - -

    Returns the file name currently set. -

    See also setFileName(). - -

    const char * TQImageIO::format () const -

    - -

    Returns the image format string or 0 if no format has been -explicitly set. - -

    float TQImageIO::gamma () const -

    -Returns the gamma value at which the image will be viewed. -

    See also setGamma(). - -

    const TQImage & TQImageIO::image () const -

    - -

    Returns the image currently set. -

    See also setImage(). - -

    const char * TQImageIO::imageFormat ( const TQString & fileName ) [static] -

    -Returns a string that specifies the image format of the file fileName, or null if the file cannot be read or if the format is -not recognized. - -

    const char * TQImageIO::imageFormat ( TQIODevice * d ) [static] -

    -This is an overloaded member function, provided for convenience. It behaves essentially like the above function. -

    Returns a string that specifies the image format of the image read -from IO device d, or 0 if the device cannot be read or if the -format is not recognized. -

    Make sure that d is at the right position in the device (for -example, at the beginning of the file). -

    See also TQIODevice::at(). - -

    TQStrList TQImageIO::inputFormats () [static] -

    -Returns a sorted list of image formats that are supported for -image input. - -

    TQIODevice * TQImageIO::ioDevice () const -

    - -

    Returns the IO device currently set. -

    See also setIODevice(). - -

    TQStrList TQImageIO::outputFormats () [static] -

    -Returns a sorted list of image formats that are supported for -image output. - -

    Example: scribble/scribble.cpp. -

    const char * TQImageIO::parameters () const -

    -Returns the image's parameters string. -

    See also setParameters(). - -

    int TQImageIO::quality () const -

    -Returns the quality of the written image, related to the -compression ratio. -

    See also setQuality() and TQImage::save(). - -

    bool TQImageIO::read () -

    -Reads an image into memory and returns TRUE if the image was -successfully read; otherwise returns FALSE. -

    Before reading an image you must set an IO device or a file name. -If both an IO device and a file name have been set, the IO device -will be used. -

    Setting the image file format string is optional. -

    Note that this function does not set the format used to read the image. If you need that -information, use the imageFormat() static functions. -

    Example: -

    -        TQImageIO iio;
    -        TQPixmap  pixmap;
    -        iio.setFileName( "vegeburger.bmp" );
    -        if ( image.read() )        // ok
    -            pixmap = iio.image();  // convert to pixmap
    -    
    - -

    See also setIODevice(), setFileName(), setFormat(), write(), and TQPixmap::load(). - -

    void TQImageIO::setDescription ( const TQString & description ) -

    -Sets the image description string for image handlers that support -image descriptions to description. -

    Currently, no image format supported by TQt uses the description -string. - -

    void TQImageIO::setFileName ( const TQString & fileName ) -

    -Sets the name of the file to read or write an image from to fileName. -

    See also setIODevice(). - -

    void TQImageIO::setFormat ( const char * format ) -

    -Sets the image format to format for the image to be read or -written. -

    It is necessary to specify a format before writing an image, but -it is not necessary to specify a format before reading an image. -

    If no format has been set, TQt guesses the image format before -reading it. If a format is set the image will only be read if it -has that format. -

    See also read(), write(), and format(). - -

    void TQImageIO::setGamma ( float gamma ) -

    -Sets the gamma value at which the image will be viewed to gamma. If the image format stores a gamma value for which the -image is intended to be used, then this setting will be used to -modify the image. Setting to 0.0 will disable gamma correction -(i.e. any specification in the file will be ignored). -

    The default value is 0.0. -

    See also gamma(). - -

    void TQImageIO::setIODevice ( TQIODevice * ioDevice ) -

    -Sets the IO device to be used for reading or writing an image. -

    Setting the IO device allows images to be read/written to any -block-oriented TQIODevice. -

    If ioDevice is not null, this IO device will override file name -settings. -

    See also setFileName(). - -

    void TQImageIO::setImage ( const TQImage & image ) -

    -Sets the image to image. -

    See also image(). - -

    void TQImageIO::setParameters ( const char * parameters ) -

    -Sets the image's parameter string to parameters. This is for -image handlers that require special parameters. -

    Although the current image formats supported by TQt ignore the -parameters string, it may be used in future extensions or by -contributions (for example, JPEG). -

    See also parameters(). - -

    void TQImageIO::setQuality ( int q ) -

    -Sets the quality of the written image to q, related to the -compression ratio. -

    q must be in the range -1..100. Specify 0 to obtain small -compressed files, 100 for large uncompressed files. (-1 signifies -the default compression.) -

    See also quality() and TQImage::save(). - -

    void TQImageIO::setStatus ( int status ) -

    -Sets the image IO status to status. A non-zero value indicates -an error, whereas 0 means that the IO operation was successful. -

    See also status(). - -

    int TQImageIO::status () const -

    - -

    Returns the image's IO status. A non-zero value indicates an -error, whereas 0 means that the IO operation was successful. -

    See also setStatus(). - -

    bool TQImageIO::write () -

    -Writes an image to an IO device and returns TRUE if the image was -successfully written; otherwise returns FALSE. -

    Before writing an image you must set an IO device or a file name. -If both an IO device and a file name have been set, the IO device -will be used. -

    The image will be written using the specified image format. -

    Example: -

    -        TQImageIO iio;
    -        TQImage   im;
    -        im = pixmap; // convert to image
    -        iio.setImage( im );
    -        iio.setFileName( "vegeburger.bmp" );
    -        iio.setFormat( "BMP" );
    -        if ( iio.write() )
    -            // returned TRUE if written successfully
    -    
    - -

    See also setIODevice(), setFileName(), setFormat(), read(), and TQPixmap::save(). - - -


    -This file is part of the TQt toolkit. -Copyright © 1995-2007 -Trolltech. All Rights Reserved.


    - -
    Copyright © 2007 -TrolltechTrademarks -
    TQt 3.3.8
    -
    - diff --git a/doc/html/qmacmime.html b/doc/html/qmacmime.html index 04208b70e..ed23e8808 100644 --- a/doc/html/qmacmime.html +++ b/doc/html/qmacmime.html @@ -76,8 +76,8 @@ and supported by TQTextDrag.
  • kScrapFlavorTypeText - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag.
  • kScrapFlavorTypePicture - converted to "image/format", where format is -a TQt image format, -and supported by TQImageDrag. +a TQt image format, +and supported by TQImageDrag.
  • kDragFlavorTypeHFS - converted to "text/uri-list", and supported by TQUriDrag. diff --git a/doc/html/qmag-example.html b/doc/html/qmag-example.html index f65ca6bf9..4887b6b37 100644 --- a/doc/html/qmag-example.html +++ b/doc/html/qmag-example.html @@ -55,7 +55,7 @@ magnified area as a .bmp file. #include <ntqcombobox.h> #include <ntqpushbutton.h> #include <ntqpixmap.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqlabel.h> #include <ntqfiledialog.h> #include <ntqregexp.h> @@ -97,7 +97,7 @@ private: TQPushButton *quitButton; TQPixmap pm; // pixmap, magnified TQPixmap p; // pixmap - TQImage image; // image of pixmap (for RGB) + TQImage image; // image of pixmap (for RGB) TQLabel *rgb; int yoffset; // pixels in addition to the actual picture int z; // magnification factor @@ -375,9 +375,9 @@ void MagWidget::grabAround(TQPoint pos) x = e->pos().x() / z; y = (e->pos().y() - ( zoom ? zoom->height() : 0 ) - 4) / z; TQString pixelinfo; - if ( image.valid(x,y) ) + if ( image.valid(x,y) ) { - TQRgb px = image.pixel(x,y); + TQRgb px = image.pixel(x,y); pixelinfo.sprintf(" %3d,%3d,%3d #%02x%02x%02x", tqRed(px), tqGreen(px), tqBlue(px), tqRed(px), tqGreen(px), tqBlue(px)); diff --git a/doc/html/qmimesource.html b/doc/html/qmimesource.html index fb6fe2923..eec22c61b 100644 --- a/doc/html/qmimesource.html +++ b/doc/html/qmimesource.html @@ -87,7 +87,7 @@ format. Returns TRUE if the object can provide the data in format mimeType; otherwise returns FALSE.

    If you inherit from TQMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such -as TQTextDrag::canDecode() and TQImageDrag::canDecode(). +as TQTextDrag::canDecode() and TQImageDrag::canDecode().

    Example: iconview/simple_dd/main.cpp.

    Reimplemented in TQDropEvent. diff --git a/doc/html/qmimesourcefactory.html b/doc/html/qmimesourcefactory.html index 6706511e4..4261a5e0e 100644 --- a/doc/html/qmimesourcefactory.html +++ b/doc/html/qmimesourcefactory.html @@ -69,7 +69,7 @@ The TQMimeSourceFactory class is an extensible provider of mime-typed data. collection of information. Each piece of information is represented by a TQMimeSource object which can be examined and converted to concrete data types by functions such as -TQImageDrag::canDecode() and TQImageDrag::decode(). +TQImageDrag::canDecode() and TQImageDrag::decode().

    The base TQMimeSourceFactory can be used in two ways: as an abstraction of a collection of files or as specifically stored data. For it to access files, call setFilePath() before accessing @@ -97,7 +97,7 @@ as:

  • To be able to use this image within some rich text, for example -inside a TQLabel, you must create a TQImage from the raw data and +inside a TQLabel, you must create a TQImage from the raw data and insert it into the factory with a unique name:

         TQMimeSourceFactory::defaultFactory()->setImage( "myimage", TQImage(myimage_data) );
    @@ -150,7 +150,7 @@ call, so you should immediately decode the result.
     store, the factory tries to access the local filesystem. If abs_name isn't an absolute file name, the factory will search for
     it in all defined paths (see setFilePath()).
     

    The factory understands all the image formats supported by -TQImageIO. Any other mime types are determined by the file name +TQImageIO. Any other mime types are determined by the file name extension. The default settings are

         setExtensionType("html", "text/html;charset=iso8859-1");
    @@ -243,11 +243,11 @@ Sets the list of directories that will be searched when named data
     is requested to the those given in the string list path.
     

    See also filePath(). -

    void TQMimeSourceFactory::setImage ( const TQString & abs_name, const TQImage & image ) [virtual] +

    void TQMimeSourceFactory::setImage ( const TQString & abs_name, const TQImage & image ) [virtual]

    Sets image to be the data item associated with the absolute name abs_name. -

    Equivalent to setData(abs_name, new TQImageDrag(image)). +

    Equivalent to setData(abs_name, new TQImageDrag(image)).

    void TQMimeSourceFactory::setPixmap ( const TQString & abs_name, const TQPixmap & pixmap ) [virtual]

    diff --git a/doc/html/qnamespace-h.html b/doc/html/qnamespace-h.html index bf02d1c9f..fcf9c29b6 100644 --- a/doc/html/qnamespace-h.html +++ b/doc/html/qnamespace-h.html @@ -284,7 +284,7 @@ public: // Image conversion flags. The unusual ordering is caused by // compatibility and default requirements. - // Documented in qimage.cpp + // Documented in tqimage.cpp enum ImageConversionFlags { ColorMode_Mask = 0x00000003, diff --git a/doc/html/qnpinstance.html b/doc/html/qnpinstance.html index 6bbabe7b0..e321d6a97 100644 --- a/doc/html/qnpinstance.html +++ b/doc/html/qnpinstance.html @@ -90,7 +90,7 @@ called first (assuming the <EMBED> tag has a SRC parameter). first call to newWindow(). This includes any use of TQPaintDevice (i.e. TQPixmap, TQWidget, and all subclasses), TQApplication, anything related to TQPainter (TQBrush, etc.), fonts, TQMovie, TQToolTip, etc. -Useful classes which specifically can be used are TQImage, +Useful classes which specifically can be used are TQImage, TQFile, and TQBuffer.

    This restriction can easily be accommodated by structuring your plugin so that the task of the TQNPInstance is to gather data, diff --git a/doc/html/qpngimagepacker.html b/doc/html/qpngimagepacker.html index 4797264be..a471fc6ae 100644 --- a/doc/html/qpngimagepacker.html +++ b/doc/html/qpngimagepacker.html @@ -62,7 +62,7 @@ the desired quality and compression requirements). result (e.g. converting from 32-bit to 8-bit), use the conversionflags to specify how you'd prefer this to happen.

    See also TQt::ImageConversionFlags. -

    bool TQPNGImagePacker::packImage ( const TQImage & img ) +

    bool TQPNGImagePacker::packImage ( const TQImage & img )

    Adds the image img to the PNG animation, analyzing the differences between this and the previous image to improve diff --git a/doc/html/qpngio-h.html b/doc/html/qpngio-h.html index c57f94e3c..e73f684e3 100644 --- a/doc/html/qpngio-h.html +++ b/doc/html/qpngio-h.html @@ -78,7 +78,7 @@ body { background: #ffffff; color: black; } #define TQPNGIO_H #ifndef QT_H -#include "ntqimage.h" +#include "tqimage.h" #endif // QT_H #ifndef TQT_NO_IMAGEIO_PNG diff --git a/doc/html/qscreen.html b/doc/html/qscreen.html index 81b286cf0..20ac3e80d 100644 --- a/doc/html/qscreen.html +++ b/doc/html/qscreen.html @@ -255,7 +255,7 @@ This is an overloaded member function, provided for convenience. It behaves esse application. Used by the rotated driver; the TQScreen implementation simply returns r. -

    TQImage TQScreen::mapFromDevice ( const TQImage & i ) const [virtual] +

    TQImage TQScreen::mapFromDevice ( const TQImage & i ) const [virtual]

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

    Transforms an image so that it matches the application coordinate @@ -288,7 +288,7 @@ This is an overloaded member function, provided for convenience. It behaves esse

    Map a user coordinate to the one to actually draw. Used by the rotated driver; the TQScreen implementation simply returns r. -

    TQImage TQScreen::mapToDevice ( const TQImage & i ) const [virtual] +

    TQImage TQScreen::mapToDevice ( const TQImage & i ) const [virtual]

    This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

    Transforms an image so that it fits the device coordinate space diff --git a/doc/html/qt.dcf b/doc/html/qt.dcf index 85fcc0afa..d031b4c6f 100644 --- a/doc/html/qt.dcf +++ b/doc/html/qt.dcf @@ -3567,170 +3567,170 @@

    -
    - TQImage - Endian - ScaleMode - allGray - bitOrder - bits - bytesPerLine - color - colorTable - convertBitOrder - convertDepth - convertDepthWithPalette - copy - create - createAlphaMask - createHeuristicMask - depth - detach - dotsPerMeterX - dotsPerMeterY - fill - fromMimeSource - hasAlphaBuffer - height - imageFormat - inputFormatList - inputFormats - invertPixels - isGrayscale - isNull - jumpTable - load - loadFromData - mirror - numBytes - numColors - offset - operator!= - operator= - operator== - outputFormatList - outputFormats - pixel - pixelIndex - rect - reset - save - scale - scaleHeight - scaleWidth - scanLine - setAlphaBuffer - setColor - setDotsPerMeterX - setDotsPerMeterY - setNumColors - setOffset - setPixel - setText - size - smoothScale - swapRGB - systemBitOrder - systemByteOrder - text - textKeys - textLanguages - textList - valid - width - xForm - ~TQImage - bitBlt - operator<< - operator>> -
    -
    -
    -
    - QImageConsumer - changed - end - frameDone - setFramePeriod - setLooping - setSize -
    +
    + TQImage + Endian + ScaleMode + allGray + bitOrder + bits + bytesPerLine + color + colorTable + convertBitOrder + convertDepth + convertDepthWithPalette + copy + create + createAlphaMask + createHeuristicMask + depth + detach + dotsPerMeterX + dotsPerMeterY + fill + fromMimeSource + hasAlphaBuffer + height + imageFormat + inputFormatList + inputFormats + invertPixels + isGrayscale + isNull + jumpTable + load + loadFromData + mirror + numBytes + numColors + offset + operator!= + operator= + operator== + outputFormatList + outputFormats + pixel + pixelIndex + rect + reset + save + scale + scaleHeight + scaleWidth + scanLine + setAlphaBuffer + setColor + setDotsPerMeterX + setDotsPerMeterY + setNumColors + setOffset + setPixel + setText + size + smoothScale + swapRGB + systemBitOrder + systemByteOrder + text + textKeys + textLanguages + textList + valid + width + xForm + ~TQImage + bitBlt + operator<< + operator>> +
    +
    +
    +
    + TQImageConsumer + changed + end + frameDone + setFramePeriod + setLooping + setSize +
    -
    - QImageDecoder - decode - format - formatName - image - inputFormats - registerDecoderFactory - unregisterDecoderFactory - ~QImageDecoder -
    +
    + TQImageDecoder + decode + format + formatName + image + inputFormats + registerDecoderFactory + unregisterDecoderFactory + ~TQImageDecoder +
    -
    - QImageDrag - canDecode - decode - setImage - ~QImageDrag -
    +
    + TQImageDrag + canDecode + decode + setImage + ~TQImageDrag +
    -
    - QImageFormat - decode -
    +
    + TQImageFormat + decode +
    -
    - QImageFormatPlugin - installIOHandler - keys - ~QImageFormatPlugin -
    -
    -
    -
    - QImageFormatType - decoderFor - formatName - ~QImageFormatType -
    +
    + TQImageFormatPlugin + installIOHandler + keys + ~TQImageFormatPlugin +
    +
    +
    +
    + TQImageFormatType + decoderFor + formatName + ~TQImageFormatType +
    -
    - QImageIO - defineIOHandler - description - fileName - format - gamma - image - imageFormat - init - inputFormats - ioDevice - outputFormats - parameters - quality - read - setDescription - setFileName - setFormat - setGamma - setIODevice - setImage - setParameters - setQuality - setStatus - status - write - ~QImageIO -
    -
    +
    + TQImageIO + defineIOHandler + description + fileName + format + gamma + image + imageFormat + init + inputFormats + ioDevice + outputFormats + parameters + quality + read + setDescription + setFileName + setFormat + setGamma + setIODevice + setImage + setParameters + setQuality + setStatus + status + write + ~TQImageIO +
    +
    QIMEvent diff --git a/doc/html/qwindowsmime.html b/doc/html/qwindowsmime.html index b47810182..42e354dc8 100644 --- a/doc/html/qwindowsmime.html +++ b/doc/html/qwindowsmime.html @@ -77,8 +77,8 @@ and supported by TQTextDrag.
  • CF_TEXT - converted to "text/plain;charset=system" or "text/plain" and supported by TQTextDrag.
  • CF_DIB - converted to "image/*", where * is -a TQt image format, -and supported by TQImageDrag. +a TQt image format, +and supported by TQImageDrag.
  • CF_HDROP - converted to "text/uri-list", and supported by TQUriDrag. diff --git a/doc/html/qwindowsystem_qws-h.html b/doc/html/qwindowsystem_qws-h.html index 02a40b3a9..7dd47c9bb 100644 --- a/doc/html/qwindowsystem_qws-h.html +++ b/doc/html/qwindowsystem_qws-h.html @@ -80,7 +80,7 @@ body { background: #ffffff; color: black; } #include "tqmap.h" #include "ntqdatetime.h" #include "tqptrlist.h" -#include "ntqimage.h" +#include "tqimage.h" #include "qwsproperty_qws.h" #include "qwscommand_qws.h" diff --git a/doc/html/qwsserver.html b/doc/html/qwsserver.html index 9467193d7..9a04af45b 100644 --- a/doc/html/qwsserver.html +++ b/doc/html/qwsserver.html @@ -277,7 +277,7 @@ defined. The default is platform-dependent. Set the mouse driver m to use if $TQWS_MOUSE_PROTO is not defined. The default is platform-dependent. -

    void TQWSServer::setDesktopBackground ( const TQImage & img ) [static] +

    void TQWSServer::setDesktopBackground ( const TQImage & img ) [static]

    Sets the image img to be used as the background in the absence of obscuring windows. diff --git a/doc/html/scribble-example.html b/doc/html/scribble-example.html index 753a87546..0d39f4c04 100644 --- a/doc/html/scribble-example.html +++ b/doc/html/scribble-example.html @@ -153,7 +153,7 @@ protected slots: #include <ntqcolordialog.h> #include <ntqfiledialog.h> #include <ntqcursor.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqstrlist.h> #include <ntqpopupmenu.h> #include <ntqintdict.h> @@ -215,7 +215,7 @@ void Canvas::clearScreen() r.setRight( r.right() + penWidth() ); r.setBottom( r.bottom() + penWidth() ); - bitBlt( this, r.x(), r.y(), &buffer, r.x(), r.y(), r.width(), r.height() ); + bitBlt( this, r.x(), r.y(), &buffer, r.x(), r.y(), r.width(), r.height() ); } } @@ -231,7 +231,7 @@ void Canvas::clearScreen() TQPixmap tmp( buffer ); buffer.resize( w, h ); buffer.fill( colorGroup().base() ); - bitBlt( &buffer, 0, 0, &tmp, 0, 0, tmp.width(), tmp.height() ); + bitBlt( &buffer, 0, 0, &tmp, 0, 0, tmp.width(), tmp.height() ); } void Canvas::paintEvent( TQPaintEvent *e ) @@ -241,7 +241,7 @@ void Canvas::clearScreen() TQMemArray<TQRect> rects = e->region().rects(); for ( uint i = 0; i < rects.count(); i++ ) { TQRect r = rects[(int)i]; - bitBlt( this, r.x(), r.y(), &buffer, r.x(), r.y(), r.width(), r.height() ); + bitBlt( this, r.x(), r.y(), &buffer, r.x(), r.y(), r.width(), r.height() ); } } @@ -282,8 +282,8 @@ void Scribble::slotSave() TQIntDict<TQString> formats; formats.setAutoDelete( TRUE ); - for ( unsigned int i = 0; i < TQImageIO::outputFormats().count(); i++ ) { - TQString str = TQString( TQImageIO::outputFormats().at( i ) ); + for ( unsigned int i = 0; i < TQImageIO::outputFormats().count(); i++ ) { + TQString str = TQString( TQImageIO::outputFormats().at( i ) ); formats.insert( menu->insertItem( TQString( "%1..." ).arg( str ) ), new TQString( str ) ); } diff --git a/doc/html/shared.html b/doc/html/shared.html index ef13d55fb..3a80c2d95 100644 --- a/doc/html/shared.html +++ b/doc/html/shared.html @@ -50,7 +50,7 @@ seem heavyweight.
  • TQFontInfoGeneral information about fonts
    TQFontMetricsFont metrics information
    TQIconSetSet of icons with different styles and sizes -
    TQImageHardware-independent pixmap representation with direct access to the pixel data +
    TQImageHardware-independent pixmap representation with direct access to the pixel data
    TQMapValue-based template class that provides a dictionary
    TQPairValue-based template class that provides a pair of elements
    TQPaletteColor groups for each widget state diff --git a/doc/html/shclass.html b/doc/html/shclass.html index 9e3a51bf6..f57940236 100644 --- a/doc/html/shclass.html +++ b/doc/html/shclass.html @@ -169,7 +169,7 @@ explicitly shared:

    These classes have a detach() function that can be called if you want your object to get a private copy of the shared data. They also have a copy() function that returns a deep copy with a reference count of 1. -

    The same is true for TQImage, which does not inherit TQMemArray. TQMovie is also explicitly shared, but it does not support detach() or +

    The same is true for TQImage, which does not inherit TQMemArray. TQMovie is also explicitly shared, but it does not support detach() or copy().

    Implicitly Shared Classes

    @@ -214,7 +214,7 @@ functions by value without concern for the copying overhead.

    In this example, p1 and p2 share data until TQPainter::begin() is called for p2, because painting a pixmap will modify it. The same -also happens if anything is bitBlt()'ed into +also happens if anything is bitBlt()'ed into p2.

    Warning: Do not copy an implicitly shared container (TQMap, TQValueVector, etc.) while you are iterating over it. diff --git a/doc/html/showimg-example.html b/doc/html/showimg-example.html index 561715f38..5d5884269 100644 --- a/doc/html/showimg-example.html +++ b/doc/html/showimg-example.html @@ -51,7 +51,7 @@ format (GIF, BMP, PPM, XMP, etc.). #define SHOWIMG_H #include <tqwidget.h> -#include <ntqimage.h> +#include <tqimage.h> class TQLabel; @@ -80,7 +80,7 @@ private: int alloc_context; bool convertEvent( TQMouseEvent* e, int& x, int& y ); TQString filename; - TQImage image; // the loaded image + TQImage image; // the loaded image TQPixmap pm; // the converted pixmap TQPixmap pmScaled; // the scaled pixmap @@ -103,7 +103,7 @@ private: int clickx, clicky; bool may_be_other; static ImageViewer* other; - void setImage(const TQImage& newimage); + void setImage(const TQImage& newimage); private slots: void to1Bit(); @@ -178,7 +178,7 @@ private slots: menubar = new TQMenuBar(this); menubar->setSeparator( TQMenuBar::InWindowsStyle ); - TQStrList fmt = TQImage::outputFormats(); + TQStrList fmt = TQImage::outputFormats(); saveimage = new TQPopupMenu( menubar ); savepixmap = new TQPopupMenu( menubar ); for (const char* f = fmt.first(); f; f = fmt.next()) { @@ -684,7 +684,7 @@ void ImageViewer::giveHelp() "</blockquote>" "<p>Supported input formats:" "<blockquote>"; - helptext += TQImage::inputFormatList().join(", "); + helptext += TQImage::inputFormatList().join(", "); helptext += "</blockquote>"; helpmsg = new TQMessageBox( "Help", helptext, @@ -711,7 +711,7 @@ void ImageViewer::copyFrom(ImageViewer* s) dy = picky; sy -= sh-1; } - bitBlt( &image, dx, dy, &s->image, sx, sy, sw, sh ); + bitBlt( &image, dx, dy, &s->image, sx, sy, sw, sh ); reconvertImage(); repaint( image.hasAlphaBuffer() ); } @@ -743,15 +743,15 @@ void ImageViewer::copy() void ImageViewer::paste() { #ifndef TQT_NO_MIMECLIPBOARD - TQImage p = TQApplication::clipboard()->image(); - if ( !p.isNull() ) { + TQImage p = TQApplication::clipboard()->image(); + if ( !p.isNull() ) { filename = "pasted"; setImage(p); } #endif } -void ImageViewer::setImage(const TQImage& newimage) +void ImageViewer::setImage(const TQImage& newimage) { image = newimage; @@ -825,7 +825,7 @@ void ImageViewer::toBitDepth(int d) #include "showimg.h" #include "imagefip.h" #include <ntqapplication.h> -#include <ntqimage.h> +#include <tqimage.h> int main( int argc, char **argv ) { diff --git a/doc/html/simple-application-example.html b/doc/html/simple-application-example.html index a40441fc4..ce0054f5f 100644 --- a/doc/html/simple-application-example.html +++ b/doc/html/simple-application-example.html @@ -103,7 +103,7 @@ private: #include "application.h" -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <ntqtoolbar.h> #include <ntqtoolbutton.h> diff --git a/doc/html/small-table-example-example.html b/doc/html/small-table-example-example.html index 84802592b..6e46bb553 100644 --- a/doc/html/small-table-example-example.html +++ b/doc/html/small-table-example-example.html @@ -48,7 +48,7 @@ This example displays a TQTable and some ntqapplication.h> #include <ntqtable.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <ntqstringlist.h> @@ -74,8 +74,8 @@ int main( int argc, char **argv ) header->setLabel( 5, TQObject::tr( "Combos" ) ); table.setColumnMovingEnabled(TRUE); - TQImage img( qtlogo_xpm ); - TQPixmap pix = img.scaleHeight( table.rowHeight(3) ); + TQImage img( qtlogo_xpm ); + TQPixmap pix = img.scaleHeight( table.rowHeight(3) ); table.setPixmap( 3, 2, pix ); table.setText( 3, 2, "A Pixmap" ); diff --git a/doc/html/table-small-table-demo-main-cpp.html b/doc/html/table-small-table-demo-main-cpp.html index 642865021..9369fbc93 100644 --- a/doc/html/table-small-table-demo-main-cpp.html +++ b/doc/html/table-small-table-demo-main-cpp.html @@ -44,7 +44,7 @@ body { background: #ffffff; color: black; } #include <ntqapplication.h> #include <ntqtable.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <ntqstringlist.h> @@ -70,8 +70,8 @@ int main( int argc, char **argv ) header->setLabel( 5, TQObject::tr( "Combos" ) ); table.setColumnMovingEnabled(TRUE); - TQImage img( qtlogo_xpm ); - TQPixmap pix = img.scaleHeight( table.rowHeight(3) ); + TQImage img( qtlogo_xpm ); + TQPixmap pix = img.scaleHeight( table.rowHeight(3) ); table.setPixmap( 3, 2, pix ); table.setText( 3, 2, "A Pixmap" ); diff --git a/doc/html/themes-example.html b/doc/html/themes-example.html index 4f73df27c..834e07a33 100644 --- a/doc/html/themes-example.html +++ b/doc/html/themes-example.html @@ -156,7 +156,7 @@ private: #include "ntqpalette.h" // for now #include "tqwidget.h" #include "ntqlabel.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" @@ -914,69 +914,69 @@ enum { PointUp, PointDown, PointLeft, PointRight }; // we simply create a nice TQColorGroup with a couple of fancy wood // pixmaps here and apply to it all widgets - TQImage img(button_xpm); - TQImage orig = img; - orig.detach(); + TQImage img(button_xpm); + TQImage orig = img; + orig.detach(); TQPixmap button; button.convertFromImage(img); int i; - for (i=0; i<img.numColors(); i++) { - TQRgb rgb = img.color(i); + for (i=0; i<img.numColors(); i++) { + TQRgb rgb = img.color(i); TQColor c(rgb); rgb = c.dark(120).rgb(); - img.setColor(i,rgb); + img.setColor(i,rgb); } TQPixmap mid; mid.convertFromImage(img); img = orig; - img.detach(); - for (i=0; i<img.numColors(); i++) { - TQRgb rgb = img.color(i); + img.detach(); + for (i=0; i<img.numColors(); i++) { + TQRgb rgb = img.color(i); TQColor c(rgb); rgb = c.light().rgb(); - img.setColor(i,rgb); + img.setColor(i,rgb); } TQPixmap light; light.convertFromImage(img); img = orig; - img.detach(); - for (i=0; i<img.numColors(); i++) { - TQRgb rgb = img.color(i); + img.detach(); + for (i=0; i<img.numColors(); i++) { + TQRgb rgb = img.color(i); TQColor c(rgb); rgb = c.dark(180).rgb(); - img.setColor(i,rgb); + img.setColor(i,rgb); } TQPixmap dark; dark.convertFromImage(img); - TQImage bgimage(polish_xpm); + TQImage bgimage(polish_xpm); TQPixmap background; background.convertFromImage(bgimage); img = bgimage; - img.detach(); - for (i=0; i<img.numColors(); i++) { - TQRgb rgb = img.color(i); + img.detach(); + for (i=0; i<img.numColors(); i++) { + TQRgb rgb = img.color(i); TQColor c(rgb); rgb = c.dark(180).rgb(); - img.setColor(i,rgb); + img.setColor(i,rgb); } sunkenDark = new TQPixmap; sunkenDark->convertFromImage(img); img = bgimage; - img.detach(); - for (i=0; i<img.numColors(); i++) { - TQRgb rgb = img.color(i); + img.detach(); + for (i=0; i<img.numColors(); i++) { + TQRgb rgb = img.color(i); TQColor c(rgb); rgb = c.light(130).rgb(); - img.setColor(i,rgb); + img.setColor(i,rgb); } sunkenLight= new TQPixmap; sunkenLight->convertFromImage(img); @@ -1652,7 +1652,7 @@ private: #include "ntqpalette.h" // for now #include "tqwidget.h" #include "ntqlabel.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" diff --git a/doc/html/titleindex b/doc/html/titleindex index a639bbc1b..a855353e6 100644 --- a/doc/html/titleindex +++ b/doc/html/titleindex @@ -512,22 +512,22 @@ QIconView Class | ntqiconview.html QIconView Member List | qiconview-members.html QIconViewItem Class | qiconviewitem.html QIconViewItem Member List | qiconviewitem-members.html -TQImage Class | ntqimage.html -TQImage Member List | qimage-members.html -QImageConsumer Class | qimageconsumer.html -QImageConsumer Member List | qimageconsumer-members.html -QImageDecoder Class | qimagedecoder.html -QImageDecoder Member List | qimagedecoder-members.html -QImageDrag Class | qimagedrag.html -QImageDrag Member List | qimagedrag-members.html -QImageFormat Class | qimageformat.html -QImageFormat Member List | qimageformat-members.html -QImageFormatPlugin Class | ntqimageformatplugin.html -QImageFormatPlugin Member List | qimageformatplugin-members.html -QImageFormatType Class | qimageformattype.html -QImageFormatType Member List | qimageformattype-members.html -QImageIO Class | qimageio.html -QImageIO Member List | qimageio-members.html +TQImage Class | tqimage.html +TQImage Member List | tqimage-members.html +TQImageConsumer Class | tqimageconsumer.html +TQImageConsumer Member List | tqimageconsumer-members.html +TQImageDecoder Class | tqimagedecoder.html +TQImageDecoder Member List | tqimagedecoder-members.html +TQImageDrag Class | tqimagedrag.html +TQImageDrag Member List | tqimagedrag-members.html +TQImageFormat Class | tqimageformat.html +TQImageFormat Member List | tqimageformat-members.html +TQImageFormatPlugin Class | tqimageformatplugin.html +TQImageFormatPlugin Member List | tqimageformatplugin-members.html +TQImageFormatType Class | tqimageformattype.html +TQImageFormatType Member List | tqimageformattype-members.html +TQImageIO Class | tqimageio.html +TQImageIO Member List | tqimageio-members.html QInputDialog Class | ntqinputdialog.html QInputDialog Member List | qinputdialog-members.html QIntCache Class | ntqintcache.html @@ -1256,8 +1256,8 @@ ntqhostaddress.h Include File | qhostaddress-h.html ntqhttp.h Include File | qhttp-h.html ntqiconset.h Include File | qiconset-h.html ntqiconview.h Include File | qiconview-h.html -ntqimage.h Include File | qimage-h.html -ntqimageformatplugin.h Include File | qimageformatplugin-h.html +tqimage.h Include File | tqimage-h.html +tqimageformatplugin.h Include File | tqimageformatplugin-h.html ntqinputdialog.h Include File | qinputdialog-h.html ntqintcache.h Include File | qintcache-h.html ntqintdict.h Include File | qintdict-h.html diff --git a/doc/html/tqcanvaspixmap.html b/doc/html/tqcanvaspixmap.html index eec83185d..5fc01cef7 100644 --- a/doc/html/tqcanvaspixmap.html +++ b/doc/html/tqcanvaspixmap.html @@ -63,11 +63,11 @@ you retrieve a frame (pixmap) from a TQCanvasSprite it will be returned as a TQCanvasPixmap.

    The pixmap is a TQPixmap and can only be set in the constructor. There are three different constructors, one taking a TQPixmap, one -a TQImage and one a file name that refers to a file in any -supported file format (see TQImageIO). +a TQImage and one a file name that refers to a file in any +supported file format (see TQImageIO).

    TQCanvasPixmap can have a hotspot which is defined in terms of an (x, y) offset. When you create a TQCanvasPixmap from a PNG file or from -a TQImage that has a TQImage::offset(), the offset() is initialized +a TQImage that has a TQImage::offset(), the offset() is initialized appropriately, otherwise the constructor leaves it at (0, 0). You can set it later using setOffset(). When the TQCanvasPixmap is used in a TQCanvasSprite, the offset position is the point at @@ -83,7 +83,7 @@ stays in the same position. Constructs a TQCanvasPixmap that uses the image stored in datafilename. -

    TQCanvasPixmap::TQCanvasPixmap ( const TQImage & image ) +

    TQCanvasPixmap::TQCanvasPixmap ( const TQImage & image )

    Constructs a TQCanvasPixmap from the image image. diff --git a/doc/html/tqimage-h.html b/doc/html/tqimage-h.html new file mode 100644 index 000000000..2e0e2a467 --- /dev/null +++ b/doc/html/tqimage-h.html @@ -0,0 +1,470 @@ + + + + + +tqimage.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqimage.h

    + +

    This is the verbatim text of the tqimage.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqimage.h   3.3.8   edited Jan 11 14:38 $
    +**
    +** Definition of TQImage and TQImageIO classes
    +**
    +** Created : 950207
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the kernel module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQIMAGE_H
    +#define TQIMAGE_H
    +
    +#ifndef QT_H
    +#include "ntqpixmap.h"
    +#include "ntqstrlist.h"
    +#include "ntqstringlist.h"
    +#endif // QT_H
    +
    +class TQImageDataMisc; // internal
    +#ifndef TQT_NO_IMAGE_TEXT
    +class TQ_EXPORT TQImageTextKeyLang {
    +public:
    +    TQImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { }
    +    TQImageTextKeyLang() { }
    +
    +    TQCString key;
    +    TQCString lang;
    +
    +    bool operator< (const TQImageTextKeyLang& other) const
    +	{ return key < other.key || key==other.key && lang < other.lang; }
    +    bool operator== (const TQImageTextKeyLang& other) const
    +	{ return key==other.key && lang==other.lang; }
    +};
    +#endif //TQT_NO_IMAGE_TEXT
    +
    +
    +class TQ_EXPORT TQImage
    +{
    +public:
    +    enum Endian { IgnoreEndian, BigEndian, LittleEndian };
    +
    +    TQImage();
    +    TQImage( int width, int height, int depth, int numColors=0,
    +	    Endian bitOrder=IgnoreEndian );
    +    TQImage( const TQSize&, int depth, int numColors=0,
    +	    Endian bitOrder=IgnoreEndian );
    +#ifndef TQT_NO_IMAGEIO
    +    TQImage( const TQString &fileName, const char* format=0 );
    +    TQImage( const char * const xpm[] );
    +    TQImage( const TQByteArray &data );
    +#endif
    +    TQImage( uchar* data, int w, int h, int depth,
    +		TQRgb* colortable, int numColors,
    +		Endian bitOrder );
    +#ifdef TQ_WS_QWS
    +    TQImage( uchar* data, int w, int h, int depth, int pbl,
    +		TQRgb* colortable, int numColors,
    +		Endian bitOrder );
    +#endif
    +    TQImage( const TQImage & );
    +   ~TQImage();
    +
    +    TQImage     &operator=( const TQImage & );
    +    TQImage     &operator=( const TQPixmap & );
    +    bool	operator==( const TQImage & ) const;
    +    bool	operator!=( const TQImage & ) const;
    +    void	detach();
    +    TQImage	copy()		const;
    +    TQImage	copy(int x, int y, int w, int h, int conversion_flags=0) const;
    +    TQImage	copy(const TQRect&)	const;
    +#ifndef TQT_NO_MIME
    +    static TQImage fromMimeSource( const TQString& abs_name );
    +#endif
    +    bool	isNull()	const	{ return data->bits == 0; }
    +
    +    int		width()		const	{ return data->w; }
    +    int		height()	const	{ return data->h; }
    +    TQSize	size()		const	{ return TQSize(data->w,data->h); }
    +    TQRect	rect()		const	{ return TQRect(0,0,data->w,data->h); }
    +    int		depth()		const	{ return data->d; }
    +    int		numColors()	const	{ return data->ncols; }
    +    Endian	bitOrder()	const	{ return (Endian) data->bitordr; }
    +
    +    TQRgb	color( int i )	const;
    +    void	setColor( int i, TQRgb c );
    +    void	setNumColors( int );
    +
    +    bool	hasAlphaBuffer() const;
    +    void	setAlphaBuffer( bool );
    +
    +    bool	allGray() const;
    +    bool        isGrayscale() const;
    +
    +    uchar      *bits()		const;
    +    uchar      *scanLine( int ) const;
    +    uchar     **jumpTable()	const;
    +    TQRgb       *colorTable()	const;
    +    int		numBytes()	const;
    +    int		bytesPerLine()	const;
    +
    +#ifdef TQ_WS_QWS
    +    TQGfx * graphicsContext();
    +#endif
    +
    +    bool	create( int width, int height, int depth, int numColors=0,
    +			Endian bitOrder=IgnoreEndian );
    +    bool	create( const TQSize&, int depth, int numColors=0,
    +			Endian bitOrder=IgnoreEndian );
    +    void	reset();
    +
    +    void	fill( uint pixel );
    +    void	invertPixels( bool invertAlpha = TRUE );
    +
    +    TQImage	convertDepth( int ) const;
    +#ifndef TQT_NO_IMAGE_TRUECOLOR
    +    TQImage	convertDepthWithPalette( int, TQRgb* p, int pc, int cf=0 ) const;
    +#endif
    +    TQImage	convertDepth( int, int conversion_flags ) const;
    +    TQImage	convertBitOrder( Endian ) const;
    +
    +    enum ScaleMode {
    +	ScaleFree,
    +	ScaleMin,
    +	ScaleMax
    +    };
    +#ifndef TQT_NO_IMAGE_SMOOTHSCALE
    +    TQImage smoothScale( int w, int h, ScaleMode mode=ScaleFree ) const;
    +    TQImage smoothScale( const TQSize& s, ScaleMode mode=ScaleFree ) const;
    +#endif
    +#ifndef TQT_NO_IMAGE_TRANSFORMATION
    +    TQImage scale( int w, int h, ScaleMode mode=ScaleFree ) const;
    +    TQImage scale( const TQSize& s, ScaleMode mode=ScaleFree ) const;
    +    TQImage scaleWidth( int w ) const;
    +    TQImage scaleHeight( int h ) const;
    +    TQImage xForm( const TQWMatrix &matrix ) const;
    +#endif
    +
    +#ifndef TQT_NO_IMAGE_DITHER_TO_1
    +    TQImage	createAlphaMask( int conversion_flags=0 ) const;
    +#endif
    +#ifndef TQT_NO_IMAGE_HEURISTIC_MASK
    +    TQImage	createHeuristicMask( bool clipTight=TRUE ) const;
    +#endif
    +#ifndef TQT_NO_IMAGE_MIRROR
    +    TQImage	mirror() const;
    +    TQImage	mirror(bool horizontally, bool vertically) const;
    +#endif
    +    TQImage	swapRGB() const;
    +
    +    static Endian systemBitOrder();
    +    static Endian systemByteOrder();
    +
    +#ifndef TQT_NO_IMAGEIO
    +    static const char* imageFormat( const TQString &fileName );
    +    static TQStrList inputFormats();
    +    static TQStrList outputFormats();
    +#ifndef TQT_NO_STRINGLIST
    +    static TQStringList inputFormatList();
    +    static TQStringList outputFormatList();
    +#endif
    +    bool	load( const TQString &fileName, const char* format=0 );
    +    bool	loadFromData( const uchar *buf, uint len,
    +			      const char *format=0 );
    +    bool	loadFromData( TQByteArray data, const char* format=0 );
    +    bool	save( const TQString &fileName, const char* format,
    +		      int quality=-1 ) const;
    +    bool	save( TQIODevice * device, const char* format,
    +		      int quality=-1 ) const;
    +#endif //TQT_NO_IMAGEIO
    +
    +    bool	valid( int x, int y ) const;
    +    int		pixelIndex( int x, int y ) const;
    +    TQRgb	pixel( int x, int y ) const;
    +    void	setPixel( int x, int y, uint index_or_rgb );
    +
    +    // Auxiliary data
    +    int dotsPerMeterX() const;
    +    int dotsPerMeterY() const;
    +    void setDotsPerMeterX(int);
    +    void setDotsPerMeterY(int);
    +    TQPoint offset() const;
    +    void setOffset(const TQPoint&);
    +#ifndef TQT_NO_IMAGE_TEXT
    +    TQValueList<TQImageTextKeyLang> textList() const;
    +    TQStringList textLanguages() const;
    +    TQStringList textKeys() const;
    +    TQString text(const char* key, const char* lang=0) const;
    +    TQString text(const TQImageTextKeyLang&) const;
    +    void setText(const char* key, const char* lang, const TQString&);
    +#endif
    +private:
    +    void	init();
    +    void	reinit();
    +    void	freeBits();
    +    static void	warningIndexRange( const char *, int );
    +
    +    struct TQImageData : public TQShared {	// internal image data
    +	int	w;				// image width
    +	int	h;				// image height
    +	int	d;				// image depth
    +	int	ncols;				// number of colors
    +	int	nbytes;				// number of bytes data
    +	int	bitordr;			// bit order (1 bit depth)
    +	TQRgb   *ctbl;				// color table
    +	uchar **bits;				// image data
    +	bool	alpha;				// alpha buffer
    +	int	dpmx;				// dots per meter X (or 0)
    +	int	dpmy;				// dots per meter Y (or 0)
    +	TQPoint	offset;				// offset in pixels
    +#ifndef TQT_NO_IMAGE_TEXT
    +	TQImageDataMisc* misc;			// less common stuff
    +#endif
    +	bool    ctbl_mine;			// this allocated ctbl
    +    } *data;
    +#ifndef TQT_NO_IMAGE_TEXT
    +    TQImageDataMisc& misc() const;
    +#endif
    +#ifndef TQT_NO_IMAGEIO
    +    bool doImageIO( TQImageIO* io, int quality ) const;
    +#endif
    +    friend TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy,
    +				 const TQImage* src, int sx, int sy,
    +				 int sw, int sh, int conversion_flags );
    +};
    +
    +
    +// TQImage stream functions
    +
    +#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO)
    +TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQImage & );
    +TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQImage & );
    +#endif
    +
    +#ifndef TQT_NO_IMAGEIO
    +class TQIODevice;
    +typedef void (*image_io_handler)( TQImageIO * ); // image IO handler
    +
    +
    +struct TQImageIOData;
    +
    +
    +class TQ_EXPORT TQImageIO
    +{
    +public:
    +    TQImageIO();
    +    TQImageIO( TQIODevice	 *ioDevice, const char *format );
    +    TQImageIO( const TQString &fileName, const char* format );
    +   ~TQImageIO();
    +
    +
    +    const TQImage &image()	const	{ return im; }
    +    int		status()	const	{ return iostat; }
    +    const char *format()	const	{ return frmt; }
    +    TQIODevice  *ioDevice()	const	{ return iodev; }
    +    TQString	fileName()	const	{ return fname; }
    +    int		quality()	const;
    +    TQString	description()	const	{ return descr; }
    +    const char *parameters()	const;
    +    float gamma() const;
    +
    +    void	setImage( const TQImage & );
    +    void	setStatus( int );
    +    void	setFormat( const char * );
    +    void	setIODevice( TQIODevice * );
    +    void	setFileName( const TQString & );
    +    void	setQuality( int );
    +    void	setDescription( const TQString & );
    +    void	setParameters( const char * );
    +    void	setGamma( float );
    +
    +    bool	read();
    +    bool	write();
    +
    +    static const char* imageFormat( const TQString &fileName );
    +    static const char *imageFormat( TQIODevice * );
    +    static TQStrList inputFormats();
    +    static TQStrList outputFormats();
    +
    +    static void defineIOHandler( const char *format,
    +				 const char *header,
    +				 const char *flags,
    +				 image_io_handler read_image,
    +				 image_io_handler write_image );
    +
    +private:
    +    void	init();
    +
    +    TQImage	im;				// image
    +    int		iostat;				// IO status
    +    TQCString	frmt;				// image format
    +    TQIODevice  *iodev;				// IO device
    +    TQString	fname;				// file name
    +    char       *params;				// image parameters //### change to TQImageIOData *d in 3.0
    +    TQString     descr;				// image description
    +    TQImageIOData *d;
    +
    +private:	// Disabled copy constructor and operator=
    +#if defined(TQ_DISABLE_COPY)
    +    TQImageIO( const TQImageIO & );
    +    TQImageIO &operator=( const TQImageIO & );
    +#endif
    +};
    +
    +#endif //TQT_NO_IMAGEIO
    +
    +TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src,
    +		      int sx=0, int sy=0, int sw=-1, int sh=-1,
    +		      int conversion_flags=0 );
    +
    +
    +/*****************************************************************************
    +  TQImage member functions
    + *****************************************************************************/
    +
    +inline bool TQImage::hasAlphaBuffer() const
    +{
    +    return data->alpha;
    +}
    +
    +inline uchar *TQImage::bits() const
    +{
    +    return data->bits ? data->bits[0] : 0;
    +}
    +
    +inline uchar **TQImage::jumpTable() const
    +{
    +    return data->bits;
    +}
    +
    +inline TQRgb *TQImage::colorTable() const
    +{
    +    return data->ctbl;
    +}
    +
    +inline int TQImage::numBytes() const
    +{
    +    return data->nbytes;
    +}
    +
    +inline int TQImage::bytesPerLine() const
    +{
    +    return data->h ? data->nbytes/data->h : 0;
    +}
    +
    +inline TQImage TQImage::copy(const TQRect& r) const
    +{
    +    return copy(r.x(), r.y(), r.width(), r.height());
    +}
    +
    +inline TQRgb TQImage::color( int i ) const
    +{
    +#if defined(QT_CHECK_RANGE)
    +    if ( i >= data->ncols )
    +	warningIndexRange( "color", i );
    +#endif
    +    return data->ctbl ? data->ctbl[i] : (TQRgb)-1;
    +}
    +
    +inline void TQImage::setColor( int i, TQRgb c )
    +{
    +#if defined(QT_CHECK_RANGE)
    +    if ( i >= data->ncols )
    +	warningIndexRange( "setColor", i );
    +#endif
    +    if ( data->ctbl )
    +	data->ctbl[i] = c;
    +}
    +
    +inline uchar *TQImage::scanLine( int i ) const
    +{
    +#if defined(QT_CHECK_RANGE)
    +    if ( i >= data->h )
    +	warningIndexRange( "scanLine", i );
    +#endif
    +    return data->bits ? data->bits[i] : 0;
    +}
    +
    +inline int TQImage::dotsPerMeterX() const
    +{
    +    return data->dpmx;
    +}
    +
    +inline int TQImage::dotsPerMeterY() const
    +{
    +    return data->dpmy;
    +}
    +
    +inline TQPoint TQImage::offset() const
    +{
    +    return data->offset;
    +}
    +
    +
    +#endif // TQIMAGE_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimage-members.html b/doc/html/tqimage-members.html new file mode 100644 index 000000000..6ebc225ac --- /dev/null +++ b/doc/html/tqimage-members.html @@ -0,0 +1,116 @@ + + + + + +TQImage Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImage

    + +

    This is the complete list of member functions for +TQImage, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimage.html b/doc/html/tqimage.html new file mode 100644 index 000000000..74b78d411 --- /dev/null +++ b/doc/html/tqimage.html @@ -0,0 +1,1117 @@ + + + + + +TQImage Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImage Class Reference

    + +

    The TQImage class provides a hardware-independent pixmap +representation with direct access to the pixel data. +More... +

    #include <tqimage.h> +

    List of all member functions. +

    Public Members

    +
      +
    • enum Endian { IgnoreEndian, BigEndian, LittleEndian }
    • +
    • TQImage ()
    • +
    • TQImage ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
    • +
    • TQImage ( const TQSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
    • +
    • TQImage ( const TQString & fileName, const char * format = 0 )
    • +
    • TQImage ( const char * const xpm[] )
    • +
    • TQImage ( const TQByteArray & array )
    • +
    • TQImage ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder )
    • +
    • TQImage ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder )
    • +
    • TQImage ( const TQImage & image )
    • +
    • ~TQImage ()
    • +
    • TQImage & operator= ( const TQImage & image )
    • +
    • TQImage & operator= ( const TQPixmap & pixmap )
    • +
    • bool operator== ( const TQImage & i ) const
    • +
    • bool operator!= ( const TQImage & i ) const
    • +
    • void detach ()
    • +
    • TQImage copy () const
    • +
    • TQImage copy ( int x, int y, int w, int h, int conversion_flags = 0 ) const
    • +
    • TQImage copy ( const TQRect & r ) const
    • +
    • bool isNull () const
    • +
    • int width () const
    • +
    • int height () const
    • +
    • TQSize size () const
    • +
    • TQRect rect () const
    • +
    • int depth () const
    • +
    • int numColors () const
    • +
    • Endian bitOrder () const
    • +
    • TQRgb color ( int i ) const
    • +
    • void setColor ( int i, TQRgb c )
    • +
    • void setNumColors ( int numColors )
    • +
    • bool hasAlphaBuffer () const
    • +
    • void setAlphaBuffer ( bool enable )
    • +
    • bool allGray () const
    • +
    • bool isGrayscale () const
    • +
    • uchar * bits () const
    • +
    • uchar * scanLine ( int i ) const
    • +
    • uchar ** jumpTable () const
    • +
    • TQRgb * colorTable () const
    • +
    • int numBytes () const
    • +
    • int bytesPerLine () const
    • +
    • bool create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
    • +
    • bool create ( const TQSize &, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )
    • +
    • void reset ()
    • +
    • void fill ( uint pixel )
    • +
    • void invertPixels ( bool invertAlpha = TRUE )
    • +
    • TQImage convertDepth ( int depth ) const
    • +
    • TQImage convertDepthWithPalette ( int d, TQRgb * palette, int palette_count, int conversion_flags = 0 ) const
    • +
    • TQImage convertDepth ( int depth, int conversion_flags ) const
    • +
    • TQImage convertBitOrder ( Endian bitOrder ) const
    • +
    • enum ScaleMode { ScaleFree, ScaleMin, ScaleMax }
    • +
    • TQImage smoothScale ( int w, int h, ScaleMode mode = ScaleFree ) const
    • +
    • TQImage smoothScale ( const TQSize & s, ScaleMode mode = ScaleFree ) const
    • +
    • TQImage scale ( int w, int h, ScaleMode mode = ScaleFree ) const
    • +
    • TQImage scale ( const TQSize & s, ScaleMode mode = ScaleFree ) const
    • +
    • TQImage scaleWidth ( int w ) const
    • +
    • TQImage scaleHeight ( int h ) const
    • +
    • TQImage xForm ( const TQWMatrix & matrix ) const
    • +
    • TQImage createAlphaMask ( int conversion_flags = 0 ) const
    • +
    • TQImage createHeuristicMask ( bool clipTight = TRUE ) const
    • +
    • TQImage mirror () const
    • +
    • TQImage mirror ( bool horizontal, bool vertical ) const
    • +
    • TQImage swapRGB () const
    • +
    • bool load ( const TQString & fileName, const char * format = 0 )
    • +
    • bool loadFromData ( const uchar * buf, uint len, const char * format = 0 )
    • +
    • bool loadFromData ( TQByteArray buf, const char * format = 0 )
    • +
    • bool save ( const TQString & fileName, const char * format, int quality = -1 ) const
    • +
    • bool save ( TQIODevice * device, const char * format, int quality = -1 ) const
    • +
    • bool valid ( int x, int y ) const
    • +
    • int pixelIndex ( int x, int y ) const
    • +
    • TQRgb pixel ( int x, int y ) const
    • +
    • void setPixel ( int x, int y, uint index_or_rgb )
    • +
    • int dotsPerMeterX () const
    • +
    • int dotsPerMeterY () const
    • +
    • void setDotsPerMeterX ( int x )
    • +
    • void setDotsPerMeterY ( int y )
    • +
    • TQPoint offset () const
    • +
    • void setOffset ( const TQPoint & p )
    • +
    • TQValueList<TQImageTextKeyLang> textList () const
    • +
    • TQStringList textLanguages () const
    • +
    • TQStringList textKeys () const
    • +
    • TQString text ( const char * key, const char * lang = 0 ) const
    • +
    • TQString text ( const TQImageTextKeyLang & kl ) const
    • +
    • void setText ( const char * key, const char * lang, const TQString & s )
    • +
    +

    Static Public Members

    + +

    Related Functions

    +
      +
    • TQDataStream & operator<< ( TQDataStream & s, const TQImage & image )
    • +
    • TQDataStream & operator>> ( TQDataStream & s, TQImage & image )
    • +
    • void bitBlt ( TQImage * dst, int dx, int dy, const TQImage * src, int sx, int sy, int sw, int sh, int conversion_flags )
    • +
    +

    Detailed Description

    + + +The TQImage class provides a hardware-independent pixmap +representation with direct access to the pixel data. +

    + + + +

    It is one of the two classes TQt provides for dealing with images, +the other being TQPixmap. TQImage is designed and optimized for I/O +and for direct pixel access/manipulation. TQPixmap is designed and +optimized for drawing. There are (slow) functions to convert +between TQImage and TQPixmap: TQPixmap::convertToImage() and +TQPixmap::convertFromImage(). +

    An image has the parameters width, height and depth (bits per +pixel, bpp), a color table and the actual pixels. TQImage supports 1-bpp, 8-bpp and 32-bpp image +data. 1-bpp and 8-bpp images use a color lookup table; the pixel +value is a color table index. +

    32-bpp images encode an RGB value in 24 bits and ignore the color +table. The most significant byte is used for the alpha buffer. +

    An entry in the color table is an RGB triplet encoded as a uint. Use the tqRed(), tqGreen() and tqBlue() functions (ntqcolor.h) to access the components, and tqRgb to make an RGB triplet (see the TQColor class +documentation). +

    1-bpp (monochrome) images have a color table with a most two +colors. There are two different formats: big endian (MSB first) or +little endian (LSB first) bit order. To access a single bit you +will must do some bit shifts: +

    +    TQImage image;
    +    // sets bit at (x,y) to 1
    +    if ( image.bitOrder() == TQImage::LittleEndian )
    +        *(image.scanLine(y) + (x >> 3)) |= 1 << (x & 7);
    +    else
    +        *(image.scanLine(y) + (x >> 3)) |= 1 << (7 - (x & 7));
    +    
    + +

    If this looks complicated, it might be a good idea to convert the +1-bpp image to an 8-bpp image using convertDepth(). +

    8-bpp images are much easier to work with than 1-bpp images +because they have a single byte per pixel: +

    +    TQImage image;
    +    // set entry 19 in the color table to yellow
    +    image.setColor( 19, tqRgb(255,255,0) );
    +    // set 8 bit pixel at (x,y) to value yellow (in color table)
    +    *(image.scanLine(y) + x) = 19;
    +    
    + +

    32-bpp images ignore the color table; instead, each pixel contains +the RGB triplet. 24 bits contain the RGB value; the most +significant byte is reserved for the alpha buffer. +

    +    TQImage image;
    +    // sets 32 bit pixel at (x,y) to yellow.
    +    uint *p = (uint *)image.scanLine(y) + x;
    +    *p = tqRgb(255,255,0);
    +    
    + +

    On TQt/Embedded, scanlines are aligned to the pixel depth and may +be padded to any degree, while on all other platforms, the +scanlines are 32-bit aligned for all depths. The constructor +taking a uchar* argument always expects 32-bit aligned data. +On TQt/Embedded, an additional constructor allows the number of +bytes-per-line to be specified. +

    TQImage supports a variety of methods for getting information about +the image, for example, colorTable(), allGray(), isGrayscale(), +bitOrder(), bytesPerLine(), depth(), dotsPerMeterX() and +dotsPerMeterY(), hasAlphaBuffer(), numBytes(), numColors(), and +width() and height(). +

    Pixel colors are retrieved with pixel() and set with setPixel(). +

    TQImage also supports a number of functions for creating a new +image that is a transformed version of the original. For example, +copy(), convertBitOrder(), convertDepth(), createAlphaMask(), +createHeuristicMask(), mirror(), scale(), smoothScale(), swapRGB() +and xForm(). There are also functions for changing attributes of +an image in-place, for example, setAlphaBuffer(), setColor(), +setDotsPerMeterX() and setDotsPerMeterY() and setNumColors(). +

    Images can be loaded and saved in the supported formats. Images +are saved to a file with save(). Images are loaded from a file +with load() (or in the constructor) or from an array of data with +loadFromData(). The lists of supported formats are available from +inputFormatList() and outputFormatList(). +

    Strings of text may be added to images using setText(). +

    The TQImage class uses explicit sharing, +similar to that used by TQMemArray. +

    New image formats can be added as plugins. +

    See also TQImageIO, TQPixmap, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. + +


    Member Type Documentation

    +

    TQImage::Endian

    + +

    This enum type is used to describe the endianness of the CPU and +graphics hardware. +

      +
    • TQImage::IgnoreEndian - Endianness does not matter. Useful for some +operations that are independent of endianness. +
    • TQImage::BigEndian - Network byte order, as on SPARC and Motorola CPUs. +
    • TQImage::LittleEndian - PC/Alpha byte order. +
    +

    TQImage::ScaleMode

    + +

    The functions scale() and smoothScale() use different modes for +scaling the image. The purpose of these modes is to retain the +ratio of the image if this is required. +

    +
      +
    • TQImage::ScaleFree - The image is scaled freely: the resulting image +fits exactly into the specified size; the ratio will not +necessarily be preserved. +
    • TQImage::ScaleMin - The ratio of the image is preserved and the +resulting image is guaranteed to fit into the specified size +(it is as large as possible within these constraints) - the +image might be smaller than the requested size. +
    • TQImage::ScaleMax - The ratio of the image is preserved and the +resulting image fills the whole specified rectangle (it is as +small as possible within these constraints) - the image might +be larger than the requested size. +
    +

    Member Function Documentation

    +

    TQImage::TQImage () +

    +Constructs a null image. +

    See also isNull(). + +

    TQImage::TQImage ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) +

    +Constructs an image with w width, h height, depth bits +per pixel, numColors colors and bit order bitOrder. +

    Using this constructor is the same as first constructing a null +image and then calling the create() function. +

    See also create(). + +

    TQImage::TQImage ( const TQSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) +

    +Constructs an image with size size pixels, depth depth bits, +numColors and bitOrder endianness. +

    Using this constructor is the same as first constructing a null +image and then calling the create() function. +

    See also create(). + +

    TQImage::TQImage ( const TQString & fileName, const char * format = 0 ) +

    +Constructs an image and tries to load the image from the file fileName. +

    If format is specified, the loader attempts to read the image +using the specified format. If format is not specified (which +is the default), the loader reads a few bytes from the header to +guess the file format. +

    If the loading of the image failed, this object is a null image. +

    The TQImageIO documentation lists the supported image formats and +explains how to add extra formats. +

    See also load(), isNull(), and TQImageIO. + +

    TQImage::TQImage ( const char * const xpm[] ) +

    +Constructs an image from xpm, which must be a valid XPM image. +

    Errors are silently ignored. +

    Note that it's possible to squeeze the XPM variable a little bit +by using an unusual declaration: +

    +        static const char * const start_xpm[]={
    +            "16 15 8 1",
    +            "a c #cec6bd",
    +        ....
    +    
    + +

    The extra const makes the entire definition read-only, which is +slightly more efficient (e.g. when the code is in a shared +library) and ROMable when the application is to be stored in ROM. + +

    TQImage::TQImage ( const TQByteArray & array ) +

    +Constructs an image from the binary data array. It tries to +guess the file format. +

    If the loading of the image failed, this object is a null image. +

    See also loadFromData(), isNull(), and imageFormat(). + +

    TQImage::TQImage ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder ) +

    +Constructs an image w pixels wide, h pixels high with a +color depth of depth, that uses an existing memory buffer, yourdata. The buffer must remain valid throughout the life of the +TQImage. The image does not delete the buffer at destruction. +

    If colortable is 0, a color table sufficient for numColors +will be allocated (and destructed later). +

    Note that yourdata must be 32-bit aligned. +

    The endianness is given in bitOrder. + +

    TQImage::TQImage ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder ) +

    +Constructs an image that uses an existing memory buffer. The +buffer must remain valid for the life of the TQImage. The image +does not delete the buffer at destruction. The buffer is passed as +yourdata. The image's width is w and its height is h. The +color depth is depth. bpl specifies the number of bytes per +line. +

    If colortable is 0, a color table sufficient for numColors +will be allocated (and destructed later). +

    The endianness is specified by bitOrder. +

    Warning: This constructor is only available on TQt/Embedded. + +

    TQImage::TQImage ( const TQImage & image ) +

    +Constructs a shallow copy of image. + +

    TQImage::~TQImage () +

    +Destroys the image and cleans up. + +

    bool TQImage::allGray () const +

    +Returns TRUE if all the colors in the image are shades of gray +(i.e. their red, green and blue components are equal); otherwise +returns FALSE. +

    This function is slow for large 16-bit (TQt/Embedded only) and 32-bit images. +

    See also isGrayscale(). + +

    Endian TQImage::bitOrder () const +

    + +

    Returns the bit order for the image. +

    If it is a 1-bpp image, this function returns either +TQImage::BigEndian or TQImage::LittleEndian. +

    If it is not a 1-bpp image, this function returns +TQImage::IgnoreEndian. +

    See also depth(). + +

    uchar * TQImage::bits () const +

    + +

    Returns a pointer to the first pixel data. This is equivalent to +scanLine(0). +

    See also numBytes(), scanLine(), and jumpTable(). + +

    Example: opengl/texture/gltexobj.cpp. +

    int TQImage::bytesPerLine () const +

    + +

    Returns the number of bytes per image scanline. This is equivalent +to numBytes()/height(). +

    See also numBytes() and scanLine(). + +

    TQRgb TQImage::color ( int i ) const +

    + +

    Returns the color in the color table at index i. The first +color is at index 0. +

    A color value is an RGB triplet. Use the tqRed(), tqGreen() and tqBlue() functions (defined in ntqcolor.h) to +get the color value components. +

    See also setColor(), numColors(), and TQColor. + +

    Example: themes/wood.cpp. +

    TQRgb * TQImage::colorTable () const +

    + +

    Returns a pointer to the color table. +

    See also numColors(). + +

    TQImage TQImage::convertBitOrder ( Endian bitOrder ) const +

    +Converts the bit order of the image to bitOrder and returns the +converted image. The original image is not changed. +

    Returns *this if the bitOrder is equal to the image bit +order, or a null image if this image cannot +be converted. +

    See also bitOrder(), systemBitOrder(), and isNull(). + +

    TQImage TQImage::convertDepth ( int depth, int conversion_flags ) const +

    +Converts the depth (bpp) of the image to depth and returns the +converted image. The original image is not changed. +

    The depth argument must be 1, 8, 16 (TQt/Embedded only) or 32. +

    Returns *this if depth is equal to the image depth, or a +null image if this image cannot be +converted. +

    If the image needs to be modified to fit in a lower-resolution +result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. +

    See also TQt::ImageConversionFlags, depth(), and isNull(). + +

    TQImage TQImage::convertDepth ( int depth ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    +

    TQImage TQImage::convertDepthWithPalette ( int d, TQRgb * palette, int palette_count, int conversion_flags = 0 ) const +

    +Returns an image with depth d, using the palette_count +colors pointed to by palette. If d is 1 or 8, the returned +image will have its color table ordered the same as palette. +

    If the image needs to be modified to fit in a lower-resolution +result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. +

    Note: currently no closest-color search is made. If colors are +found that are not in the palette, the palette may not be used at +all. This result should not be considered valid because it may +change in future implementations. +

    Currently inefficient for non-32-bit images. +

    See also TQt::ImageConversionFlags. + +

    TQImage TQImage::copy () const +

    +Returns a deep copy of the image. +

    See also detach(). + +

    TQImage TQImage::copy ( int x, int y, int w, int h, int conversion_flags = 0 ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns a deep copy of a sub-area of +the image. +

    The returned image is always w by h pixels in size, and is +copied from position x, y in this image. In areas beyond +this image pixels are filled with pixel 0. +

    If the image needs to be modified to fit in a lower-resolution +result (e.g. converting from 32-bit to 8-bit), use the conversion_flags to specify how you'd prefer this to happen. +

    See also bitBlt() and TQt::ImageConversionFlags. + +

    TQImage TQImage::copy ( const TQRect & r ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns a deep copy of a sub-area of +the image. +

    The returned image always has the size of the rectangle r. In +areas beyond this image pixels are filled with pixel 0. + +

    bool TQImage::create ( int width, int height, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) +

    +Sets the image width, height, depth, its number of colors +(in numColors), and bit order. Returns TRUE if successful, or +FALSE if the parameters are incorrect or if memory cannot be +allocated. +

    The width and height is limited to 32767. depth must be +1, 8, or 32. If depth is 1, bitOrder must be set to +either TQImage::LittleEndian or TQImage::BigEndian. For other depths +bitOrder must be TQImage::IgnoreEndian. +

    This function allocates a color table and a buffer for the image +data. The image data is not initialized. +

    The image buffer is allocated as a single block that consists of a +table of scanline pointers (jumpTable()) +and the image data (bits()). +

    See also fill(), width(), height(), depth(), numColors(), bitOrder(), jumpTable(), scanLine(), bits(), bytesPerLine(), and numBytes(). + +

    bool TQImage::create ( const TQSize &, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    +

    TQImage TQImage::createAlphaMask ( int conversion_flags = 0 ) const +

    +Builds and returns a 1-bpp mask from the alpha buffer in this +image. Returns a null image if alpha buffer mode is disabled. +

    See TQPixmap::convertFromImage() for a description of the conversion_flags argument. +

    The returned image has little-endian bit order, which you can +convert to big-endianness using convertBitOrder(). +

    See also createHeuristicMask(), hasAlphaBuffer(), and setAlphaBuffer(). + +

    TQImage TQImage::createHeuristicMask ( bool clipTight = TRUE ) const +

    +Creates and returns a 1-bpp heuristic mask for this image. It +works by selecting a color from one of the corners, then chipping +away pixels of that color starting at all the edges. +

    The four corners vote for which color is to be masked away. In +case of a draw (this generally means that this function is not +applicable to the image), the result is arbitrary. +

    The returned image has little-endian bit order, which you can +convert to big-endianness using convertBitOrder(). +

    If clipTight is TRUE the mask is just large enough to cover the +pixels; otherwise, the mask is larger than the data pixels. +

    This function disregards the alpha buffer. +

    See also createAlphaMask(). + +

    int TQImage::depth () const +

    + +

    Returns the depth of the image. +

    The image depth is the number of bits used to encode a single +pixel, also called bits per pixel (bpp) or bit planes of an image. +

    The supported depths are 1, 8, 16 (TQt/Embedded only) and 32. +

    See also convertDepth(). + +

    void TQImage::detach () +

    +Detaches from shared image data and makes sure that this image is +the only one referring to the data. +

    If multiple images share common data, this image makes a copy of +the data and detaches itself from the sharing mechanism. +Nothing is done if there is just a single reference. +

    See also copy(). + +

    Example: themes/wood.cpp. +

    int TQImage::dotsPerMeterX () const +

    + +

    Returns the number of pixels that fit horizontally in a physical +meter. This and dotsPerMeterY() define the intended scale and +aspect ratio of the image. +

    See also setDotsPerMeterX(). + +

    int TQImage::dotsPerMeterY () const +

    + +

    Returns the number of pixels that fit vertically in a physical +meter. This and dotsPerMeterX() define the intended scale and +aspect ratio of the image. +

    See also setDotsPerMeterY(). + +

    void TQImage::fill ( uint pixel ) +

    +Fills the entire image with the pixel value pixel. +

    If the depth of this image is 1, only the +lowest bit is used. If you say fill(0), fill(2), etc., the image +is filled with 0s. If you say fill(1), fill(3), etc., the image is +filled with 1s. If the depth is 8, the lowest 8 bits are used. +

    If the depth is 32 and the image has no alpha buffer, the pixel +value is written to each pixel in the image. If the image has an +alpha buffer, only the 24 RGB bits are set and the upper 8 bits +(alpha value) are left unchanged. +

    Note: TQImage::pixel() returns the color of the pixel at the given +coordinates; TQColor::pixel() returns the pixel value of the +underlying window system (essentially an index value), so normally +you will want to use TQImage::pixel() to use a color from an +existing image or TQColor::rgb() to use a specific color. +

    See also invertPixels(), depth(), hasAlphaBuffer(), and create(). + +

    TQImage TQImage::fromMimeSource ( const TQString & abs_name ) [static] +

    Convenience function. Gets the data associated with the absolute +name abs_name from the default mime source factory and decodes it +to an image. +

    See also TQMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode(). + +

    bool TQImage::hasAlphaBuffer () const +

    + +

    Returns TRUE if alpha buffer mode is enabled; otherwise returns +FALSE. +

    See also setAlphaBuffer(). + +

    int TQImage::height () const +

    + +

    Returns the height of the image. +

    See also width(), size(), and rect(). + +

    Examples: canvas/canvas.cpp and opengl/texture/gltexobj.cpp. +

    const char * TQImage::imageFormat ( const TQString & fileName ) [static] +

    +Returns a string that specifies the image format of the file fileName, or 0 if the file cannot be read or if the format is not +recognized. +

    The TQImageIO documentation lists the guaranteed supported image +formats, or use TQImage::inputFormats() and TQImage::outputFormats() +to get lists that include the installed formats. +

    See also load() and save(). + +

    TQStringList TQImage::inputFormatList () [static] +

    +Returns a list of image formats that are supported for image +input. +

    Note that if you want to iterate over the list, you should iterate +over a copy, e.g. +

    +    TQStringList list = myImage.inputFormatList();
    +    TQStringList::Iterator it = list.begin();
    +    while( it != list.end() ) {
    +        myProcessing( *it );
    +        ++it;
    +    }
    +    
    + +

    See also outputFormatList(), inputFormats(), and TQImageIO. + +

    Example: showimg/showimg.cpp. +

    TQStrList TQImage::inputFormats () [static] +

    +Returns a list of image formats that are supported for image +input. +

    See also outputFormats(), inputFormatList(), and TQImageIO. + +

    void TQImage::invertPixels ( bool invertAlpha = TRUE ) +

    +Inverts all pixel values in the image. +

    If the depth is 32: if invertAlpha is TRUE, the alpha bits are +also inverted, otherwise they are left unchanged. +

    If the depth is not 32, the argument invertAlpha has no +meaning. +

    Note that inverting an 8-bit image means to replace all pixels +using color index i with a pixel using color index 255 minus i. Similarly for a 1-bit image. The color table is not changed. +

    See also fill(), depth(), and hasAlphaBuffer(). + +

    bool TQImage::isGrayscale () const +

    +For 16-bit (TQt/Embedded only) and 32-bit images, this function is +equivalent to allGray(). +

    For 8-bpp images, this function returns TRUE if color(i) is +TQRgb(i,i,i) for all indices of the color table; otherwise returns +FALSE. +

    See also allGray() and depth(). + +

    bool TQImage::isNull () const +

    + +

    Returns TRUE if it is a null image; otherwise returns FALSE. +

    A null image has all parameters set to zero and no allocated data. + +

    Example: showimg/showimg.cpp. +

    uchar ** TQImage::jumpTable () const +

    + +

    Returns a pointer to the scanline pointer table. +

    This is the beginning of the data block for the image. +

    See also bits() and scanLine(). + +

    bool TQImage::load ( const TQString & fileName, const char * format = 0 ) +

    +Loads an image from the file fileName. Returns TRUE if the +image was successfully loaded; otherwise returns FALSE. +

    If format is specified, the loader attempts to read the image +using the specified format. If format is not specified (which +is the default), the loader reads a few bytes from the header to +guess the file format. +

    The TQImageIO documentation lists the supported image formats and +explains how to add extra formats. +

    See also loadFromData(), save(), imageFormat(), TQPixmap::load(), and TQImageIO. + +

    bool TQImage::loadFromData ( const uchar * buf, uint len, const char * format = 0 ) +

    +Loads an image from the first len bytes of binary data in buf. Returns TRUE if the image was successfully loaded; otherwise +returns FALSE. +

    If format is specified, the loader attempts to read the image +using the specified format. If format is not specified (which +is the default), the loader reads a few bytes from the header to +guess the file format. +

    The TQImageIO documentation lists the supported image formats and +explains how to add extra formats. +

    See also load(), save(), imageFormat(), TQPixmap::loadFromData(), and TQImageIO. + +

    bool TQImage::loadFromData ( TQByteArray buf, const char * format = 0 ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Loads an image from the TQByteArray buf. + +

    TQImage TQImage::mirror () const +

    +Returns a TQImage which is a vertically mirrored copy of this +image. The original TQImage is not changed. + +

    TQImage TQImage::mirror ( bool horizontal, bool vertical ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns a mirror of the image, mirrored in the horizontal and/or +the vertical direction depending on whether horizontal and vertical are set to TRUE or FALSE. The original image is not +changed. +

    See also smoothScale(). + +

    int TQImage::numBytes () const +

    + +

    Returns the number of bytes occupied by the image data. +

    See also bytesPerLine() and bits(). + +

    int TQImage::numColors () const +

    + +

    Returns the size of the color table for the image. +

    Notice that numColors() returns 0 for 16-bpp (TQt/Embedded only) +and 32-bpp images because these images do not use color tables, +but instead encode pixel values as RGB triplets. +

    See also setNumColors() and colorTable(). + +

    Example: themes/wood.cpp. +

    TQPoint TQImage::offset () const +

    + +

    Returns the number of pixels by which the image is intended to be +offset by when positioning relative to other images. + +

    bool TQImage::operator!= ( const TQImage & i ) const +

    +Returns TRUE if this image and image i have different contents; +otherwise returns FALSE. The comparison can be slow, unless there +is some obvious difference, such as different widths, in which +case the function will return quickly. +

    See also operator=(). + +

    TQImage & TQImage::operator= ( const TQImage & image ) +

    +Assigns a shallow copy of image to +this image and returns a reference to this image. +

    See also copy(). + +

    TQImage & TQImage::operator= ( const TQPixmap & pixmap ) +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Sets the image bits to the pixmap contents and returns a +reference to the image. +

    If the image shares data with other images, it will first +dereference the shared data. +

    Makes a call to TQPixmap::convertToImage(). + +

    bool TQImage::operator== ( const TQImage & i ) const +

    +Returns TRUE if this image and image i have the same contents; +otherwise returns FALSE. The comparison can be slow, unless there +is some obvious difference, such as different widths, in which +case the function will return quickly. +

    See also operator=(). + +

    TQStringList TQImage::outputFormatList () [static] +

    +Returns a list of image formats that are supported for image +output. +

    Note that if you want to iterate over the list, you should iterate +over a copy, e.g. +

    +    TQStringList list = myImage.outputFormatList();
    +    TQStringList::Iterator it = list.begin();
    +    while( it != list.end() ) {
    +        myProcessing( *it );
    +        ++it;
    +    }
    +    
    + +

    See also inputFormatList(), outputFormats(), and TQImageIO. + +

    TQStrList TQImage::outputFormats () [static] +

    +Returns a list of image formats that are supported for image +output. +

    See also inputFormats(), outputFormatList(), and TQImageIO. + +

    Example: showimg/showimg.cpp. +

    TQRgb TQImage::pixel ( int x, int y ) const +

    +Returns the color of the pixel at the coordinates (x, y). +

    If (x, y) is not on the image, the +results are undefined. +

    See also setPixel(), tqRed(), tqGreen(), tqBlue(), and valid(). + +

    Examples: canvas/canvas.cpp and qmag/qmag.cpp. +

    int TQImage::pixelIndex ( int x, int y ) const +

    +Returns the pixel index at the given coordinates. +

    If (x, y) is not valid, or if the +image is not a paletted image (depth() > 8), the results are +undefined. +

    See also valid() and depth(). + +

    TQRect TQImage::rect () const +

    + +

    Returns the enclosing rectangle (0, 0, width(), height()) of the +image. +

    See also width(), height(), and size(). + +

    void TQImage::reset () +

    +Resets all image parameters and deallocates the image data. + +

    bool TQImage::save ( const TQString & fileName, const char * format, int quality = -1 ) const +

    +Saves the image to the file fileName, using the image file +format format and a quality factor of quality. quality +must be in the range 0..100 or -1. Specify 0 to obtain small +compressed files, 100 for large uncompressed files, and -1 (the +default) to use the default settings. +

    Returns TRUE if the image was successfully saved; otherwise +returns FALSE. +

    See also load(), loadFromData(), imageFormat(), TQPixmap::save(), and TQImageIO. + +

    bool TQImage::save ( TQIODevice * device, const char * format, int quality = -1 ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    This function writes a TQImage to the TQIODevice, device. This +can be used, for example, to save an image directly into a +TQByteArray: +

    +    TQImage image;
    +    TQByteArray ba;
    +    TQBuffer buffer( ba );
    +    buffer.open( IO_WriteOnly );
    +    image.save( &buffer, "PNG" ); // writes image into ba in PNG format
    +    
    + + +

    TQImage TQImage::scale ( int w, int h, ScaleMode mode = ScaleFree ) const +

    +Returns a copy of the image scaled to a rectangle of width w +and height h according to the ScaleMode mode. +

      +
    • If mode is ScaleFree, the image is scaled to (w, +h). +
    • If mode is ScaleMin, the image is scaled to a rectangle +as large as possible inside (w, h), preserving the aspect +ratio. +
    • If mode is ScaleMax, the image is scaled to a rectangle +as small as possible outside (w, h), preserving the aspect +ratio. +
    +

    If either the width w or the height h is 0 or negative, this +function returns a null image. +

    This function uses a simple, fast algorithm. If you need better +quality, use smoothScale() instead. +

    See also scaleWidth(), scaleHeight(), smoothScale(), and xForm(). + +

    TQImage TQImage::scale ( const TQSize & s, ScaleMode mode = ScaleFree ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    The requested size of the image is s. + +

    TQImage TQImage::scaleHeight ( int h ) const +

    +Returns a scaled copy of the image. The returned image has a +height of h pixels. This function automatically calculates the +width of the image so that the ratio of the image is preserved. +

    If h is 0 or negative a null image is +returned. +

    See also scale(), scaleWidth(), smoothScale(), and xForm(). + +

    Example: table/small-table-demo/main.cpp. +

    TQImage TQImage::scaleWidth ( int w ) const +

    +Returns a scaled copy of the image. The returned image has a width +of w pixels. This function automatically calculates the height +of the image so that the ratio of the image is preserved. +

    If w is 0 or negative a null image is +returned. +

    See also scale(), scaleHeight(), smoothScale(), and xForm(). + +

    uchar * TQImage::scanLine ( int i ) const +

    + +

    Returns a pointer to the pixel data at the scanline with index i. The first scanline is at index 0. +

    The scanline data is aligned on a 32-bit boundary. +

    Warning: If you are accessing 32-bpp image data, cast the returned +pointer to TQRgb* (TQRgb has a 32-bit size) and use it to +read/write the pixel value. You cannot use the uchar* pointer +directly, because the pixel format depends on the byte order on +the underlying platform. Hint: use tqRed(), +tqGreen() and tqBlue(), etc. (ntqcolor.h) to access the pixels. +

    Warning: If you are accessing 16-bpp image data, you must handle +endianness yourself. (TQt/Embedded only) +

    See also bytesPerLine(), bits(), and jumpTable(). + +

    Example: desktop/desktop.cpp. +

    void TQImage::setAlphaBuffer ( bool enable ) +

    +Enables alpha buffer mode if enable is TRUE, otherwise disables +it. The default setting is disabled. +

    An 8-bpp image has 8-bit pixels. A pixel is an index into the +color table, which contains 32-bit color +values. In a 32-bpp image, the 32-bit pixels are the color values. +

    This 32-bit value is encoded as follows: The lower 24 bits are +used for the red, green, and blue components. The upper 8 bits +contain the alpha component. +

    The alpha component specifies the transparency of a pixel. 0 means +completely transparent and 255 means opaque. The alpha component +is ignored if you do not enable alpha buffer mode. +

    The alpha buffer is used to set a mask when a TQImage is translated +to a TQPixmap. +

    See also hasAlphaBuffer() and createAlphaMask(). + +

    void TQImage::setColor ( int i, TQRgb c ) +

    + +

    Sets a color in the color table at index i to c. +

    A color value is an RGB triplet. Use the tqRgb() function (defined in ntqcolor.h) to make RGB +triplets. +

    See also color(), setNumColors(), and numColors(). + +

    Examples: desktop/desktop.cpp and themes/wood.cpp. +

    void TQImage::setDotsPerMeterX ( int x ) +

    +Sets the value returned by dotsPerMeterX() to x. + +

    void TQImage::setDotsPerMeterY ( int y ) +

    +Sets the value returned by dotsPerMeterY() to y. + +

    void TQImage::setNumColors ( int numColors ) +

    +Resizes the color table to numColors colors. +

    If the color table is expanded all the extra colors will be set to +black (RGB 0,0,0). +

    See also numColors(), color(), setColor(), and colorTable(). + +

    void TQImage::setOffset ( const TQPoint & p ) +

    +Sets the value returned by offset() to p. + +

    void TQImage::setPixel ( int x, int y, uint index_or_rgb ) +

    +Sets the pixel index or color at the coordinates (x, y) to +index_or_rgb. +

    If (x, y) is not valid, the result is +undefined. +

    If the image is a paletted image (depth() <= 8) and index_or_rgb >= numColors(), the result is undefined. +

    See also pixelIndex(), pixel(), tqRgb(), tqRgba(), and valid(). + +

    void TQImage::setText ( const char * key, const char * lang, const TQString & s ) +

    +Records string s for the keyword key. The key should be a +portable keyword recognizable by other software - some suggested +values can be found in the PNG specification. s can be any text. lang +should specify the language code (see +RFC 1766) or 0. + +

    TQSize TQImage::size () const +

    + +

    Returns the size of the image, i.e. its width and height. +

    See also width(), height(), and rect(). + +

    TQImage TQImage::smoothScale ( int w, int h, ScaleMode mode = ScaleFree ) const +

    +Returns a smoothly scaled copy of the image. The returned image +has a size of width w by height h pixels if mode is ScaleFree. The modes ScaleMin and ScaleMax may be used to +preserve the ratio of the image: if mode is ScaleMin, the +returned image is guaranteed to fit into the rectangle specified +by w and h (it is as large as possible within the +constraints); if mode is ScaleMax, the returned image fits +at least into the specified rectangle (it is a small as possible +within the constraints). +

    For 32-bpp images and 1-bpp/8-bpp color images the result will be +32-bpp, whereas all-gray images +(including black-and-white 1-bpp) will produce 8-bit grayscale images with the palette spanning +256 grays from black to white. +

    This function uses code based on pnmscale.c by Jef Poskanzer. +

    pnmscale.c - read a portable anymap and scale it +

    +

    Copyright (C) 1989, 1991 by Jef Poskanzer. +

    Permission to use, copy, modify, and distribute this software and +its documentation for any purpose and without fee is hereby +granted, provided that the above copyright notice appear in all +copies and that both that copyright notice and this permission +notice appear in supporting documentation. This software is +provided "as is" without express or implied warranty. +

    See also scale() and mirror(). + +

    TQImage TQImage::smoothScale ( const TQSize & s, ScaleMode mode = ScaleFree ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    The requested size of the image is s. + +

    TQImage TQImage::swapRGB () const +

    +Returns a TQImage in which the values of the red and blue +components of all pixels have been swapped, effectively converting +an RGB image to a BGR image. The original TQImage is not changed. + +

    Endian TQImage::systemBitOrder () [static] +

    +Determines the bit order of the display hardware. Returns +TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). +

    See also systemByteOrder(). + +

    Endian TQImage::systemByteOrder () [static] +

    +Determines the host computer byte order. Returns +TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). +

    See also systemBitOrder(). + +

    TQString TQImage::text ( const char * key, const char * lang = 0 ) const +

    +Returns the string recorded for the keyword key in language lang, or in a default language if lang is 0. + +

    TQString TQImage::text ( const TQImageTextKeyLang & kl ) const +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns the string recorded for the keyword and language kl. + +

    TQStringList TQImage::textKeys () const +

    +Returns the keywords for which some texts are recorded. +

    Note that if you want to iterate over the list, you should iterate +over a copy, e.g. +

    +    TQStringList list = myImage.textKeys();
    +    TQStringList::Iterator it = list.begin();
    +    while( it != list.end() ) {
    +        myProcessing( *it );
    +        ++it;
    +    }
    +    
    + +

    See also textList(), text(), setText(), and textLanguages(). + +

    TQStringList TQImage::textLanguages () const +

    +Returns the language identifiers for which some texts are +recorded. +

    Note that if you want to iterate over the list, you should iterate +over a copy, e.g. +

    +    TQStringList list = myImage.textLanguages();
    +    TQStringList::Iterator it = list.begin();
    +    while( it != list.end() ) {
    +        myProcessing( *it );
    +        ++it;
    +    }
    +    
    + +

    See also textList(), text(), setText(), and textKeys(). + +

    TQValueList<TQImageTextKeyLang> TQImage::textList () const +

    +Returns a list of TQImageTextKeyLang objects that enumerate all the +texts key/language pairs set by setText() for this image. +

    Note that if you want to iterate over the list, you should iterate +over a copy, e.g. +

    +    TQValueList<TQImageTextKeyLang> list = myImage.textList();
    +    TQValueList<TQImageTextKeyLang>::Iterator it = list.begin();
    +    while( it != list.end() ) {
    +        myProcessing( *it );
    +        ++it;
    +    }
    +    
    + + +

    bool TQImage::valid ( int x, int y ) const +

    +Returns TRUE if ( x, y ) is a valid coordinate in the image; +otherwise returns FALSE. +

    See also width(), height(), and pixelIndex(). + +

    Examples: canvas/canvas.cpp and qmag/qmag.cpp. +

    int TQImage::width () const +

    + +

    Returns the width of the image. +

    See also height(), size(), and rect(). + +

    Examples: canvas/canvas.cpp and opengl/texture/gltexobj.cpp. +

    TQImage TQImage::xForm ( const TQWMatrix & matrix ) const +

    +Returns a copy of the image that is transformed using the +transformation matrix, matrix. +

    The transformation matrix is internally adjusted to compensate +for unwanted translation, i.e. xForm() returns the smallest image +that contains all the transformed points of the original image. +

    See also scale(), TQPixmap::xForm(), TQPixmap::trueMatrix(), and TQWMatrix. + +


    Related Functions

    +

    void bitBlt ( TQImage * dst, int dx, int dy, const TQImage * src, int sx, int sy, int sw, int sh, int conversion_flags ) +

    + +

    Copies a block of pixels from src to dst. The pixels +copied from source (src) are converted according to +conversion_flags if it is incompatible with the destination +(dst). +

    sx, sy is the top-left pixel in src, dx, dy +is the top-left position in dst and sw, \sh is the +size of the copied block. +

    The copying is clipped if areas outside src or dst are +specified. +

    If sw is -1, it is adjusted to src->width(). Similarly, if sh is -1, it is adjusted to src->height(). +

    Currently inefficient for non 32-bit images. + +

    TQDataStream & operator<< ( TQDataStream & s, const TQImage & image ) +

    + +

    Writes the image image to the stream s as a PNG image, or as a +BMP image if the stream's version is 1. +

    Note that writing the stream to a file will not produce a valid image file. +

    See also TQImage::save() and Format of the TQDataStream operators. + +

    TQDataStream & operator>> ( TQDataStream & s, TQImage & image ) +

    + +

    Reads an image from the stream s and stores it in image. +

    See also TQImage::load() and Format of the TQDataStream operators. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageconsumer-members.html b/doc/html/tqimageconsumer-members.html new file mode 100644 index 000000000..f69585fe4 --- /dev/null +++ b/doc/html/tqimageconsumer-members.html @@ -0,0 +1,52 @@ + + + + + +TQImageConsumer Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageConsumer

    + +

    This is the complete list of member functions for +TQImageConsumer, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageconsumer.html b/doc/html/tqimageconsumer.html new file mode 100644 index 000000000..365e9aa62 --- /dev/null +++ b/doc/html/tqimageconsumer.html @@ -0,0 +1,142 @@ + + + + + +TQImageConsumer Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageConsumer Class Reference

    + +

    The TQImageConsumer class is an abstraction used by TQImageDecoder. +More... +

    #include <ntqasyncimageio.h> +

    List of all member functions. +

    Public Members

    +
      +
    • virtual void end () = 0
    • +
    • virtual void changed ( const TQRect & ) = 0
    • +
    • virtual void frameDone () = 0
    • +
    • virtual void frameDone ( const TQPoint & offset, const TQRect & rect ) = 0
    • +
    • virtual void setLooping ( int n ) = 0
    • +
    • virtual void setFramePeriod ( int milliseconds ) = 0
    • +
    • virtual void setSize ( int, int ) = 0
    • +
    +

    Detailed Description

    + + +The TQImageConsumer class is an abstraction used by TQImageDecoder. +

    + + +

    The TQMovie class, or TQLabel::setMovie(), are easy to use and for +most situations do what you want with regards animated images. +

    A TQImageConsumer consumes information about changes to the TQImage +maintained by a TQImageDecoder. Think of the TQImage as the model or +source of the image data, with the TQImageConsumer as a view of +that data and the TQImageDecoder being the controller that +orchestrates the relationship between the model and the view. +

    You'd use the TQImageConsumer class, for example, if you were +implementing a web browser with your own image loaders. +

    See also TQImageDecoder, Graphics Classes, Image Processing Classes, and Multimedia Classes. + +


    Member Function Documentation

    +

    void TQImageConsumer::changed ( const TQRect & ) [pure virtual] +

    + +

    Called when the given area of the image has changed. + +

    void TQImageConsumer::end () [pure virtual] +

    + +

    Called when all the data from all the frames has been decoded and +revealed as changed(). + +

    void TQImageConsumer::frameDone () [pure virtual] +

    + +

    One of the two frameDone() functions will be called when a frame +of an animated image has ended and been revealed as changed(). +

    When this function is called, the current image should be +displayed. +

    The decoder will not make any further changes to the image until +the next call to TQImageFormat::decode(). + +

    void TQImageConsumer::frameDone ( const TQPoint & offset, const TQRect & rect ) [pure virtual] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    One of the two frameDone() functions will be called when a frame +of an animated image has ended and been revealed as changed(). +

    When this function is called, the area rect in the current +image should be moved by offset and displayed. +

    The decoder will not make any further changes to the image until +the next call to TQImageFormat::decode(). + +

    void TQImageConsumer::setFramePeriod ( int milliseconds ) [pure virtual] +

    + +

    Notes that the frame about to be decoded should not be displayed +until the given number of milliseconds after the time that this +function is called. Of course, the image may not have been +decoded by then, in which case the frame should not be displayed +until it is complete. A value of -1 (the assumed default) +indicates that the image should be displayed even while it is only +partially loaded. + +

    void TQImageConsumer::setLooping ( int n ) [pure virtual] +

    + +

    Called to indicate that the sequence of frames in the image +should be repeated n times, including the sequence during +decoding. +

      +
    • 0 = Forever +
    • 1 = Only display frames the first time through +
    • 2 = Repeat once after first pass through images +
    • etc. +
    +

    To make the TQImageDecoder do this, just delete it and pass the +information to it again for decoding (setLooping() will be called +again, of course, but that can be ignored), or keep copies of the +changed areas at the ends of frames. + +

    void TQImageConsumer::setSize ( int, int ) [pure virtual] +

    + +

    This function is called as soon as the size of the image has been +determined. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimagedecoder-members.html b/doc/html/tqimagedecoder-members.html new file mode 100644 index 000000000..f1aacef8d --- /dev/null +++ b/doc/html/tqimagedecoder-members.html @@ -0,0 +1,55 @@ + + + + + +TQImageDecoder Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageDecoder

    + +

    This is the complete list of member functions for +TQImageDecoder, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimagedecoder.html b/doc/html/tqimagedecoder.html new file mode 100644 index 000000000..aec7b77d5 --- /dev/null +++ b/doc/html/tqimagedecoder.html @@ -0,0 +1,154 @@ + + + + + +TQImageDecoder Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageDecoder Class Reference

    + +

    The TQImageDecoder class is an incremental image decoder for all supported image formats. +More... +

    #include <ntqasyncimageio.h> +

    List of all member functions. +

    Public Members

    + +

    Static Public Members

    + +

    Detailed Description

    + + +The TQImageDecoder class is an incremental image decoder for all supported image formats. +

    + + +

    New formats are installed by creating objects of class +TQImageFormatType; the TQMovie class can be used for all installed +incremental image formats. TQImageDecoder is only useful for +creating new ways of feeding data to an TQImageConsumer. +

    A TQImageDecoder is a machine that decodes images. It takes encoded +image data via its decode() method and expresses its decoding by +supplying information to a TQImageConsumer. It implements its +decoding by using a TQImageFormat created by one of the +currently-existing TQImageFormatType factory objects. +

    TQImageFormatType and TQImageFormat are the classes that you might +need to implement support for additional image formats. +

    +

    TQt supports GIF reading if it is configured that way during +installation (see ntqgif.h). If it is, we are required to state that +"The Graphics Interchange Format(c) is the Copyright property of +CompuServe Incorporated. GIF(sm) is a Service Mark property of +CompuServe Incorporated." +

    Warning: If you are in a country that recognizes software patents +and in which Unisys holds a patent on LZW compression and/or +decompression and you want to use GIF, Unisys may require you to +license that technology. Such countries include Canada, Japan, +the USA, France, Germany, Italy and the UK. +

    GIF support may be removed completely in a future version of TQt. +We recommend using the MNG or PNG format. +

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. + +


    Member Function Documentation

    +

    TQImageDecoder::TQImageDecoder ( TQImageConsumer * c ) +

    +Constructs a TQImageDecoder that will send change information to +the TQImageConsumer c. + +

    TQImageDecoder::~TQImageDecoder () +

    +Destroys a TQImageDecoder. The image it built is destroyed. The +decoder built by the factory for the file format is destroyed. The +consumer for which it decoded the image is not destroyed. + +

    int TQImageDecoder::decode ( const uchar * buffer, int length ) +

    +Call this function to decode some data into image changes. The +data in buffer will be decoded, sending change information to +the TQImageConsumer of this TQImageDecoder until one of the change +functions of the consumer returns FALSE. The length of the data is +given in length. +

    Returns the number of bytes consumed: 0 if consumption is +complete, and -1 if decoding fails due to invalid data. + +

    TQImageFormatType * TQImageDecoder::format ( const char * name ) [static] +

    +Returns a TQImageFormatType by name. This might be used when the +user needs to force data to be interpreted as being in a certain +format. name is one of the formats listed by +TQImageDecoder::inputFormats(). Note that you will still need to +supply decodable data to result->decoderFor() before you can begin +decoding the data. + +

    const char * TQImageDecoder::formatName ( const uchar * buffer, int length ) [static] +

    +Call this function to find the name of the format of the given +header. The returned string is statically allocated. The function +will look at the first length characters in the buffer. +

    Returns 0 if the format is not recognized. + +

    const TQImage & TQImageDecoder::image () +

    + +

    Returns the image currently being decoded. + +

    TQStrList TQImageDecoder::inputFormats () [static] +

    +Returns a sorted list of formats for which asynchronous loading is +supported. + +

    void TQImageDecoder::registerDecoderFactory ( TQImageFormatType * f ) [static] +

    +Registers the new TQImageFormatType f. This is not needed in +application code because factories call this themselves. + +

    void TQImageDecoder::unregisterDecoderFactory ( TQImageFormatType * f ) [static] +

    +Unregisters the TQImageFormatType f. This is not needed in +application code because factories call this themselves. + + +

    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimagedrag-members.html b/doc/html/tqimagedrag-members.html new file mode 100644 index 000000000..36996b57a --- /dev/null +++ b/doc/html/tqimagedrag-members.html @@ -0,0 +1,106 @@ + + + + + +TQImageDrag Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageDrag

    + +

    This is the complete list of member functions for +TQImageDrag, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimagedrag.html b/doc/html/tqimagedrag.html new file mode 100644 index 000000000..ca3c5448f --- /dev/null +++ b/doc/html/tqimagedrag.html @@ -0,0 +1,120 @@ + + + + + +TQImageDrag Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageDrag Class Reference

    + +

    The TQImageDrag class provides a drag and drop object for +transferring images. +More... +

    #include <ntqdragobject.h> +

    Inherits TQDragObject. +

    List of all member functions. +

    Public Members

    +
      +
    • TQImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )
    • +
    • TQImageDrag ( TQWidget * dragSource = 0, const char * name = 0 )
    • +
    • ~TQImageDrag ()
    • +
    • virtual void setImage ( TQImage image )
    • +
    +

    Static Public Members

    +
      +
    • bool canDecode ( const TQMimeSource * e )
    • +
    • bool decode ( const TQMimeSource * e, TQImage & img )
    • +
    • bool decode ( const TQMimeSource * e, TQPixmap & pm )
    • +
    +

    Detailed Description

    + + +

    The TQImageDrag class provides a drag and drop object for +transferring images. +

    +

    Images are offered to the receiving application in multiple +formats, determined by TQt's output + formats. +

    For more information about drag and drop, see the TQDragObject +class and the drag and drop documentation. +

    See also Drag And Drop Classes. + +


    Member Function Documentation

    +

    TQImageDrag::TQImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 ) +

    +Constructs an image drag object and sets its data to image. dragSource must be the drag source; name is the object name. + +

    TQImageDrag::TQImageDrag ( TQWidget * dragSource = 0, const char * name = 0 ) +

    +Constructs a default image drag object. dragSource must be the +drag source; name is the object name. + +

    TQImageDrag::~TQImageDrag () +

    +Destroys the image drag object and frees up all allocated +resources. + +

    bool TQImageDrag::canDecode ( const TQMimeSource * e ) [static] +

    +Returns TRUE if the information in mime source e can be decoded +into an image; otherwise returns FALSE. +

    See also decode(). + +

    Example: desktop/desktop.cpp. +

    bool TQImageDrag::decode ( const TQMimeSource * e, TQImage & img ) [static] +

    +Attempts to decode the dropped information in mime source e +into img. Returns TRUE if successful; otherwise returns FALSE. +

    See also canDecode(). + +

    Example: desktop/desktop.cpp. +

    bool TQImageDrag::decode ( const TQMimeSource * e, TQPixmap & pm ) [static] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Attempts to decode the dropped information in mime source e +into pixmap pm. Returns TRUE if successful; otherwise returns +FALSE. +

    This is a convenience function that converts to a TQPixmap via a +TQImage. +

    See also canDecode(). + +

    void TQImageDrag::setImage ( TQImage image ) [virtual] +

    +Sets the image to be dragged to image. You will need to call +this if you did not pass the image during construction. + + +

    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformat-members.html b/doc/html/tqimageformat-members.html new file mode 100644 index 000000000..78ae5ed7c --- /dev/null +++ b/doc/html/tqimageformat-members.html @@ -0,0 +1,47 @@ + + + + + +TQImageFormat Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageFormat

    + +

    This is the complete list of member functions for +TQImageFormat, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformat.html b/doc/html/tqimageformat.html new file mode 100644 index 000000000..0b1e9b51e --- /dev/null +++ b/doc/html/tqimageformat.html @@ -0,0 +1,87 @@ + + + + + +TQImageFormat Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageFormat Class Reference

    + +

    The TQImageFormat class is an incremental image decoder for a specific image format. +More... +

    #include <ntqasyncimageio.h> +

    List of all member functions. +

    Public Members

    +
      +
    • virtual int decode ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length ) = 0
    • +
    +

    Detailed Description

    + + +The TQImageFormat class is an incremental image decoder for a specific image format. +

    + + +

    By making a derived class of TQImageFormatType, which in turn +creates objects that are a subclass of TQImageFormat, you can add +support for more incremental image formats, allowing such formats +to be sources for a TQMovie or for the first frame of the image +stream to be loaded as a TQImage or TQPixmap. +

    Your new subclass must reimplement the decode() function in order +to process your new format. +

    New TQImageFormat objects are generated by new TQImageFormatType +factories. +

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. + +


    Member Function Documentation

    +

    int TQImageFormat::decode ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length ) [pure virtual] +

    + +

    New subclasses must reimplement this method. +

    It should decode some or all of the bytes from buffer into img, calling the methods of consumer as the decoding proceeds +to inform that consumer of changes to the image. The length of the +data is given in length. The consumer may be 0, in which case +the function should just process the data into img without +telling any consumer about the changes. Note that the decoder must +store enough state to be able to continue in subsequent calls to +this method - this is the essence of the incremental image +loading. +

    The function should return without processing all the data if it +reaches the end of a frame in the input. +

    The function must return the number of bytes it has processed. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformatplugin-h.html b/doc/html/tqimageformatplugin-h.html new file mode 100644 index 000000000..659246115 --- /dev/null +++ b/doc/html/tqimageformatplugin-h.html @@ -0,0 +1,112 @@ + + + + + +tqimageformatplugin.h Include File + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    tqimageformatplugin.h

    + +

    This is the verbatim text of the tqimageformatplugin.h include file. It is provided only for illustration; the copyright remains with Trolltech. +


    +
    +/****************************************************************************
    +** $Id: qt/tqimageformatplugin.h   3.3.8   edited Jan 11 14:38 $
    +**
    +** Definition of ???
    +**
    +** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
    +**
    +** This file is part of the kernel module of the TQt GUI Toolkit.
    +**
    +** This file may be used under the terms of the GNU General Public
    +** License versions 2.0 or 3.0 as published by the Free Software
    +** Foundation and appearing in the file LICENSE.GPL included in the
    +** packaging of this file. Alternatively you may (at your option) use any
    +** later version of the GNU General Public License if such license has
    +** been publicly approved by Trolltech ASA (or its successors, if any)
    +** and the KDE Free TQt Foundation.
    +**
    +** Please review the following information to ensure GNU General
    +** Public Licensing requirements will be met:
    +** http://trolltech.com/products/qt/licenses/licensing/opensource/.
    +** If you are unsure which license is appropriate for your use, please
    +** review the following information:
    +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
    +** or contact the sales department at sales@trolltech.com.
    +**
    +** This file may be used under the terms of the Q Public License as
    +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
    +** included in the packaging of this file.  Licensees holding valid TQt
    +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
    +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
    +** herein.
    +**
    +**********************************************************************/
    +
    +#ifndef TQIMAGEFORMATPLUGIN_H
    +#define TQIMAGEFORMATPLUGIN_H
    +
    +#ifndef QT_H
    +#include "ntqgplugin.h"
    +#include "ntqstringlist.h"
    +#endif // QT_H
    +
    +#ifndef TQT_NO_IMAGEFORMATPLUGIN
    +class TQImageFormat;
    +class TQImageFormatPluginPrivate;
    +
    +class TQ_EXPORT TQImageFormatPlugin : public TQGPlugin
    +{
    +    TQ_OBJECT
    +public:
    +    TQImageFormatPlugin();
    +    ~TQImageFormatPlugin();
    +
    +    virtual TQStringList keys() const = 0;
    +    virtual bool loadImage( const TQString &format, const TQString &filename, TQImage *image );
    +    virtual bool saveImage( const TQString &format, const TQString &filename, const TQImage &image );
    +    virtual bool installIOHandler( const TQString &format ) = 0;
    +
    +private:
    +    TQImageFormatPluginPrivate *d;
    +};
    +#endif // TQT_NO_IMAGEFORMATPLUGIN
    +#endif // TQIMAGEFORMATPLUGIN_H
    +
    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformatplugin-members.html b/doc/html/tqimageformatplugin-members.html new file mode 100644 index 000000000..b385c21d5 --- /dev/null +++ b/doc/html/tqimageformatplugin-members.html @@ -0,0 +1,50 @@ + + + + + +TQImageFormatPlugin Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageFormatPlugin

    + +

    This is the complete list of member functions for +TQImageFormatPlugin, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformatplugin.html b/doc/html/tqimageformatplugin.html new file mode 100644 index 000000000..2e69a2ae8 --- /dev/null +++ b/doc/html/tqimageformatplugin.html @@ -0,0 +1,94 @@ + + + + + +TQImageFormatPlugin Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageFormatPlugin Class Reference

    + +

    The TQImageFormatPlugin class provides an abstract base for custom image format plugins. +More... +

    #include <tqimageformatplugin.h> +

    List of all member functions. +

    Public Members

    + +

    Detailed Description

    + + +The TQImageFormatPlugin class provides an abstract base for custom image format plugins. +

    +

    The image format plugin is a simple plugin interface that makes +it easy to create custom image formats that can be used +transparently by applications. +

    Writing an image format plugin is achieved by subclassing this +base class, reimplementing the pure virtual functions keys() and +installIOHandler(), and exporting the class with the +TQ_EXPORT_PLUGIN macro. See the Plugins + documentation for details. +

    See also Plugins. + +


    Member Function Documentation

    +

    TQImageFormatPlugin::TQImageFormatPlugin () +

    +Constructs an image format plugin. This is invoked automatically +by the TQ_EXPORT_PLUGIN macro. + +

    TQImageFormatPlugin::~TQImageFormatPlugin () +

    +Destroys the image format plugin. +

    You never have to call this explicitly. TQt destroys a plugin +automatically when it is no longer used. + +

    bool TQImageFormatPlugin::installIOHandler ( const TQString & format ) [pure virtual] +

    + +

    Installs a TQImageIO image I/O handler for the image format format. +

    See also keys(). + +

    TQStringList TQImageFormatPlugin::keys () const [pure virtual] +

    + +

    Returns the list of image formats this plugin supports. +

    See also installIOHandler(). + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformattype-members.html b/doc/html/tqimageformattype-members.html new file mode 100644 index 000000000..31fd57aff --- /dev/null +++ b/doc/html/tqimageformattype-members.html @@ -0,0 +1,50 @@ + + + + + +TQImageFormatType Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageFormatType

    + +

    This is the complete list of member functions for +TQImageFormatType, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageformattype.html b/doc/html/tqimageformattype.html new file mode 100644 index 000000000..5cad1bb5c --- /dev/null +++ b/doc/html/tqimageformattype.html @@ -0,0 +1,108 @@ + + + + + +TQImageFormatType Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageFormatType Class Reference

    + +

    The TQImageFormatType class is a factory that makes TQImageFormat objects. +More... +

    #include <ntqasyncimageio.h> +

    List of all member functions. +

    Public Members

    + +

    Protected Members

    + +

    Detailed Description

    + + +The TQImageFormatType class is a factory that makes TQImageFormat objects. +

    + + +

    Whereas the TQImageIO class allows for complete loading of +images, TQImageFormatType allows for incremental loading of +images. +

    New image file formats are installed by creating objects of +derived classes of TQImageFormatType. They must implement +decoderFor() and formatName(). +

    TQImageFormatType is a very simple class. Its only task is to +recognize image data in some format and make a new object, +subclassed from TQImageFormat, which can decode that format. +

    The factories for formats built into TQt are automatically defined +before any other factory is initialized. If two factories would +recognize an image format, the factory created last will override +the earlier one; you can thus override current and future built-in +formats. +

    See also Graphics Classes, Image Processing Classes, and Multimedia Classes. + +


    Member Function Documentation

    +

    TQImageFormatType::TQImageFormatType () [protected] +

    +Constructs a factory. It automatically registers itself with +TQImageDecoder. + +

    TQImageFormatType::~TQImageFormatType () [virtual] +

    +Destroys a factory. It automatically unregisters itself from +TQImageDecoder. + +

    TQImageFormat * TQImageFormatType::decoderFor ( const uchar * buffer, int length ) [pure virtual] +

    + +

    Returns a decoder for decoding an image that starts with the bytes +in buffer. The length of the data is given in length. This +function should only return a decoder if it is certain that the +decoder applies to data with the given header. Returns 0 if there +is insufficient data in the header to make a positive +identification or if the data is not recognized. + +

    const char * TQImageFormatType::formatName () const [pure virtual] +

    + +

    Returns the name of the format supported by decoders from this +factory. The string is statically allocated. + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageio-members.html b/doc/html/tqimageio-members.html new file mode 100644 index 000000000..69bdfeaa6 --- /dev/null +++ b/doc/html/tqimageio-members.html @@ -0,0 +1,72 @@ + + + + + +TQImageIO Member List + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    Complete Member List for TQImageIO

    + +

    This is the complete list of member functions for +TQImageIO, including inherited members. + +

    + +


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqimageio.html b/doc/html/tqimageio.html new file mode 100644 index 000000000..a33e63519 --- /dev/null +++ b/doc/html/tqimageio.html @@ -0,0 +1,372 @@ + + + + + +TQImageIO Class + + + + + + + +
    + +Home + | +All Classes + | +Main Classes + | +Annotated + | +Grouped Classes + | +Functions +

    TQImageIO Class Reference

    + +

    The TQImageIO class contains parameters for loading and +saving images. +More... +

    #include <tqimage.h> +

    List of all member functions. +

    Public Members

    + +

    Static Public Members

    +
      +
    • const char * imageFormat ( const TQString & fileName )
    • +
    • const char * imageFormat ( TQIODevice * d )
    • +
    • TQStrList inputFormats ()
    • +
    • TQStrList outputFormats ()
    • +
    • void defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )
    • +
    +

    Detailed Description

    + + +

    The TQImageIO class contains parameters for loading and +saving images. +

    + + +

    TQImageIO contains a TQIODevice object that is used for image data +I/O. The programmer can install new image file formats in addition +to those that TQt provides. +

    TQt currently supports the following image file formats: PNG, BMP, +XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if +specially configured during compilation. The different PNM formats +are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6). +

    You don't normally need to use this class; TQPixmap::load(), +TQPixmap::save(), and TQImage contain sufficient functionality. +

    For image files that contain sequences of images, only the first +is read. See TQMovie for loading multiple images. +

    PBM, PGM, and PPM format output is always in the more condensed +raw format. PPM and PGM files with more than 256 levels of +intensity are scaled down when reading. +

    Warning: If you are in a country which recognizes software patents +and in which Unisys holds a patent on LZW compression and/or +decompression and you want to use GIF, Unisys may require you to +license the technology. Such countries include Canada, Japan, the +USA, France, Germany, Italy and the UK. +

    GIF support may be removed completely in a future version of TQt. +We recommend using the PNG format. +

    See also TQImage, TQPixmap, TQFile, TQMovie, Graphics Classes, Image Processing Classes, and Input/Output and Networking. + +


    Member Function Documentation

    +

    TQImageIO::TQImageIO () +

    +Constructs a TQImageIO object with all parameters set to zero. + +

    TQImageIO::TQImageIO ( TQIODevice * ioDevice, const char * format ) +

    +Constructs a TQImageIO object with the I/O device ioDevice and a +format tag. + +

    TQImageIO::TQImageIO ( const TQString & fileName, const char * format ) +

    +Constructs a TQImageIO object with the file name fileName and a +format tag. + +

    TQImageIO::~TQImageIO () +

    +Destroys the object and all related data. + +

    void TQImageIO::defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage ) [static] +

    +Defines an image I/O handler for the image format called format, which is recognized using the regular expression header, read using readImage and +written using writeImage. +

    flags is a string of single-character flags for this format. +The only flag defined currently is T (upper case), so the only +legal value for flags are "T" and the empty string. The "T" +flag means that the image file is a text file, and TQt should treat +all newline conventions as equivalent. (XPM files and some PPM +files are text files for example.) +

    format is used to select a handler to write a TQImage; header +is used to select a handler to read an image file. +

    If readImage is a null pointer, the TQImageIO will not be able +to read images in format. If writeImage is a null pointer, +the TQImageIO will not be able to write images in format. If +both are null, the TQImageIO object is valid but useless. +

    Example: +

    +        void readGIF( TQImageIO *image )
    +        {
    +        // read the image using the image->ioDevice()
    +        }
    +
    +        void writeGIF( TQImageIO *image )
    +        {
    +        // write the image using the image->ioDevice()
    +        }
    +
    +        // add the GIF image handler
    +
    +        TQImageIO::defineIOHandler( "GIF",
    +                                   "^GIF[0-9][0-9][a-z]",
    +                                   0,
    +                                   readGIF,
    +                                   writeGIF );
    +    
    + +

    Before the regex test, all the 0 bytes in the file header are +converted to 1 bytes. This is done because when TQt was +ASCII-based, TQRegExp could not handle 0 bytes in strings. +

    The regexp is only applied on the first 14 bytes of the file. +

    Note that TQt assumes that there is only one handler per format; if +two handlers support the same format, TQt will choose one +arbitrarily. It is not possible to have one handler support +reading, and another support writing. + +

    TQString TQImageIO::description () const +

    + +

    Returns the image description string. +

    See also setDescription(). + +

    TQString TQImageIO::fileName () const +

    + +

    Returns the file name currently set. +

    See also setFileName(). + +

    const char * TQImageIO::format () const +

    + +

    Returns the image format string or 0 if no format has been +explicitly set. + +

    float TQImageIO::gamma () const +

    +Returns the gamma value at which the image will be viewed. +

    See also setGamma(). + +

    const TQImage & TQImageIO::image () const +

    + +

    Returns the image currently set. +

    See also setImage(). + +

    const char * TQImageIO::imageFormat ( const TQString & fileName ) [static] +

    +Returns a string that specifies the image format of the file fileName, or null if the file cannot be read or if the format is +not recognized. + +

    const char * TQImageIO::imageFormat ( TQIODevice * d ) [static] +

    +This is an overloaded member function, provided for convenience. It behaves essentially like the above function. +

    Returns a string that specifies the image format of the image read +from IO device d, or 0 if the device cannot be read or if the +format is not recognized. +

    Make sure that d is at the right position in the device (for +example, at the beginning of the file). +

    See also TQIODevice::at(). + +

    TQStrList TQImageIO::inputFormats () [static] +

    +Returns a sorted list of image formats that are supported for +image input. + +

    TQIODevice * TQImageIO::ioDevice () const +

    + +

    Returns the IO device currently set. +

    See also setIODevice(). + +

    TQStrList TQImageIO::outputFormats () [static] +

    +Returns a sorted list of image formats that are supported for +image output. + +

    Example: scribble/scribble.cpp. +

    const char * TQImageIO::parameters () const +

    +Returns the image's parameters string. +

    See also setParameters(). + +

    int TQImageIO::quality () const +

    +Returns the quality of the written image, related to the +compression ratio. +

    See also setQuality() and TQImage::save(). + +

    bool TQImageIO::read () +

    +Reads an image into memory and returns TRUE if the image was +successfully read; otherwise returns FALSE. +

    Before reading an image you must set an IO device or a file name. +If both an IO device and a file name have been set, the IO device +will be used. +

    Setting the image file format string is optional. +

    Note that this function does not set the format used to read the image. If you need that +information, use the imageFormat() static functions. +

    Example: +

    +        TQImageIO iio;
    +        TQPixmap  pixmap;
    +        iio.setFileName( "vegeburger.bmp" );
    +        if ( image.read() )        // ok
    +            pixmap = iio.image();  // convert to pixmap
    +    
    + +

    See also setIODevice(), setFileName(), setFormat(), write(), and TQPixmap::load(). + +

    void TQImageIO::setDescription ( const TQString & description ) +

    +Sets the image description string for image handlers that support +image descriptions to description. +

    Currently, no image format supported by TQt uses the description +string. + +

    void TQImageIO::setFileName ( const TQString & fileName ) +

    +Sets the name of the file to read or write an image from to fileName. +

    See also setIODevice(). + +

    void TQImageIO::setFormat ( const char * format ) +

    +Sets the image format to format for the image to be read or +written. +

    It is necessary to specify a format before writing an image, but +it is not necessary to specify a format before reading an image. +

    If no format has been set, TQt guesses the image format before +reading it. If a format is set the image will only be read if it +has that format. +

    See also read(), write(), and format(). + +

    void TQImageIO::setGamma ( float gamma ) +

    +Sets the gamma value at which the image will be viewed to gamma. If the image format stores a gamma value for which the +image is intended to be used, then this setting will be used to +modify the image. Setting to 0.0 will disable gamma correction +(i.e. any specification in the file will be ignored). +

    The default value is 0.0. +

    See also gamma(). + +

    void TQImageIO::setIODevice ( TQIODevice * ioDevice ) +

    +Sets the IO device to be used for reading or writing an image. +

    Setting the IO device allows images to be read/written to any +block-oriented TQIODevice. +

    If ioDevice is not null, this IO device will override file name +settings. +

    See also setFileName(). + +

    void TQImageIO::setImage ( const TQImage & image ) +

    +Sets the image to image. +

    See also image(). + +

    void TQImageIO::setParameters ( const char * parameters ) +

    +Sets the image's parameter string to parameters. This is for +image handlers that require special parameters. +

    Although the current image formats supported by TQt ignore the +parameters string, it may be used in future extensions or by +contributions (for example, JPEG). +

    See also parameters(). + +

    void TQImageIO::setQuality ( int q ) +

    +Sets the quality of the written image to q, related to the +compression ratio. +

    q must be in the range -1..100. Specify 0 to obtain small +compressed files, 100 for large uncompressed files. (-1 signifies +the default compression.) +

    See also quality() and TQImage::save(). + +

    void TQImageIO::setStatus ( int status ) +

    +Sets the image IO status to status. A non-zero value indicates +an error, whereas 0 means that the IO operation was successful. +

    See also status(). + +

    int TQImageIO::status () const +

    + +

    Returns the image's IO status. A non-zero value indicates an +error, whereas 0 means that the IO operation was successful. +

    See also setStatus(). + +

    bool TQImageIO::write () +

    +Writes an image to an IO device and returns TRUE if the image was +successfully written; otherwise returns FALSE. +

    Before writing an image you must set an IO device or a file name. +If both an IO device and a file name have been set, the IO device +will be used. +

    The image will be written using the specified image format. +

    Example: +

    +        TQImageIO iio;
    +        TQImage   im;
    +        im = pixmap; // convert to image
    +        iio.setImage( im );
    +        iio.setFileName( "vegeburger.bmp" );
    +        iio.setFormat( "BMP" );
    +        if ( iio.write() )
    +            // returned TRUE if written successfully
    +    
    + +

    See also setIODevice(), setFileName(), setFormat(), read(), and TQPixmap::save(). + + +


    +This file is part of the TQt toolkit. +Copyright © 1995-2007 +Trolltech. All Rights Reserved.


    + +
    Copyright © 2007 +TrolltechTrademarks +
    TQt 3.3.8
    +
    + diff --git a/doc/html/tqwidget.html b/doc/html/tqwidget.html index 73d78aa90..7f973c943 100644 --- a/doc/html/tqwidget.html +++ b/doc/html/tqwidget.html @@ -923,7 +923,7 @@ This event handler is called when a drag is in progress and the mouse enters this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragEnterEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragEnterEvent.

    Example: iconview/simple_dd/main.cpp.

    void TQWidget::dragLeaveEvent ( TQDragLeaveEvent * ) [virtual protected] @@ -932,7 +932,7 @@ This event handler is called when a drag is in progress and the mouse leaves this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragLeaveEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragLeaveEvent.

    void TQWidget::dragMoveEvent ( TQDragMoveEvent * ) [virtual protected]

    @@ -940,7 +940,7 @@ This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDragMoveEvent. +

    See also TQTextDrag, TQImageDrag, and TQDragMoveEvent.

    void TQWidget::drawText ( int x, int y, const TQString & str )

    @@ -962,7 +962,7 @@ This event handler is called when the drag is dropped on this widget.

    See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. -

    See also TQTextDrag, TQImageDrag, and TQDropEvent. +

    See also TQTextDrag, TQImageDrag, and TQDropEvent.

    Example: iconview/simple_dd/main.cpp.

    void TQWidget::enabledChange ( bool oldEnabled ) [virtual protected] diff --git a/doc/html/tqwidgetfactory-h.html b/doc/html/tqwidgetfactory-h.html index 47a6e40da..2a377386e 100644 --- a/doc/html/tqwidgetfactory-h.html +++ b/doc/html/tqwidgetfactory-h.html @@ -72,7 +72,7 @@ body { background: #ffffff; color: black; } #ifndef QT_H #include <ntqstring.h> #include <tqptrlist.h> -#include <ntqimage.h> +#include <tqimage.h> #include <ntqpixmap.h> #include <tqvaluelist.h> #include <tqmap.h> diff --git a/doc/html/whatsthis b/doc/html/whatsthis index df2ed25fd..2acba2da4 100644 --- a/doc/html/whatsthis +++ b/doc/html/whatsthis @@ -11,7 +11,7 @@ Abstract base for custom TQSqlDriver plugins. | TQSqlDriverPlugin Abstract base for custom QStyle plugins. | QStylePlugin Abstract base for custom QTextCodec plugins. | QTextCodecPlugin Abstract base for custom TQWidget plugins. | TQWidgetPlugin -Abstract base for custom image format plugins. | QImageFormatPlugin +Abstract base for custom image format plugins. | TQImageFormatPlugin Abstract base for fixed-size grids. | QGridView Abstract class that provides an API to initalize and access a COM object. | QAxBase Abstract graphic object on a TQCanvas. | TQCanvasItem @@ -22,7 +22,7 @@ Abstraction for date and edit editors. | QDateTimeEditBase Abstraction of Unicode text and the classic C '\0'-terminated char array. | TQString Abstraction of objects which provide formatted data of a certain MIME type. | QMimeSource Abstraction of the classic C zero-terminated char array (char *). | QCString -Abstraction used by QImageDecoder. | QImageConsumer +Abstraction used by TQImageDecoder. | TQImageConsumer Access serialization between threads. | QMutex Access to a selected area in a QTable. | QTableSelection Access to directory structures and their contents in a platform-independent way. | QDir @@ -117,7 +117,7 @@ Does low-level painting e.g. on widgets. | QPainter Doubly-linked list of char*. | QStrList Doubly-linked list of char* with case-insensitive comparison. | QStrIList Drag and drop object for transferring colors. | QColorDrag -Drag and drop object for transferring images. | QImageDrag +Drag and drop object for transferring images. | TQImageDrag Drag and drop object for transferring plain and Unicode text. | QTextDrag Drag object for a list of URI references. | QUriDrag Ellipse or ellipse segment on a TQCanvas. | TQCanvasEllipse @@ -143,7 +143,7 @@ Event which is sent when a drag and drop is completed. | QDropEvent Event which is sent when a widget is shown. | QShowEvent Event which is sent while a drag and drop is in progress. | QDragMoveEvent Extensible provider of mime-typed data. | QMimeSourceFactory -Factory that makes QImageFormat objects. | QImageFormatType +Factory that makes TQImageFormat objects. | TQImageFormatType Feedback on the progress of a slow operation. | QProgressDialog File previewing in QFileDialog. | QFilePreview Flexible SQL table widget that supports browsing and editing. | TQDataTable @@ -182,8 +182,8 @@ Implements an Appearance Manager style. | QMacStyle Implements font management in Qt/Embedded. | QFontManager Implements parts of the QAccessibleInterface for TQObjects. | QAccessibleObject Implements the keyboard driver for Qt/Embedded. | QWSKeyboardHandler -Incremental image decoder for a specific image format. | QImageFormat -Incremental image decoder for all supported image formats. | QImageDecoder +Incremental image decoder for a specific image format. | TQImageFormat +Incremental image decoder for all supported image formats. | TQImageDecoder Incremental loading of animations or images, signalling as it progresses. | QMovie Information about a paint device. | QPaintDeviceMetrics Information about the features of the DOM implementation. | TQDomImplementation @@ -266,7 +266,7 @@ Organizes widgets in a group with one horizontal row. | QHGroupBox Paint device that paints on a printer. | QPrinter Paint device that records and replays QPainter commands. | QPicture Parameters for input method events. | QIMEvent -Parameters for loading and saving images. | QImageIO +Parameters for loading and saving images. | TQImageIO Parameters that describe a Tablet event. | QTabletEvent Parameters that describe a close event. | QCloseEvent Parameters that describe a context menu event. | QContextMenuEvent diff --git a/doc/html/xform-example.html b/doc/html/xform-example.html index 8d2fd197a..8d434753a 100644 --- a/doc/html/xform-example.html +++ b/doc/html/xform-example.html @@ -461,7 +461,7 @@ void ShowXForm::showIt() int xpos = width()/2 - pw/2; int ypos = height()/2 - ph/2; - bitBlt( this, xpos, ypos, // copy pixmap to widget + bitBlt( this, xpos, ypos, // copy pixmap to widget &pm, 0, 0, -1, -1 ); eraseRect = mtx.map( r ); } diff --git a/doc/man/man3/tqcanvaspixmap.3qt b/doc/man/man3/tqcanvaspixmap.3qt index 89245ffb2..e3272218d 100644 --- a/doc/man/man3/tqcanvaspixmap.3qt +++ b/doc/man/man3/tqcanvaspixmap.3qt @@ -44,7 +44,7 @@ If you want to show a single pixmap on a TQCanvas use a TQCanvasSprite with just .PP When pixmaps are inserted into a TQCanvasPixmapArray they are held as TQCanvasPixmaps. TQCanvasSprites are used to show pixmaps on TQCanvases and hold their pixmaps in a TQCanvasPixmapArray. If you retrieve a frame (pixmap) from a TQCanvasSprite it will be returned as a TQCanvasPixmap. .PP -The pixmap is a QPixmap and can only be set in the constructor. There are three different constructors, one taking a QPixmap, one a TQImage and one a file name that refers to a file in any supported file format (see QImageIO). +The pixmap is a QPixmap and can only be set in the constructor. There are three different constructors, one taking a QPixmap, one a TQImage and one a file name that refers to a file in any supported file format (see TQImageIO). .PP TQCanvasPixmap can have a hotspot which is defined in terms of an (x, y) offset. When you create a TQCanvasPixmap from a PNG file or from a TQImage that has a TQImage::offset(), the offset() is initialized appropriately, otherwise the constructor leaves it at (0, 0). You can set it later using setOffset(). When the TQCanvasPixmap is used in a TQCanvasSprite, the offset position is the point at TQCanvasItem::x() and TQCanvasItem::y(), not the top-left corner of the pixmap. .PP diff --git a/doc/man/man3/tqclipboard.3qt b/doc/man/man3/tqclipboard.3qt index a837a697b..2e493bc90 100644 --- a/doc/man/man3/tqclipboard.3qt +++ b/doc/man/man3/tqclipboard.3qt @@ -136,7 +136,7 @@ Example: .br .fi .PP -QClipboard features some convenience functions to access common data types: setText() allows the exchange of Unicode text and setPixmap() and setImage() allows the exchange of QPixmaps and QImages between applications. The setData() function is the ultimate in flexibility: it allows you to add any QMimeSource into the clipboard. There are corresponding getters for each of these, e.g. text(), image() and pixmap(). +QClipboard features some convenience functions to access common data types: setText() allows the exchange of Unicode text and setPixmap() and setImage() allows the exchange of QPixmaps and TQImages between applications. The setData() function is the ultimate in flexibility: it allows you to add any QMimeSource into the clipboard. There are corresponding getters for each of these, e.g. text(), image() and pixmap(). .PP You can clear the clipboard by calling clear(). .SH "Platform Specific Information" @@ -257,7 +257,7 @@ This is shorthand for: .PP .nf .br - setData( new QImageDrag(image), mode ) + setData( new TQImageDrag(image), mode ) .br .fi .PP diff --git a/doc/man/man3/tqdragobject.3qt b/doc/man/man3/tqdragobject.3qt index 3696f4839..5cd6a7946 100644 --- a/doc/man/man3/tqdragobject.3qt +++ b/doc/man/man3/tqdragobject.3qt @@ -13,7 +13,7 @@ QDragObject \- Encapsulates MIME-based data transfer .PP Inherits TQObject and QMimeSource. .PP -Inherited by QStoredDrag, QTextDrag, QImageDrag, and QIconDrag. +Inherited by QStoredDrag, QTextDrag, TQImageDrag, and QIconDrag. .PP .SS "Public Members" .in +1c diff --git a/doc/man/man3/tqiconview.3qt b/doc/man/man3/tqiconview.3qt index ccd7a4284..a8003b48d 100644 --- a/doc/man/man3/tqiconview.3qt +++ b/doc/man/man3/tqiconview.3qt @@ -429,7 +429,7 @@ The simple approach to dragging items out of the icon view is to subclass QIconV .br .fi .PP -In this example we create a QTextDrag object, (derived from QDragObject), containing the item's label and return it as the drag object. We could just as easily have created a QImageDrag from the item's pixmap and returned that instead. +In this example we create a QTextDrag object, (derived from QDragObject), containing the item's label and return it as the drag object. We could just as easily have created a TQImageDrag from the item's pixmap and returned that instead. .PP QIconViews and their QIconViewItems can also be the targets of drag and drops. To make the QIconView itself able to accept drops connect to the dropped() signal. When a drop occurs this signal will be emitted with a QDragEvent and a TQValueList of QIconDragItems. To make a QIconViewItem into a drop target subclass QIconViewItem and reimplement QIconViewItem::acceptDrop() and QIconViewItem::dropped(). .PP diff --git a/doc/man/man3/tqimage.3qt b/doc/man/man3/tqimage.3qt index 7fafb7464..4e245f6d3 100644 --- a/doc/man/man3/tqimage.3qt +++ b/doc/man/man3/tqimage.3qt @@ -9,7 +9,7 @@ .SH NAME TQImage \- Hardware-independent pixmap representation with direct access to the pixel data .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP .SS "Public Members" .in +1c @@ -17,31 +17,31 @@ TQImage \- Hardware-independent pixmap representation with direct access to the .BI "enum \fBEndian\fR { IgnoreEndian, BigEndian, LittleEndian }" .br .ti -1c -.BI "\fBQImage\fR ()" +.BI "\fBTQImage\fR ()" .br .ti -1c -.BI "\fBQImage\fR ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )" +.BI "\fBTQImage\fR ( int w, int h, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )" .br .ti -1c -.BI "\fBQImage\fR ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )" +.BI "\fBTQImage\fR ( const QSize & size, int depth, int numColors = 0, Endian bitOrder = IgnoreEndian )" .br .ti -1c -.BI "\fBQImage\fR ( const TQString & fileName, const char * format = 0 )" +.BI "\fBTQImage\fR ( const TQString & fileName, const char * format = 0 )" .br .ti -1c -.BI "\fBQImage\fR ( const char * const xpm[] )" +.BI "\fBTQImage\fR ( const char * const xpm[] )" .br .ti -1c -.BI "\fBQImage\fR ( const QByteArray & array )" +.BI "\fBTQImage\fR ( const QByteArray & array )" .br .ti -1c -.BI "\fBQImage\fR ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder )" +.BI "\fBTQImage\fR ( uchar * yourdata, int w, int h, int depth, TQRgb * colortable, int numColors, Endian bitOrder )" .br .ti -1c -.BI "\fBQImage\fR ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder )" +.BI "\fBTQImage\fR ( uchar * yourdata, int w, int h, int depth, int bpl, TQRgb * colortable, int numColors, Endian bitOrder )" .br .ti -1c -.BI "\fBQImage\fR ( const TQImage & image )" +.BI "\fBTQImage\fR ( const TQImage & image )" .br .ti -1c .BI "\fB~TQImage\fR ()" @@ -245,7 +245,7 @@ TQImage \- Hardware-independent pixmap representation with direct access to the .BI "void \fBsetOffset\fR ( const QPoint & p )" .br .ti -1c -.BI "TQValueList \fBtextList\fR () const" +.BI "TQValueList \fBtextList\fR () const" .br .ti -1c .BI "QStringList \fBtextLanguages\fR () const" @@ -257,7 +257,7 @@ TQImage \- Hardware-independent pixmap representation with direct access to the .BI "TQString \fBtext\fR ( const char * key, const char * lang = 0 ) const" .br .ti -1c -.BI "TQString \fBtext\fR ( const QImageTextKeyLang & kl ) const" +.BI "TQString \fBtext\fR ( const TQImageTextKeyLang & kl ) const" .br .ti -1c .BI "void \fBsetText\fR ( const char * key, const char * lang, const TQString & s )" @@ -379,16 +379,16 @@ The TQImage class uses explicit sharing, similar to that used by QMemArray. .PP New image formats can be added as plugins. .PP -See also QImageIO, QPixmap, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. +See also TQImageIO, QPixmap, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. .SS "Member Type Documentation" .SH "TQImage::Endian" This enum type is used to describe the endianness of the CPU and graphics hardware. .TP -\fCQImage::IgnoreEndian\fR - Endianness does not matter. Useful for some operations that are independent of endianness. +\fCTQImage::IgnoreEndian\fR - Endianness does not matter. Useful for some operations that are independent of endianness. .TP -\fCQImage::BigEndian\fR - Network byte order, as on SPARC and Motorola CPUs. +\fCTQImage::BigEndian\fR - Network byte order, as on SPARC and Motorola CPUs. .TP -\fCQImage::LittleEndian\fR - PC/Alpha byte order. +\fCTQImage::LittleEndian\fR - PC/Alpha byte order. .SH "TQImage::ScaleMode" The functions scale() and smoothScale() use different modes for scaling the image. The purpose of these modes is to retain the ratio of the image if this is required. .PP @@ -398,11 +398,11 @@ The functions scale() and smoothScale() use different modes for scaling the imag .PP .TP -\fCQImage::ScaleFree\fR - The image is scaled freely: the resulting image fits exactly into the specified size; the ratio will not necessarily be preserved. +\fCTQImage::ScaleFree\fR - The image is scaled freely: the resulting image fits exactly into the specified size; the ratio will not necessarily be preserved. .TP -\fCQImage::ScaleMin\fR - The ratio of the image is preserved and the resulting image is guaranteed to fit into the specified size (it is as large as possible within these constraints) - the image might be smaller than the requested size. +\fCTQImage::ScaleMin\fR - The ratio of the image is preserved and the resulting image is guaranteed to fit into the specified size (it is as large as possible within these constraints) - the image might be smaller than the requested size. .TP -\fCQImage::ScaleMax\fR - The ratio of the image is preserved and the resulting image fills the whole specified rectangle (it is as small as possible within these constraints) - the image might be larger than the requested size. +\fCTQImage::ScaleMax\fR - The ratio of the image is preserved and the resulting image fills the whole specified rectangle (it is as small as possible within these constraints) - the image might be larger than the requested size. .SH MEMBER FUNCTION DOCUMENTATION .SH "TQImage::TQImage ()" Constructs a null image. @@ -427,9 +427,9 @@ If \fIformat\fR is specified, the loader attempts to read the image using the sp .PP If the loading of the image failed, this object is a null image. .PP -The QImageIO documentation lists the supported image formats and explains how to add extra formats. +The TQImageIO documentation lists the supported image formats and explains how to add extra formats. .PP -See also load(), isNull(), and QImageIO. +See also load(), isNull(), and TQImageIO. .SH "TQImage::TQImage ( const char * const xpm[] )" Constructs an image from \fIxpm\fR, which must be a valid XPM image. .PP @@ -629,7 +629,7 @@ See also invertPixels(), depth(), hasAlphaBuffer(), and create(). .SH "TQImage TQImage::fromMimeSource ( const TQString & abs_name )\fC [static]\fR" Convenience function. Gets the data associated with the absolute name \fIabs_name\fR from the default mime source factory and decodes it to an image. .PP -See also QMimeSourceFactory, TQImage::fromMimeSource(), and QImageDrag::decode(). +See also QMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode(). .SH "bool TQImage::hasAlphaBuffer () const" Returns TRUE if alpha buffer mode is enabled; otherwise returns FALSE. .PP @@ -644,7 +644,7 @@ Examples: .SH "const char * TQImage::imageFormat ( const TQString & fileName )\fC [static]\fR" Returns a string that specifies the image format of the file \fIfileName\fR, or 0 if the file cannot be read or if the format is not recognized. .PP -The QImageIO documentation lists the guaranteed supported image formats, or use TQImage::inputFormats() and TQImage::outputFormats() to get lists that include the installed formats. +The TQImageIO documentation lists the guaranteed supported image formats, or use TQImage::inputFormats() and TQImage::outputFormats() to get lists that include the installed formats. .PP See also load() and save(). .SH "QStringList TQImage::inputFormatList ()\fC [static]\fR" @@ -668,13 +668,13 @@ Note that if you want to iterate over the list, you should iterate over a copy, .br .fi .PP -See also outputFormatList(), inputFormats(), and QImageIO. +See also outputFormatList(), inputFormats(), and TQImageIO. .PP Example: showimg/showimg.cpp. .SH "QStrList TQImage::inputFormats ()\fC [static]\fR" Returns a list of image formats that are supported for image input. .PP -See also outputFormats(), inputFormatList(), and QImageIO. +See also outputFormats(), inputFormatList(), and TQImageIO. .SH "void TQImage::invertPixels ( bool invertAlpha = TRUE )" Inverts all pixel values in the image. .PP @@ -708,17 +708,17 @@ Loads an image from the file \fIfileName\fR. Returns TRUE if the image was succe .PP If \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (which is the default), the loader reads a few bytes from the header to guess the file format. .PP -The QImageIO documentation lists the supported image formats and explains how to add extra formats. +The TQImageIO documentation lists the supported image formats and explains how to add extra formats. .PP -See also loadFromData(), save(), imageFormat(), QPixmap::load(), and QImageIO. +See also loadFromData(), save(), imageFormat(), QPixmap::load(), and TQImageIO. .SH "bool TQImage::loadFromData ( const uchar * buf, uint len, const char * format = 0 )" Loads an image from the first \fIlen\fR bytes of binary data in \fIbuf\fR. Returns TRUE if the image was successfully loaded; otherwise returns FALSE. .PP If \fIformat\fR is specified, the loader attempts to read the image using the specified format. If \fIformat\fR is not specified (which is the default), the loader reads a few bytes from the header to guess the file format. .PP -The QImageIO documentation lists the supported image formats and explains how to add extra formats. +The TQImageIO documentation lists the supported image formats and explains how to add extra formats. .PP -See also load(), save(), imageFormat(), QPixmap::loadFromData(), and QImageIO. +See also load(), save(), imageFormat(), QPixmap::loadFromData(), and TQImageIO. .SH "bool TQImage::loadFromData ( QByteArray buf, const char * format = 0 )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP @@ -786,11 +786,11 @@ Note that if you want to iterate over the list, you should iterate over a copy, .br .fi .PP -See also inputFormatList(), outputFormats(), and QImageIO. +See also inputFormatList(), outputFormats(), and TQImageIO. .SH "QStrList TQImage::outputFormats ()\fC [static]\fR" Returns a list of image formats that are supported for image output. .PP -See also inputFormats(), outputFormatList(), and QImageIO. +See also inputFormats(), outputFormatList(), and TQImageIO. .PP Example: showimg/showimg.cpp. .SH "TQRgb TQImage::pixel ( int x, int y ) const" @@ -819,7 +819,7 @@ Saves the image to the file \fIfileName\fR, using the image file format \fIforma .PP Returns TRUE if the image was successfully saved; otherwise returns FALSE. .PP -See also load(), loadFromData(), imageFormat(), QPixmap::save(), and QImageIO. +See also load(), loadFromData(), imageFormat(), QPixmap::save(), and TQImageIO. .SH "bool TQImage::save ( TQIODevice * device, const char * format, int quality = -1 ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP @@ -959,7 +959,7 @@ Determines the host computer byte order. Returns TQImage::LittleEndian (LSB firs See also systemBitOrder(). .SH "TQString TQImage::text ( const char * key, const char * lang = 0 ) const" Returns the string recorded for the keyword \fIkey\fR in language \fIlang\fR, or in a default language if \fIlang\fR is 0. -.SH "TQString TQImage::text ( const QImageTextKeyLang & kl ) const" +.SH "TQString TQImage::text ( const TQImageTextKeyLang & kl ) const" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns the string recorded for the keyword and language \fIkl\fR. @@ -1007,16 +1007,16 @@ Note that if you want to iterate over the list, you should iterate over a copy, .fi .PP See also textList(), text(), setText(), and textKeys(). -.SH "TQValueList TQImage::textList () const" -Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set by setText() for this image. +.SH "TQValueList TQImage::textList () const" +Returns a list of TQImageTextKeyLang objects that enumerate all the texts key/language pairs set by setText() for this image. .PP Note that if you want to iterate over the list, you should iterate over a copy, e.g. .PP .nf .br - TQValueList list = myImage.textList(); + TQValueList list = myImage.textList(); .br - TQValueList::Iterator it = list.begin(); + TQValueList::Iterator it = list.begin(); .br while( it != list.end() ) { .br @@ -1070,7 +1070,7 @@ Reads an image from the stream \fIs\fR and stores it in \fIimage\fR. See also TQImage::load() and Format of the QDataStream operators. .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqimage.html +.BR http://doc.trolltech.com/tqimage.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimageconsumer.3qt b/doc/man/man3/tqimageconsumer.3qt index b7ee7687c..cbe1c44a9 100644 --- a/doc/man/man3/tqimageconsumer.3qt +++ b/doc/man/man3/tqimageconsumer.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageConsumer 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageConsumer 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QImageConsumer \- Abstraction used by QImageDecoder +TQImageConsumer \- Abstraction used by TQImageDecoder .SH SYNOPSIS \fC#include \fR .PP @@ -36,37 +36,37 @@ QImageConsumer \- Abstraction used by QImageDecoder .br .in -1c .SH DESCRIPTION -The QImageConsumer class is an abstraction used by QImageDecoder. +The TQImageConsumer class is an abstraction used by TQImageDecoder. .PP The QMovie class, or QLabel::setMovie(), are easy to use and for most situations do what you want with regards animated images. .PP -A QImageConsumer consumes information about changes to the TQImage maintained by a QImageDecoder. Think of the TQImage as the model or source of the image data, with the QImageConsumer as a view of that data and the QImageDecoder being the controller that orchestrates the relationship between the model and the view. +A TQImageConsumer consumes information about changes to the TQImage maintained by a TQImageDecoder. Think of the TQImage as the model or source of the image data, with the TQImageConsumer as a view of that data and the TQImageDecoder being the controller that orchestrates the relationship between the model and the view. .PP -You'd use the QImageConsumer class, for example, if you were implementing a web browser with your own image loaders. +You'd use the TQImageConsumer class, for example, if you were implementing a web browser with your own image loaders. .PP -See also QImageDecoder, Graphics Classes, Image Processing Classes, and Multimedia Classes. +See also TQImageDecoder, Graphics Classes, Image Processing Classes, and Multimedia Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "void QImageConsumer::changed ( const QRect & )\fC [pure virtual]\fR" +.SH "void TQImageConsumer::changed ( const QRect & )\fC [pure virtual]\fR" Called when the given area of the image has changed. -.SH "void QImageConsumer::end ()\fC [pure virtual]\fR" +.SH "void TQImageConsumer::end ()\fC [pure virtual]\fR" Called when all the data from all the frames has been decoded and revealed as changed(). -.SH "void QImageConsumer::frameDone ()\fC [pure virtual]\fR" +.SH "void TQImageConsumer::frameDone ()\fC [pure virtual]\fR" One of the two frameDone() functions will be called when a frame of an animated image has ended and been revealed as changed(). .PP When this function is called, the current image should be displayed. .PP -The decoder will not make any further changes to the image until the next call to QImageFormat::decode(). -.SH "void QImageConsumer::frameDone ( const QPoint & offset, const QRect & rect )\fC [pure virtual]\fR" +The decoder will not make any further changes to the image until the next call to TQImageFormat::decode(). +.SH "void TQImageConsumer::frameDone ( const QPoint & offset, const QRect & rect )\fC [pure virtual]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP One of the two frameDone() functions will be called when a frame of an animated image has ended and been revealed as changed(). .PP When this function is called, the area \fIrect\fR in the current image should be moved by \fIoffset\fR and displayed. .PP -The decoder will not make any further changes to the image until the next call to QImageFormat::decode(). -.SH "void QImageConsumer::setFramePeriod ( int milliseconds )\fC [pure virtual]\fR" +The decoder will not make any further changes to the image until the next call to TQImageFormat::decode(). +.SH "void TQImageConsumer::setFramePeriod ( int milliseconds )\fC [pure virtual]\fR" Notes that the frame about to be decoded should not be displayed until the given number of \fImilliseconds\fR after the time that this function is called. Of course, the image may not have been decoded by then, in which case the frame should not be displayed until it is complete. A value of -1 (the assumed default) indicates that the image should be displayed even while it is only partially loaded. -.SH "void QImageConsumer::setLooping ( int n )\fC [pure virtual]\fR" +.SH "void TQImageConsumer::setLooping ( int n )\fC [pure virtual]\fR" Called to indicate that the sequence of frames in the image should be repeated \fIn\fR times, including the sequence during decoding. .TP 0 = Forever @@ -77,13 +77,13 @@ Called to indicate that the sequence of frames in the image should be repeated \ .TP etc. .PP -To make the QImageDecoder do this, just delete it and pass the information to it again for decoding (setLooping() will be called again, of course, but that can be ignored), or keep copies of the changed areas at the ends of frames. -.SH "void QImageConsumer::setSize ( int, int )\fC [pure virtual]\fR" +To make the TQImageDecoder do this, just delete it and pass the information to it again for decoding (setLooping() will be called again, of course, but that can be ignored), or keep copies of the changed areas at the ends of frames. +.SH "void TQImageConsumer::setSize ( int, int )\fC [pure virtual]\fR" This function is called as soon as the size of the image has been determined. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimageconsumer.html +.BR http://doc.trolltech.com/tqimageconsumer.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimagedecoder.3qt b/doc/man/man3/tqimagedecoder.3qt index 0e262c501..6401c5950 100644 --- a/doc/man/man3/tqimagedecoder.3qt +++ b/doc/man/man3/tqimagedecoder.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageDecoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageDecoder 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,17 +7,17 @@ .ad l .nh .SH NAME -QImageDecoder \- Incremental image decoder for all supported image formats +TQImageDecoder \- Incremental image decoder for all supported image formats .SH SYNOPSIS \fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQImageDecoder\fR ( QImageConsumer * c )" +.BI "\fBTQImageDecoder\fR ( TQImageConsumer * c )" .br .ti -1c -.BI "\fB~QImageDecoder\fR ()" +.BI "\fB~TQImageDecoder\fR ()" .br .ti -1c .BI "const TQImage & \fBimage\fR ()" @@ -32,26 +32,26 @@ QImageDecoder \- Incremental image decoder for all supported image formats .BI "const char * \fBformatName\fR ( const uchar * buffer, int length )" .br .ti -1c -.BI "QImageFormatType * \fBformat\fR ( const char * name )" +.BI "TQImageFormatType * \fBformat\fR ( const char * name )" .br .ti -1c .BI "QStrList \fBinputFormats\fR ()" .br .ti -1c -.BI "void \fBregisterDecoderFactory\fR ( QImageFormatType * f )" +.BI "void \fBregisterDecoderFactory\fR ( TQImageFormatType * f )" .br .ti -1c -.BI "void \fBunregisterDecoderFactory\fR ( QImageFormatType * f )" +.BI "void \fBunregisterDecoderFactory\fR ( TQImageFormatType * f )" .br .in -1c .SH DESCRIPTION -The QImageDecoder class is an incremental image decoder for all supported image formats. +The TQImageDecoder class is an incremental image decoder for all supported image formats. .PP -New formats are installed by creating objects of class QImageFormatType; the QMovie class can be used for all installed incremental image formats. QImageDecoder is only useful for creating new ways of feeding data to an QImageConsumer. +New formats are installed by creating objects of class TQImageFormatType; the QMovie class can be used for all installed incremental image formats. TQImageDecoder is only useful for creating new ways of feeding data to an TQImageConsumer. .PP -A QImageDecoder is a machine that decodes images. It takes encoded image data via its decode() method and expresses its decoding by supplying information to a QImageConsumer. It implements its decoding by using a QImageFormat created by one of the currently-existing QImageFormatType factory objects. +A TQImageDecoder is a machine that decodes images. It takes encoded image data via its decode() method and expresses its decoding by supplying information to a TQImageConsumer. It implements its decoding by using a TQImageFormat created by one of the currently-existing TQImageFormatType factory objects. .PP -QImageFormatType and QImageFormat are the classes that you might need to implement support for additional image formats. +TQImageFormatType and TQImageFormat are the classes that you might need to implement support for additional image formats. .PP Qt supports GIF reading if it is configured that way during installation (see ntqgif.h). If it is, we are required to state that" The Graphics Interchange Format(c) is the Copyright property of CompuServe Incorporated. GIF(sm) is a Service Mark property of CompuServe Incorporated." .PP @@ -61,32 +61,32 @@ GIF support may be removed completely in a future version of Qt. We recommend us .PP See also Graphics Classes, Image Processing Classes, and Multimedia Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QImageDecoder::QImageDecoder ( QImageConsumer * c )" -Constructs a QImageDecoder that will send change information to the QImageConsumer \fIc\fR. -.SH "QImageDecoder::~QImageDecoder ()" -Destroys a QImageDecoder. The image it built is destroyed. The decoder built by the factory for the file format is destroyed. The consumer for which it decoded the image is \fInot\fR destroyed. -.SH "int QImageDecoder::decode ( const uchar * buffer, int length )" -Call this function to decode some data into image changes. The data in \fIbuffer\fR will be decoded, sending change information to the QImageConsumer of this QImageDecoder until one of the change functions of the consumer returns FALSE. The length of the data is given in \fIlength\fR. +.SH "TQImageDecoder::TQImageDecoder ( TQImageConsumer * c )" +Constructs a TQImageDecoder that will send change information to the TQImageConsumer \fIc\fR. +.SH "TQImageDecoder::~TQImageDecoder ()" +Destroys a TQImageDecoder. The image it built is destroyed. The decoder built by the factory for the file format is destroyed. The consumer for which it decoded the image is \fInot\fR destroyed. +.SH "int TQImageDecoder::decode ( const uchar * buffer, int length )" +Call this function to decode some data into image changes. The data in \fIbuffer\fR will be decoded, sending change information to the TQImageConsumer of this TQImageDecoder until one of the change functions of the consumer returns FALSE. The length of the data is given in \fIlength\fR. .PP Returns the number of bytes consumed: 0 if consumption is complete, and -1 if decoding fails due to invalid data. -.SH "QImageFormatType * QImageDecoder::format ( const char * name )\fC [static]\fR" -Returns a QImageFormatType by name. This might be used when the user needs to force data to be interpreted as being in a certain format. \fIname\fR is one of the formats listed by QImageDecoder::inputFormats(). Note that you will still need to supply decodable data to result->decoderFor() before you can begin decoding the data. -.SH "const char * QImageDecoder::formatName ( const uchar * buffer, int length )\fC [static]\fR" +.SH "TQImageFormatType * TQImageDecoder::format ( const char * name )\fC [static]\fR" +Returns a TQImageFormatType by name. This might be used when the user needs to force data to be interpreted as being in a certain format. \fIname\fR is one of the formats listed by TQImageDecoder::inputFormats(). Note that you will still need to supply decodable data to result->decoderFor() before you can begin decoding the data. +.SH "const char * TQImageDecoder::formatName ( const uchar * buffer, int length )\fC [static]\fR" Call this function to find the name of the format of the given header. The returned string is statically allocated. The function will look at the first \fIlength\fR characters in the \fIbuffer\fR. .PP Returns 0 if the format is not recognized. -.SH "const TQImage & QImageDecoder::image ()" +.SH "const TQImage & TQImageDecoder::image ()" Returns the image currently being decoded. -.SH "QStrList QImageDecoder::inputFormats ()\fC [static]\fR" +.SH "QStrList TQImageDecoder::inputFormats ()\fC [static]\fR" Returns a sorted list of formats for which asynchronous loading is supported. -.SH "void QImageDecoder::registerDecoderFactory ( QImageFormatType * f )\fC [static]\fR" -Registers the new QImageFormatType \fIf\fR. This is not needed in application code because factories call this themselves. -.SH "void QImageDecoder::unregisterDecoderFactory ( QImageFormatType * f )\fC [static]\fR" -Unregisters the QImageFormatType \fIf\fR. This is not needed in +.SH "void TQImageDecoder::registerDecoderFactory ( TQImageFormatType * f )\fC [static]\fR" +Registers the new TQImageFormatType \fIf\fR. This is not needed in application code because factories call this themselves. +.SH "void TQImageDecoder::unregisterDecoderFactory ( TQImageFormatType * f )\fC [static]\fR" +Unregisters the TQImageFormatType \fIf\fR. This is not needed in application code because factories call this themselves. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimagedecoder.html +.BR http://doc.trolltech.com/tqimagedecoder.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimagedrag.3qt b/doc/man/man3/tqimagedrag.3qt index 8c61fb42b..3db69ee29 100644 --- a/doc/man/man3/tqimagedrag.3qt +++ b/doc/man/man3/tqimagedrag.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageDrag 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageDrag 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,7 +7,7 @@ .ad l .nh .SH NAME -QImageDrag \- Drag and drop object for transferring images +TQImageDrag \- Drag and drop object for transferring images .SH SYNOPSIS \fC#include \fR .PP @@ -16,13 +16,13 @@ Inherits QDragObject. .SS "Public Members" .in +1c .ti -1c -.BI "\fBQImageDrag\fR ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )" +.BI "\fBTQImageDrag\fR ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )" .br .ti -1c -.BI "\fBQImageDrag\fR ( TQWidget * dragSource = 0, const char * name = 0 )" +.BI "\fBTQImageDrag\fR ( TQWidget * dragSource = 0, const char * name = 0 )" .br .ti -1c -.BI "\fB~QImageDrag\fR ()" +.BI "\fB~TQImageDrag\fR ()" .br .ti -1c .BI "virtual void \fBsetImage\fR ( TQImage image )" @@ -41,7 +41,7 @@ Inherits QDragObject. .br .in -1c .SH DESCRIPTION -The QImageDrag class provides a drag and drop object for transferring images. +The TQImageDrag class provides a drag and drop object for transferring images. .PP Images are offered to the receiving application in multiple formats, determined by Qt's output formats. .PP @@ -49,25 +49,25 @@ For more information about drag and drop, see the QDragObject class and the drag .PP See also Drag And Drop Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QImageDrag::QImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )" +.SH "TQImageDrag::TQImageDrag ( TQImage image, TQWidget * dragSource = 0, const char * name = 0 )" Constructs an image drag object and sets its data to \fIimage\fR. \fIdragSource\fR must be the drag source; \fIname\fR is the object name. -.SH "QImageDrag::QImageDrag ( TQWidget * dragSource = 0, const char * name = 0 )" +.SH "TQImageDrag::TQImageDrag ( TQWidget * dragSource = 0, const char * name = 0 )" Constructs a default image drag object. \fIdragSource\fR must be the drag source; \fIname\fR is the object name. -.SH "QImageDrag::~QImageDrag ()" +.SH "TQImageDrag::~TQImageDrag ()" Destroys the image drag object and frees up all allocated resources. -.SH "bool QImageDrag::canDecode ( const QMimeSource * e )\fC [static]\fR" +.SH "bool TQImageDrag::canDecode ( const QMimeSource * e )\fC [static]\fR" Returns TRUE if the information in mime source \fIe\fR can be decoded into an image; otherwise returns FALSE. .PP See also decode(). .PP Example: desktop/desktop.cpp. -.SH "bool QImageDrag::decode ( const QMimeSource * e, TQImage & img )\fC [static]\fR" +.SH "bool TQImageDrag::decode ( const QMimeSource * e, TQImage & img )\fC [static]\fR" Attempts to decode the dropped information in mime source \fIe\fR into \fIimg\fR. Returns TRUE if successful; otherwise returns FALSE. .PP See also canDecode(). .PP Example: desktop/desktop.cpp. -.SH "bool QImageDrag::decode ( const QMimeSource * e, QPixmap & pm )\fC [static]\fR" +.SH "bool TQImageDrag::decode ( const QMimeSource * e, QPixmap & pm )\fC [static]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Attempts to decode the dropped information in mime source \fIe\fR into pixmap \fIpm\fR. Returns TRUE if successful; otherwise returns FALSE. @@ -75,12 +75,12 @@ Attempts to decode the dropped information in mime source \fIe\fR into pixmap \f This is a convenience function that converts to a QPixmap via a TQImage. .PP See also canDecode(). -.SH "void QImageDrag::setImage ( TQImage image )\fC [virtual]\fR" +.SH "void TQImageDrag::setImage ( TQImage image )\fC [virtual]\fR" Sets the image to be dragged to \fIimage\fR. You will need to call this if you did not pass the image during construction. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimagedrag.html +.BR http://doc.trolltech.com/tqimagedrag.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimageformat.3qt b/doc/man/man3/tqimageformat.3qt index 532efd2ec..ff1cdf222 100644 --- a/doc/man/man3/tqimageformat.3qt +++ b/doc/man/man3/tqimageformat.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageFormat 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageFormat 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,28 +7,28 @@ .ad l .nh .SH NAME -QImageFormat \- Incremental image decoder for a specific image format +TQImageFormat \- Incremental image decoder for a specific image format .SH SYNOPSIS \fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "virtual int \fBdecode\fR ( TQImage & img, QImageConsumer * consumer, const uchar * buffer, int length ) = 0" +.BI "virtual int \fBdecode\fR ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length ) = 0" .br .in -1c .SH DESCRIPTION -The QImageFormat class is an incremental image decoder for a specific image format. +The TQImageFormat class is an incremental image decoder for a specific image format. .PP -By making a derived class of QImageFormatType, which in turn creates objects that are a subclass of QImageFormat, you can add support for more incremental image formats, allowing such formats to be sources for a QMovie or for the first frame of the image stream to be loaded as a TQImage or QPixmap. +By making a derived class of TQImageFormatType, which in turn creates objects that are a subclass of TQImageFormat, you can add support for more incremental image formats, allowing such formats to be sources for a QMovie or for the first frame of the image stream to be loaded as a TQImage or QPixmap. .PP Your new subclass must reimplement the decode() function in order to process your new format. .PP -New QImageFormat objects are generated by new QImageFormatType factories. +New TQImageFormat objects are generated by new TQImageFormatType factories. .PP See also Graphics Classes, Image Processing Classes, and Multimedia Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "int QImageFormat::decode ( TQImage & img, QImageConsumer * consumer, const uchar * buffer, int length )\fC [pure virtual]\fR" +.SH "int TQImageFormat::decode ( TQImage & img, TQImageConsumer * consumer, const uchar * buffer, int length )\fC [pure virtual]\fR" New subclasses must reimplement this method. .PP It should decode some or all of the bytes from \fIbuffer\fR into \fIimg\fR, calling the methods of \fIconsumer\fR as the decoding proceeds to inform that consumer of changes to the image. The length of the data is given in \fIlength\fR. The consumer may be 0, in which case the function should just process the data into \fIimg\fR without telling any consumer about the changes. Note that the decoder must store enough state to be able to continue in subsequent calls to this method - this is the essence of the incremental image loading. @@ -38,7 +38,7 @@ The function should return without processing all the data if it reaches the end The function must return the number of bytes it has processed. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimageformat.html +.BR http://doc.trolltech.com/tqimageformat.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimageformatplugin.3qt b/doc/man/man3/tqimageformatplugin.3qt index 4a7b69557..94334cd03 100644 --- a/doc/man/man3/tqimageformatplugin.3qt +++ b/doc/man/man3/tqimageformatplugin.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageFormatPlugin 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageFormatPlugin 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,17 +7,17 @@ .ad l .nh .SH NAME -QImageFormatPlugin \- Abstract base for custom image format plugins +TQImageFormatPlugin \- Abstract base for custom image format plugins .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQImageFormatPlugin\fR ()" +.BI "\fBTQImageFormatPlugin\fR ()" .br .ti -1c -.BI "\fB~QImageFormatPlugin\fR ()" +.BI "\fB~TQImageFormatPlugin\fR ()" .br .ti -1c .BI "virtual QStringList \fBkeys\fR () const = 0" @@ -27,7 +27,7 @@ QImageFormatPlugin \- Abstract base for custom image format plugins .br .in -1c .SH DESCRIPTION -The QImageFormatPlugin class provides an abstract base for custom image format plugins. +The TQImageFormatPlugin class provides an abstract base for custom image format plugins. .PP The image format plugin is a simple plugin interface that makes it easy to create custom image formats that can be used transparently by applications. .PP @@ -35,23 +35,23 @@ Writing an image format plugin is achieved by subclassing this base class, reimp .PP See also Plugins. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QImageFormatPlugin::QImageFormatPlugin ()" +.SH "TQImageFormatPlugin::TQImageFormatPlugin ()" Constructs an image format plugin. This is invoked automatically by the TQ_EXPORT_PLUGIN macro. -.SH "QImageFormatPlugin::~QImageFormatPlugin ()" +.SH "TQImageFormatPlugin::~TQImageFormatPlugin ()" Destroys the image format plugin. .PP You never have to call this explicitly. TQt destroys a plugin automatically when it is no longer used. -.SH "bool QImageFormatPlugin::installIOHandler ( const TQString & format )\fC [pure virtual]\fR" -Installs a QImageIO image I/O handler for the image format \fIformat\fR. +.SH "bool TQImageFormatPlugin::installIOHandler ( const TQString & format )\fC [pure virtual]\fR" +Installs a TQImageIO image I/O handler for the image format \fIformat\fR. .PP See also keys(). -.SH "QStringList QImageFormatPlugin::keys () const\fC [pure virtual]\fR" +.SH "QStringList TQImageFormatPlugin::keys () const\fC [pure virtual]\fR" Returns the list of image formats this plugin supports. .PP See also installIOHandler(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/ntqimageformatplugin.html +.BR http://doc.trolltech.com/tqimageformatplugin.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimageformattype.3qt b/doc/man/man3/tqimageformattype.3qt index 6208ee1ad..631c848f2 100644 --- a/doc/man/man3/tqimageformattype.3qt +++ b/doc/man/man3/tqimageformattype.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageFormatType 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageFormatType 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,17 +7,17 @@ .ad l .nh .SH NAME -QImageFormatType \- Factory that makes QImageFormat objects +TQImageFormatType \- Factory that makes TQImageFormat objects .SH SYNOPSIS \fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "virtual \fB~QImageFormatType\fR ()" +.BI "virtual \fB~TQImageFormatType\fR ()" .br .ti -1c -.BI "virtual QImageFormat * \fBdecoderFor\fR ( const uchar * buffer, int length ) = 0" +.BI "virtual TQImageFormat * \fBdecoderFor\fR ( const uchar * buffer, int length ) = 0" .br .ti -1c .BI "virtual const char * \fBformatName\fR () const = 0" @@ -26,34 +26,34 @@ QImageFormatType \- Factory that makes QImageFormat objects .SS "Protected Members" .in +1c .ti -1c -.BI "\fBQImageFormatType\fR ()" +.BI "\fBTQImageFormatType\fR ()" .br .in -1c .SH DESCRIPTION -The QImageFormatType class is a factory that makes QImageFormat objects. +The TQImageFormatType class is a factory that makes TQImageFormat objects. .PP -Whereas the QImageIO class allows for \fIcomplete\fR loading of images, QImageFormatType allows for \fIincremental\fR loading of images. +Whereas the TQImageIO class allows for \fIcomplete\fR loading of images, TQImageFormatType allows for \fIincremental\fR loading of images. .PP -New image file formats are installed by creating objects of derived classes of QImageFormatType. They must implement decoderFor() and formatName(). +New image file formats are installed by creating objects of derived classes of TQImageFormatType. They must implement decoderFor() and formatName(). .PP -QImageFormatType is a very simple class. Its only task is to recognize image data in some format and make a new object, subclassed from QImageFormat, which can decode that format. +TQImageFormatType is a very simple class. Its only task is to recognize image data in some format and make a new object, subclassed from TQImageFormat, which can decode that format. .PP The factories for formats built into TQt are automatically defined before any other factory is initialized. If two factories would recognize an image format, the factory created last will override the earlier one; you can thus override current and future built-in formats. .PP See also Graphics Classes, Image Processing Classes, and Multimedia Classes. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QImageFormatType::QImageFormatType ()\fC [protected]\fR" -Constructs a factory. It automatically registers itself with QImageDecoder. -.SH "QImageFormatType::~QImageFormatType ()\fC [virtual]\fR" -Destroys a factory. It automatically unregisters itself from QImageDecoder. -.SH "QImageFormat * QImageFormatType::decoderFor ( const uchar * buffer, int length )\fC [pure virtual]\fR" +.SH "TQImageFormatType::TQImageFormatType ()\fC [protected]\fR" +Constructs a factory. It automatically registers itself with TQImageDecoder. +.SH "TQImageFormatType::~TQImageFormatType ()\fC [virtual]\fR" +Destroys a factory. It automatically unregisters itself from TQImageDecoder. +.SH "TQImageFormat * TQImageFormatType::decoderFor ( const uchar * buffer, int length )\fC [pure virtual]\fR" Returns a decoder for decoding an image that starts with the bytes in \fIbuffer\fR. The length of the data is given in \fIlength\fR. This function should only return a decoder if it is certain that the decoder applies to data with the given header. Returns 0 if there is insufficient data in the header to make a positive identification or if the data is not recognized. -.SH "const char * QImageFormatType::formatName () const\fC [pure virtual]\fR" +.SH "const char * TQImageFormatType::formatName () const\fC [pure virtual]\fR" Returns the name of the format supported by decoders from this factory. The string is statically allocated. .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimageformattype.html +.BR http://doc.trolltech.com/tqimageformattype.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqimageio.3qt b/doc/man/man3/tqimageio.3qt index c5d54cd8e..ac7bac416 100644 --- a/doc/man/man3/tqimageio.3qt +++ b/doc/man/man3/tqimageio.3qt @@ -1,5 +1,5 @@ '\" t -.TH QImageIO 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- +.TH TQImageIO 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*- .\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the .\" license file included in the distribution for a complete license .\" statement. @@ -7,23 +7,23 @@ .ad l .nh .SH NAME -QImageIO \- Parameters for loading and saving images +TQImageIO \- Parameters for loading and saving images .SH SYNOPSIS -\fC#include \fR +\fC#include \fR .PP .SS "Public Members" .in +1c .ti -1c -.BI "\fBQImageIO\fR ()" +.BI "\fBTQImageIO\fR ()" .br .ti -1c -.BI "\fBQImageIO\fR ( TQIODevice * ioDevice, const char * format )" +.BI "\fBTQImageIO\fR ( TQIODevice * ioDevice, const char * format )" .br .ti -1c -.BI "\fBQImageIO\fR ( const TQString & fileName, const char * format )" +.BI "\fBTQImageIO\fR ( const TQString & fileName, const char * format )" .br .ti -1c -.BI "\fB~QImageIO\fR ()" +.BI "\fB~TQImageIO\fR ()" .br .ti -1c .BI "const TQImage & \fBimage\fR () const" @@ -105,9 +105,9 @@ QImageIO \- Parameters for loading and saving images .br .in -1c .SH DESCRIPTION -The QImageIO class contains parameters for loading and saving images. +The TQImageIO class contains parameters for loading and saving images. .PP -QImageIO contains a TQIODevice object that is used for image data I/O. The programmer can install new image file formats in addition to those that TQt provides. +TQImageIO contains a TQIODevice object that is used for image data I/O. The programmer can install new image file formats in addition to those that TQt provides. .PP Qt currently supports the following image file formats: PNG, BMP, XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if specially configured during compilation. The different PNM formats are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6). .PP @@ -123,28 +123,28 @@ GIF support may be removed completely in a future version of Qt. We recommend us .PP See also TQImage, QPixmap, QFile, QMovie, Graphics Classes, Image Processing Classes, and Input/Output and Networking. .SH MEMBER FUNCTION DOCUMENTATION -.SH "QImageIO::QImageIO ()" -Constructs a QImageIO object with all parameters set to zero. -.SH "QImageIO::QImageIO ( TQIODevice * ioDevice, const char * format )" -Constructs a QImageIO object with the I/O device \fIioDevice\fR and a \fIformat\fR tag. -.SH "QImageIO::QImageIO ( const TQString & fileName, const char * format )" -Constructs a QImageIO object with the file name \fIfileName\fR and a \fIformat\fR tag. -.SH "QImageIO::~QImageIO ()" +.SH "TQImageIO::TQImageIO ()" +Constructs a TQImageIO object with all parameters set to zero. +.SH "TQImageIO::TQImageIO ( TQIODevice * ioDevice, const char * format )" +Constructs a TQImageIO object with the I/O device \fIioDevice\fR and a \fIformat\fR tag. +.SH "TQImageIO::TQImageIO ( const TQString & fileName, const char * format )" +Constructs a TQImageIO object with the file name \fIfileName\fR and a \fIformat\fR tag. +.SH "TQImageIO::~TQImageIO ()" Destroys the object and all related data. -.SH "void QImageIO::defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )\fC [static]\fR" +.SH "void TQImageIO::defineIOHandler ( const char * format, const char * header, const char * flags, image_io_handler readImage, image_io_handler writeImage )\fC [static]\fR" Defines an image I/O handler for the image format called \fIformat\fR, which is recognized using the regular expression \fIheader\fR, read using \fIreadImage\fR and written using \fIwriteImage\fR. .PP \fIflags\fR is a string of single-character flags for this format. The only flag defined currently is T (upper case), so the only legal value for \fIflags\fR are "T" and the empty string. The "T" flag means that the image file is a text file, and TQt should treat all newline conventions as equivalent. (XPM files and some PPM files are text files for example.) .PP \fIformat\fR is used to select a handler to write a TQImage; \fIheader\fR is used to select a handler to read an image file. .PP -If \fIreadImage\fR is a null pointer, the QImageIO will not be able to read images in \fIformat\fR. If \fIwriteImage\fR is a null pointer, the QImageIO will not be able to write images in \fIformat\fR. If both are null, the QImageIO object is valid but useless. +If \fIreadImage\fR is a null pointer, the TQImageIO will not be able to read images in \fIformat\fR. If \fIwriteImage\fR is a null pointer, the TQImageIO will not be able to write images in \fIformat\fR. If both are null, the TQImageIO object is valid but useless. .PP Example: .PP .nf .br - void readGIF( QImageIO *image ) + void readGIF( TQImageIO *image ) .br { .br @@ -153,7 +153,7 @@ Example: } .br .br - void writeGIF( QImageIO *image ) + void writeGIF( TQImageIO *image ) .br { .br @@ -165,7 +165,7 @@ Example: // add the GIF image handler .br .br - QImageIO::defineIOHandler( "GIF", + TQImageIO::defineIOHandler( "GIF", .br "^GIF[0-9][0-9][a-z]", .br @@ -182,27 +182,27 @@ Before the regex test, all the 0 bytes in the file header are converted to 1 byt The regexp is only applied on the first 14 bytes of the file. .PP Note that TQt assumes that there is only one handler per format; if two handlers support the same format, TQt will choose one arbitrarily. It is not possible to have one handler support reading, and another support writing. -.SH "TQString QImageIO::description () const" +.SH "TQString TQImageIO::description () const" Returns the image description string. .PP See also setDescription(). -.SH "TQString QImageIO::fileName () const" +.SH "TQString TQImageIO::fileName () const" Returns the file name currently set. .PP See also setFileName(). -.SH "const char * QImageIO::format () const" +.SH "const char * TQImageIO::format () const" Returns the image format string or 0 if no format has been explicitly set. -.SH "float QImageIO::gamma () const" +.SH "float TQImageIO::gamma () const" Returns the gamma value at which the image will be viewed. .PP See also setGamma(). -.SH "const TQImage & QImageIO::image () const" +.SH "const TQImage & TQImageIO::image () const" Returns the image currently set. .PP See also setImage(). -.SH "const char * QImageIO::imageFormat ( const TQString & fileName )\fC [static]\fR" +.SH "const char * TQImageIO::imageFormat ( const TQString & fileName )\fC [static]\fR" Returns a string that specifies the image format of the file \fIfileName\fR, or null if the file cannot be read or if the format is not recognized. -.SH "const char * QImageIO::imageFormat ( TQIODevice * d )\fC [static]\fR" +.SH "const char * TQImageIO::imageFormat ( TQIODevice * d )\fC [static]\fR" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP Returns a string that specifies the image format of the image read from IO device \fId\fR, or 0 if the device cannot be read or if the format is not recognized. @@ -210,25 +210,25 @@ Returns a string that specifies the image format of the image read from IO devic Make sure that \fId\fR is at the right position in the device (for example, at the beginning of the file). .PP See also TQIODevice::at(). -.SH "QStrList QImageIO::inputFormats ()\fC [static]\fR" +.SH "QStrList TQImageIO::inputFormats ()\fC [static]\fR" Returns a sorted list of image formats that are supported for image input. -.SH "TQIODevice * QImageIO::ioDevice () const" +.SH "TQIODevice * TQImageIO::ioDevice () const" Returns the IO device currently set. .PP See also setIODevice(). -.SH "QStrList QImageIO::outputFormats ()\fC [static]\fR" +.SH "QStrList TQImageIO::outputFormats ()\fC [static]\fR" Returns a sorted list of image formats that are supported for image output. .PP Example: scribble/scribble.cpp. -.SH "const char * QImageIO::parameters () const" +.SH "const char * TQImageIO::parameters () const" Returns the image's parameters string. .PP See also setParameters(). -.SH "int QImageIO::quality () const" +.SH "int TQImageIO::quality () const" Returns the quality of the written image, related to the compression ratio. .PP See also setQuality() and TQImage::save(). -.SH "bool QImageIO::read ()" +.SH "bool TQImageIO::read ()" Reads an image into memory and returns TRUE if the image was successfully read; otherwise returns FALSE. .PP Before reading an image you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used. @@ -241,7 +241,7 @@ Example: .PP .nf .br - QImageIO iio; + TQImageIO iio; .br QPixmap pixmap; .br @@ -254,15 +254,15 @@ Example: .fi .PP See also setIODevice(), setFileName(), setFormat(), write(), and QPixmap::load(). -.SH "void QImageIO::setDescription ( const TQString & description )" +.SH "void TQImageIO::setDescription ( const TQString & description )" Sets the image description string for image handlers that support image descriptions to \fIdescription\fR. .PP Currently, no image format supported by TQt uses the description string. -.SH "void QImageIO::setFileName ( const TQString & fileName )" +.SH "void TQImageIO::setFileName ( const TQString & fileName )" Sets the name of the file to read or write an image from to \fIfileName\fR. .PP See also setIODevice(). -.SH "void QImageIO::setFormat ( const char * format )" +.SH "void TQImageIO::setFormat ( const char * format )" Sets the image format to \fIformat\fR for the image to be read or written. .PP It is necessary to specify a format before writing an image, but it is not necessary to specify a format before reading an image. @@ -270,13 +270,13 @@ It is necessary to specify a format before writing an image, but it is not neces If no format has been set, TQt guesses the image format before reading it. If a format is set the image will only be read if it has that format. .PP See also read(), write(), and format(). -.SH "void QImageIO::setGamma ( float gamma )" +.SH "void TQImageIO::setGamma ( float gamma )" Sets the gamma value at which the image will be viewed to \fIgamma\fR. If the image format stores a gamma value for which the image is intended to be used, then this setting will be used to modify the image. Setting to 0.0 will disable gamma correction (i.e. any specification in the file will be ignored). .PP The default value is 0.0. .PP See also gamma(). -.SH "void QImageIO::setIODevice ( TQIODevice * ioDevice )" +.SH "void TQImageIO::setIODevice ( TQIODevice * ioDevice )" Sets the IO device to be used for reading or writing an image. .PP Setting the IO device allows images to be read/written to any block-oriented TQIODevice. @@ -284,31 +284,31 @@ Setting the IO device allows images to be read/written to any block-oriented TQI If \fIioDevice\fR is not null, this IO device will override file name settings. .PP See also setFileName(). -.SH "void QImageIO::setImage ( const TQImage & image )" +.SH "void TQImageIO::setImage ( const TQImage & image )" Sets the image to \fIimage\fR. .PP See also image(). -.SH "void QImageIO::setParameters ( const char * parameters )" +.SH "void TQImageIO::setParameters ( const char * parameters )" Sets the image's parameter string to \fIparameters\fR. This is for image handlers that require special parameters. .PP Although the current image formats supported by TQt ignore the parameters string, it may be used in future extensions or by contributions (for example, JPEG). .PP See also parameters(). -.SH "void QImageIO::setQuality ( int q )" +.SH "void TQImageIO::setQuality ( int q )" Sets the quality of the written image to \fIq\fR, related to the compression ratio. .PP \fIq\fR must be in the range -1..100. Specify 0 to obtain small compressed files, 100 for large uncompressed files. (-1 signifies the default compression.) .PP See also quality() and TQImage::save(). -.SH "void QImageIO::setStatus ( int status )" +.SH "void TQImageIO::setStatus ( int status )" Sets the image IO status to \fIstatus\fR. A non-zero value indicates an error, whereas 0 means that the IO operation was successful. .PP See also status(). -.SH "int QImageIO::status () const" +.SH "int TQImageIO::status () const" Returns the image's IO status. A non-zero value indicates an error, whereas 0 means that the IO operation was successful. .PP See also setStatus(). -.SH "bool QImageIO::write ()" +.SH "bool TQImageIO::write ()" Writes an image to an IO device and returns TRUE if the image was successfully written; otherwise returns FALSE. .PP Before writing an image you must set an IO device or a file name. If both an IO device and a file name have been set, the IO device will be used. @@ -319,7 +319,7 @@ Example: .PP .nf .br - QImageIO iio; + TQImageIO iio; .br TQImage im; .br @@ -340,7 +340,7 @@ Example: See also setIODevice(), setFileName(), setFormat(), read(), and QPixmap::save(). .SH "SEE ALSO" -.BR http://doc.trolltech.com/qimageio.html +.BR http://doc.trolltech.com/tqimageio.html .BR http://www.trolltech.com/faq/tech.html .SH COPYRIGHT Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the diff --git a/doc/man/man3/tqmacmime.3qt b/doc/man/man3/tqmacmime.3qt index 76ffb3e65..c2ca8db25 100644 --- a/doc/man/man3/tqmacmime.3qt +++ b/doc/man/man3/tqmacmime.3qt @@ -69,7 +69,7 @@ kScrapFlavorTypeUnicode - converted to "text/plain;charset=ISO-10646-UCS-2" and .TP kScrapFlavorTypeText - converted to "text/plain;charset=system" or "text/plain" and supported by QTextDrag. .TP -kScrapFlavorTypePicture - converted to "image/format", where format is a TQt image format, and supported by QImageDrag. +kScrapFlavorTypePicture - converted to "image/format", where format is a TQt image format, and supported by TQImageDrag. .TP kDragFlavorTypeHFS - converted to "text/uri-list", and supported by QUriDrag. .PP diff --git a/doc/man/man3/tqmimesource.3qt b/doc/man/man3/tqmimesource.3qt index ceb48d706..494ff5390 100644 --- a/doc/man/man3/tqmimesource.3qt +++ b/doc/man/man3/tqmimesource.3qt @@ -60,7 +60,7 @@ Reimplemented in QDropEvent. .SH "bool QMimeSource::provides ( const char * mimeType ) const\fC [virtual]\fR" Returns TRUE if the object can provide the data in format \fImimeType\fR; otherwise returns FALSE. .PP -If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as QTextDrag::canDecode() and QImageDrag::canDecode(). +If you inherit from QMimeSource, for consistency reasons it is better to implement the more abstract canDecode() functions such as QTextDrag::canDecode() and TQImageDrag::canDecode(). .PP Example: iconview/simple_dd/main.cpp. .PP diff --git a/doc/man/man3/tqmimesourcefactory.3qt b/doc/man/man3/tqmimesourcefactory.3qt index 2b6d17c35..3a6ca4be9 100644 --- a/doc/man/man3/tqmimesourcefactory.3qt +++ b/doc/man/man3/tqmimesourcefactory.3qt @@ -74,7 +74,7 @@ QMimeSourceFactory \- Extensible provider of mime-typed data .SH DESCRIPTION The QMimeSourceFactory class is an extensible provider of mime-typed data. .PP -A QMimeSourceFactory provides an abstract interface to a collection of information. Each piece of information is represented by a QMimeSource object which can be examined and converted to concrete data types by functions such as QImageDrag::canDecode() and QImageDrag::decode(). +A QMimeSourceFactory provides an abstract interface to a collection of information. Each piece of information is represented by a QMimeSource object which can be examined and converted to concrete data types by functions such as TQImageDrag::canDecode() and TQImageDrag::decode(). .PP The base QMimeSourceFactory can be used in two ways: as an abstraction of a collection of files or as specifically stored data. For it to access files, call setFilePath() before accessing data. For stored data, call setData() for each item (there are also convenience functions, e.g. setText(), setImage() and setPixmap(), that simply call setData() with appropriate parameters). .PP @@ -143,7 +143,7 @@ Returns a reference to the data associated with \fIabs_name\fR. The return value .PP If there is no data associated with \fIabs_name\fR in the factory's store, the factory tries to access the local filesystem. If \fIabs_name\fR isn't an absolute file name, the factory will search for it in all defined paths (see setFilePath()). .PP -The factory understands all the image formats supported by QImageIO. Any other mime types are determined by the file name extension. The default settings are +The factory understands all the image formats supported by TQImageIO. Any other mime types are determined by the file name extension. The default settings are .PP .nf .br @@ -197,7 +197,7 @@ See also filePath(). .SH "void QMimeSourceFactory::setImage ( const TQString & abs_name, const TQImage & image )\fC [virtual]\fR" Sets \fIimage\fR to be the data item associated with the absolute name \fIabs_name\fR. .PP -Equivalent to setData(abs_name, new QImageDrag(image)). +Equivalent to setData(abs_name, new TQImageDrag(image)). .SH "void QMimeSourceFactory::setPixmap ( const TQString & abs_name, const QPixmap & pixmap )\fC [virtual]\fR" Sets \fIpixmap\fR to be the data item associated with the absolute name \fIabs_name\fR. .SH "void QMimeSourceFactory::setText ( const TQString & abs_name, const TQString & text )\fC [virtual]\fR" diff --git a/doc/man/man3/tqpixmap.3qt b/doc/man/man3/tqpixmap.3qt index 98ae130f3..7cbeb19fa 100644 --- a/doc/man/man3/tqpixmap.3qt +++ b/doc/man/man3/tqpixmap.3qt @@ -258,7 +258,7 @@ If your application uses dozens or hundreds of pixmaps (for example on tool bar .PP In general it is recommended to make as much use of QPixmap's implicit sharing and the QPixmapCache as possible. .PP -See also QBitmap, TQImage, QImageIO, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. +See also QBitmap, TQImage, TQImageIO, Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes. .SS "Member Type Documentation" .SH "QPixmap::ColorMode" This enum type defines the color modes that exist for converting TQImage objects to QPixmap. @@ -472,7 +472,7 @@ Example: .SH "QPixmap QPixmap::fromMimeSource ( const TQString & abs_name )\fC [static]\fR" Convenience function. Gets the data associated with the absolute name \fIabs_name\fR from the default mime source factory and decodes it to a pixmap. .PP -See also QMimeSourceFactory, TQImage::fromMimeSource(), and QImageDrag::decode(). +See also QMimeSourceFactory, TQImage::fromMimeSource(), and TQImageDrag::decode(). .PP Example: textedit/textedit.cpp. .SH "QPixmap QPixmap::grabWidget ( TQWidget * widget, int x = 0, int y = 0, int w = -1, int h = -1 )\fC [static]\fR" @@ -533,7 +533,7 @@ Examples: .SH "const char * QPixmap::imageFormat ( const TQString & fileName )\fC [static]\fR" Returns a string that specifies the image format of the file \fIfileName\fR, or 0 if the file cannot be read or if the format cannot be recognized. .PP -The QImageIO documentation lists the supported image formats. +The TQImageIO documentation lists the supported image formats. .PP See also load() and save(). .SH "bool QPixmap::isNull () const" @@ -556,9 +556,9 @@ If \fIformat\fR is specified, the loader attempts to read the pixmap using the s .PP See the convertFromImage() documentation for a description of the \fIconversion_flags\fR argument. .PP -The QImageIO documentation lists the supported image formats and explains how to add extra formats. +The TQImageIO documentation lists the supported image formats and explains how to add extra formats. .PP -See also loadFromData(), save(), imageFormat(), TQImage::load(), and QImageIO. +See also loadFromData(), save(), imageFormat(), TQImage::load(), and TQImageIO. .PP Examples: .)l picture/picture.cpp, scrollview/scrollview.cpp, and xform/xform.cpp. @@ -579,9 +579,9 @@ If \fIformat\fR is specified, the loader attempts to read the pixmap using the s .PP See the convertFromImage() documentation for a description of the \fIconversion_flags\fR argument. .PP -The QImageIO documentation lists the supported image formats and explains how to add extra formats. +The TQImageIO documentation lists the supported image formats and explains how to add extra formats. .PP -See also load(), save(), imageFormat(), TQImage::loadFromData(), and QImageIO. +See also load(), save(), imageFormat(), TQImage::loadFromData(), and TQImageIO. .SH "bool QPixmap::loadFromData ( const uchar * buf, uint len, const char * format = 0, ColorMode mode = Auto )" This is an overloaded member function, provided for convenience. It behaves essentially like the above function. .PP @@ -638,7 +638,7 @@ Resizes the pixmap to size \fIsize\fR. .SH "bool QPixmap::save ( const TQString & fileName, const char * format, int quality = -1 ) const" Saves the pixmap to the file \fIfileName\fR using the image file format \fIformat\fR and a quality factor \fIquality\fR. \fIquality\fR must be in the range [0,100] or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings. Returns TRUE if successful; otherwise returns FALSE. .PP -See also load(), loadFromData(), imageFormat(), TQImage::save(), and QImageIO. +See also load(), loadFromData(), imageFormat(), TQImage::save(), and TQImageIO. .PP Example: qmag/qmag.cpp. .SH "bool QPixmap::save ( TQIODevice * device, const char * format, int quality = -1 ) const" diff --git a/doc/man/man3/tqpngimagepacker.3qt b/doc/man/man3/tqpngimagepacker.3qt index 7e07df659..e3a4b0025 100644 --- a/doc/man/man3/tqpngimagepacker.3qt +++ b/doc/man/man3/tqpngimagepacker.3qt @@ -26,7 +26,7 @@ QPNGImagePacker \- Creates well-compressed PNG animations .SH DESCRIPTION The QPNGImagePacker class creates well-compressed PNG animations. .PP -By using transparency, QPNGImagePacker allows you to build a PNG image from a sequence of QImages. +By using transparency, QPNGImagePacker allows you to build a PNG image from a sequence of TQImages. .PP Images are added using packImage(). .PP diff --git a/doc/man/man3/tqwidget.3qt b/doc/man/man3/tqwidget.3qt index 1446620f2..08eeaae11 100644 --- a/doc/man/man3/tqwidget.3qt +++ b/doc/man/man3/tqwidget.3qt @@ -1298,7 +1298,7 @@ This event handler is called when a drag is in progress and the mouse enters thi .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, QImageDrag, and QDragEnterEvent. +See also QTextDrag, TQImageDrag, and QDragEnterEvent. .PP Example: iconview/simple_dd/main.cpp. .SH "void TQWidget::dragLeaveEvent ( QDragLeaveEvent * )\fC [virtual protected]\fR" @@ -1306,13 +1306,13 @@ This event handler is called when a drag is in progress and the mouse leaves thi .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, QImageDrag, and QDragLeaveEvent. +See also QTextDrag, TQImageDrag, and QDragLeaveEvent. .SH "void TQWidget::dragMoveEvent ( QDragMoveEvent * )\fC [virtual protected]\fR" This event handler is called when a drag is in progress and the mouse enters this widget, and whenever it moves within the widget. .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, QImageDrag, and QDragMoveEvent. +See also QTextDrag, TQImageDrag, and QDragMoveEvent. .SH "void TQWidget::drawText ( int x, int y, const TQString & str )" Draws the string \fIstr\fR at position \fI(x, y)\fR. .PP @@ -1330,7 +1330,7 @@ This event handler is called when the drag is dropped on this widget. .PP See the Drag-and-drop documentation for an overview of how to provide drag-and-drop in your application. .PP -See also QTextDrag, QImageDrag, and QDropEvent. +See also QTextDrag, TQImageDrag, and QDropEvent. .PP Example: iconview/simple_dd/main.cpp. .SH "void TQWidget::enabledChange ( bool oldEnabled )\fC [virtual protected]\fR" diff --git a/doc/man/man3/tqwindowsmime.3qt b/doc/man/man3/tqwindowsmime.3qt index b0ef199f2..c2a03470f 100644 --- a/doc/man/man3/tqwindowsmime.3qt +++ b/doc/man/man3/tqwindowsmime.3qt @@ -72,7 +72,7 @@ CF_UNICODETEXT - converted to "text/plain;charset=ISO-10646-UCS-2" and supported .TP CF_TEXT - converted to "text/plain;charset=system" or "text/plain" and supported by QTextDrag. .TP -CF_DIB - converted to "image/*", where * is a TQt image format, and supported by QImageDrag. +CF_DIB - converted to "image/*", where * is a TQt image format, and supported by TQImageDrag. .TP CF_HDROP - converted to "text/uri-list", and supported by QUriDrag. .PP diff --git a/doc/plugins-howto.doc b/doc/plugins-howto.doc index 436901c8b..88c69f340 100644 --- a/doc/plugins-howto.doc +++ b/doc/plugins-howto.doc @@ -61,7 +61,7 @@ by default in the standard plugin directory. \i Base Class \i Default Path \row -\i \l QImageFormatPlugin +\i \l TQImageFormatPlugin \i \c{pluginsbase/imageformats} * \row \i \l TQSqlDriverPlugin diff --git a/examples/action/application.cpp b/examples/action/application.cpp index ecd70cdd0..9fbf22e34 100644 --- a/examples/action/application.cpp +++ b/examples/action/application.cpp @@ -9,7 +9,7 @@ #include "application.h" -#include +#include #include #include #include diff --git a/examples/application/application.cpp b/examples/application/application.cpp index 455bcc425..32c291f03 100644 --- a/examples/application/application.cpp +++ b/examples/application/application.cpp @@ -9,7 +9,7 @@ #include "application.h" -#include +#include #include #include #include diff --git a/examples/canvas/blendshadow.cpp b/examples/canvas/blendshadow.cpp index d2f761db0..635b1fc37 100644 --- a/examples/canvas/blendshadow.cpp +++ b/examples/canvas/blendshadow.cpp @@ -1,4 +1,4 @@ -#include +#include #include static inline int blendComponent( int v, int av, int s, int as ) diff --git a/examples/canvas/canvas.cpp b/examples/canvas/canvas.cpp index bd6589490..3222c8a45 100644 --- a/examples/canvas/canvas.cpp +++ b/examples/canvas/canvas.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "canvas.h" diff --git a/examples/canvas/main.cpp b/examples/canvas/main.cpp index aad94c54d..45b7a050e 100644 --- a/examples/canvas/main.cpp +++ b/examples/canvas/main.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include "canvas.h" diff --git a/examples/canvas/makeimg.cpp b/examples/canvas/makeimg.cpp index d8c4c1928..253b43956 100644 --- a/examples/canvas/makeimg.cpp +++ b/examples/canvas/makeimg.cpp @@ -1,4 +1,4 @@ -#include +#include #include static inline int blendComponent( int v, int av, int s, int as ) diff --git a/examples/chart/optionsform.cpp b/examples/chart/optionsform.cpp index 543783c30..1896067c0 100644 --- a/examples/chart/optionsform.cpp +++ b/examples/chart/optionsform.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/demo/dnd/styledbutton.cpp b/examples/demo/dnd/styledbutton.cpp index 690a1054a..b3d7829a2 100644 --- a/examples/demo/dnd/styledbutton.cpp +++ b/examples/demo/dnd/styledbutton.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/demo/main.cpp b/examples/demo/main.cpp index 6fc5dbe10..275dc27b3 100644 --- a/examples/demo/main.cpp +++ b/examples/demo/main.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include diff --git a/examples/demo/opengl/gllandscape.cpp b/examples/demo/opengl/gllandscape.cpp index 2906a5c84..1de9102b0 100644 --- a/examples/demo/opengl/gllandscape.cpp +++ b/examples/demo/opengl/gllandscape.cpp @@ -1,4 +1,4 @@ -#include +#include #include "gllandscape.h" diff --git a/examples/demo/opengl/gltexobj.cpp b/examples/demo/opengl/gltexobj.cpp index 117917e38..183940b42 100644 --- a/examples/demo/opengl/gltexobj.cpp +++ b/examples/demo/opengl/gltexobj.cpp @@ -17,7 +17,7 @@ ****************************************************************************/ #include "gltexobj.h" -#include +#include /*! Create a GLTexobj widget diff --git a/examples/demo/opengl/glworkspace.cpp b/examples/demo/opengl/glworkspace.cpp index 8d7541fcb..ef90a03a2 100644 --- a/examples/demo/opengl/glworkspace.cpp +++ b/examples/demo/opengl/glworkspace.cpp @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "printpreview.h" diff --git a/examples/demo/opengl/printpreview.ui b/examples/demo/opengl/printpreview.ui index 92cd609b3..064ff35e9 100644 --- a/examples/demo/opengl/printpreview.ui +++ b/examples/demo/opengl/printpreview.ui @@ -255,7 +255,7 @@ - ntqimage.h + tqimage.h ntqpixmap.h printpreview.ui.h diff --git a/examples/desktop/desktop.cpp b/examples/desktop/desktop.cpp index 15353e98f..0e5782889 100644 --- a/examples/desktop/desktop.cpp +++ b/examples/desktop/desktop.cpp @@ -7,7 +7,7 @@ ** *****************************************************************************/ -#include +#include #include #include #include diff --git a/examples/dragdrop/dropsite.cpp b/examples/dragdrop/dropsite.cpp index 7257e6ed0..98188b19a 100644 --- a/examples/dragdrop/dropsite.cpp +++ b/examples/dragdrop/dropsite.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include diff --git a/examples/listboxcombo/listboxcombo.cpp b/examples/listboxcombo/listboxcombo.cpp index cf06c806d..55baaf83b 100644 --- a/examples/listboxcombo/listboxcombo.cpp +++ b/examples/listboxcombo/listboxcombo.cpp @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include diff --git a/examples/mdi/application.cpp b/examples/mdi/application.cpp index 96ee1c66c..67e759b5b 100644 --- a/examples/mdi/application.cpp +++ b/examples/mdi/application.cpp @@ -9,7 +9,7 @@ #include "application.h" #include -#include +#include #include #include #include diff --git a/examples/network/remotecontrol/ipcserver.cpp b/examples/network/remotecontrol/ipcserver.cpp index 4bd7b6423..05f6fdb8f 100644 --- a/examples/network/remotecontrol/ipcserver.cpp +++ b/examples/network/remotecontrol/ipcserver.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include diff --git a/examples/network/remotecontrol/remotectrlimpl.cpp b/examples/network/remotecontrol/remotectrlimpl.cpp index 68e0a3c7a..716eb0fef 100644 --- a/examples/network/remotecontrol/remotectrlimpl.cpp +++ b/examples/network/remotecontrol/remotectrlimpl.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include RemoteCtrlImpl::RemoteCtrlImpl( TQSocket *s ) { diff --git a/examples/opengl/glpixmap/globjwin.cpp b/examples/opengl/glpixmap/globjwin.cpp index 11cb675a6..bdb22eefa 100644 --- a/examples/opengl/glpixmap/globjwin.cpp +++ b/examples/opengl/glpixmap/globjwin.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include "globjwin.h" #include "glbox.h" diff --git a/examples/opengl/texture/gltexobj.cpp b/examples/opengl/texture/gltexobj.cpp index 78b0fcefb..f9528620c 100644 --- a/examples/opengl/texture/gltexobj.cpp +++ b/examples/opengl/texture/gltexobj.cpp @@ -17,7 +17,7 @@ ****************************************************************************/ #include "gltexobj.h" -#include +#include #include diff --git a/examples/qmag/qmag.cpp b/examples/qmag/qmag.cpp index b5705df6a..996af3c7b 100644 --- a/examples/qmag/qmag.cpp +++ b/examples/qmag/qmag.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/scribble/scribble.cpp b/examples/scribble/scribble.cpp index 3f80d8881..9fd002a9c 100644 --- a/examples/scribble/scribble.cpp +++ b/examples/scribble/scribble.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/showimg/imagefip.cpp b/examples/showimg/imagefip.cpp index a058271ac..8702f8565 100644 --- a/examples/showimg/imagefip.cpp +++ b/examples/showimg/imagefip.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include "imagefip.h" -#include +#include /* XPM */ static const char *image_xpm[] = { diff --git a/examples/showimg/imagetexteditor.cpp b/examples/showimg/imagetexteditor.cpp index 2abdabfb7..66529190a 100644 --- a/examples/showimg/imagetexteditor.cpp +++ b/examples/showimg/imagetexteditor.cpp @@ -8,7 +8,7 @@ *****************************************************************************/ #include "imagetexteditor.h" -#include +#include #include #include #include diff --git a/examples/showimg/main.cpp b/examples/showimg/main.cpp index a0f5d69a3..63a8d2216 100644 --- a/examples/showimg/main.cpp +++ b/examples/showimg/main.cpp @@ -10,7 +10,7 @@ #include "showimg.h" #include "imagefip.h" #include -#include +#include int main( int argc, char **argv ) { diff --git a/examples/showimg/showimg.h b/examples/showimg/showimg.h index 1cf8f7c97..70a22a8bc 100644 --- a/examples/showimg/showimg.h +++ b/examples/showimg/showimg.h @@ -11,7 +11,7 @@ #define SHOWIMG_H #include -#include +#include class TQLabel; diff --git a/examples/table/small-table-demo/main.cpp b/examples/table/small-table-demo/main.cpp index 359654507..eb7618ba2 100644 --- a/examples/table/small-table-demo/main.cpp +++ b/examples/table/small-table-demo/main.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include diff --git a/examples/tablet/scribble.cpp b/examples/tablet/scribble.cpp index 457425073..beaf25461 100644 --- a/examples/tablet/scribble.cpp +++ b/examples/tablet/scribble.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/examples/themes/metal.cpp b/examples/themes/metal.cpp index 5a6c2b443..5f9ead623 100644 --- a/examples/themes/metal.cpp +++ b/examples/themes/metal.cpp @@ -19,7 +19,7 @@ #include "ntqpalette.h" // for now #include "tqwidget.h" #include "ntqlabel.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" diff --git a/examples/themes/wood.cpp b/examples/themes/wood.cpp index 1a331c89b..c4cf0d4c5 100644 --- a/examples/themes/wood.cpp +++ b/examples/themes/wood.cpp @@ -19,7 +19,7 @@ #include "ntqpalette.h" // for now #include "tqwidget.h" #include "ntqlabel.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpushbutton.h" #include "tqwidget.h" #include "ntqrangecontrol.h" diff --git a/examples/tux/tux.cpp b/examples/tux/tux.cpp index 641ca38f2..fc1e26d57 100644 --- a/examples/tux/tux.cpp +++ b/examples/tux/tux.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/include/ntqimage.h b/include/ntqimage.h deleted file mode 120000 index b6c62fd49..000000000 --- a/include/ntqimage.h +++ /dev/null @@ -1 +0,0 @@ -../src/kernel/ntqimage.h \ No newline at end of file diff --git a/include/ntqimageformatplugin.h b/include/ntqimageformatplugin.h deleted file mode 120000 index dfb0ddbd5..000000000 --- a/include/ntqimageformatplugin.h +++ /dev/null @@ -1 +0,0 @@ -../src/kernel/ntqimageformatplugin.h \ No newline at end of file diff --git a/include/private/qimageformatinterface_p.h b/include/private/qimageformatinterface_p.h deleted file mode 120000 index 7ce9e249b..000000000 --- a/include/private/qimageformatinterface_p.h +++ /dev/null @@ -1 +0,0 @@ -../../src/kernel/qimageformatinterface_p.h \ No newline at end of file diff --git a/include/private/tqimageformatinterface_p.h b/include/private/tqimageformatinterface_p.h new file mode 120000 index 000000000..88cd30d54 --- /dev/null +++ b/include/private/tqimageformatinterface_p.h @@ -0,0 +1 @@ +../../src/kernel/tqimageformatinterface_p.h \ No newline at end of file diff --git a/include/tqimage.h b/include/tqimage.h new file mode 120000 index 000000000..d1c56806e --- /dev/null +++ b/include/tqimage.h @@ -0,0 +1 @@ +../src/kernel/tqimage.h \ No newline at end of file diff --git a/include/tqimageformatplugin.h b/include/tqimageformatplugin.h new file mode 120000 index 000000000..be8007f67 --- /dev/null +++ b/include/tqimageformatplugin.h @@ -0,0 +1 @@ +../src/kernel/tqimageformatplugin.h \ No newline at end of file diff --git a/plugins/src/imageformats/jpeg/main.cpp b/plugins/src/imageformats/jpeg/main.cpp index d4f66b064..fe45fefe8 100644 --- a/plugins/src/imageformats/jpeg/main.cpp +++ b/plugins/src/imageformats/jpeg/main.cpp @@ -1,4 +1,4 @@ -#include +#include #ifndef TQT_NO_IMAGEFORMATPLUGIN diff --git a/plugins/src/imageformats/mng/main.cpp b/plugins/src/imageformats/mng/main.cpp index f08dc3166..c26729873 100644 --- a/plugins/src/imageformats/mng/main.cpp +++ b/plugins/src/imageformats/mng/main.cpp @@ -1,4 +1,4 @@ -#include +#include #ifndef TQT_NO_IMAGEFORMATPLUGIN diff --git a/plugins/src/imageformats/png/main.cpp b/plugins/src/imageformats/png/main.cpp index 7724c9112..457d2b976 100644 --- a/plugins/src/imageformats/png/main.cpp +++ b/plugins/src/imageformats/png/main.cpp @@ -1,4 +1,4 @@ -#include +#include #ifndef TQT_NO_IMAGEFORMATPLUGIN diff --git a/src/canvas/tqcanvas.cpp b/src/canvas/tqcanvas.cpp index 6e1db596b..aa38c2055 100644 --- a/src/canvas/tqcanvas.cpp +++ b/src/canvas/tqcanvas.cpp @@ -42,7 +42,7 @@ #ifndef TQT_NO_CANVAS #include "ntqapplication.h" #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "tqptrdict.h" #include "ntqpainter.h" #include "ntqpolygonscanner.h" diff --git a/src/dialogs/qcolordialog.cpp b/src/dialogs/qcolordialog.cpp index df0424376..ca38f9c10 100644 --- a/src/dialogs/qcolordialog.cpp +++ b/src/dialogs/qcolordialog.cpp @@ -47,7 +47,7 @@ #include "ntqlabel.h" #include "ntqpushbutton.h" #include "ntqlineedit.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpixmap.h" #include "ntqdrawutil.h" #include "ntqvalidator.h" diff --git a/src/dialogs/qmessagebox.cpp b/src/dialogs/qmessagebox.cpp index 29005500c..6d991b3b7 100644 --- a/src/dialogs/qmessagebox.cpp +++ b/src/dialogs/qmessagebox.cpp @@ -45,7 +45,7 @@ #include "ntqaccel.h" #include "ntqlabel.h" #include "ntqpushbutton.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqapplication.h" #include "ntqstyle.h" #include "tqobjectlist.h" diff --git a/src/kernel/ntqasyncimageio.h b/src/kernel/ntqasyncimageio.h index 54255978a..28d5bd50e 100644 --- a/src/kernel/ntqasyncimageio.h +++ b/src/kernel/ntqasyncimageio.h @@ -42,7 +42,7 @@ #define TQASYNCIMAGEIO_H #ifndef QT_H -#include "ntqimage.h" +#include "tqimage.h" #endif // QT_H #ifndef TQT_NO_ASYNC_IMAGE_IO diff --git a/src/kernel/ntqdragobject.h b/src/kernel/ntqdragobject.h index 60a43ca34..5f6147409 100644 --- a/src/kernel/ntqdragobject.h +++ b/src/kernel/ntqdragobject.h @@ -47,7 +47,7 @@ class TQImageDragData; #ifndef QT_H #include "tqobject.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqstrlist.h" #include "ntqcolor.h" #endif // QT_H diff --git a/src/kernel/ntqimage.h b/src/kernel/ntqimage.h deleted file mode 100644 index 32f20b23f..000000000 --- a/src/kernel/ntqimage.h +++ /dev/null @@ -1,425 +0,0 @@ -/**************************************************************************** -** -** Definition of TQImage and TQImageIO classes -** -** Created : 950207 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQIMAGE_H -#define TQIMAGE_H - -#ifndef QT_H -#include "ntqpixmap.h" -#include "ntqstrlist.h" -#include "ntqstringlist.h" -#endif // QT_H - -class TQImageDataMisc; // internal -#ifndef TQT_NO_IMAGE_TEXT -class TQ_EXPORT TQImageTextKeyLang { -public: - TQImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } - TQImageTextKeyLang() { } - - TQCString key; - TQCString lang; - - bool operator< (const TQImageTextKeyLang& other) const - { return (key < other.key) || ((key==other.key) && (lang < other.lang)); } - bool operator== (const TQImageTextKeyLang& other) const - { return (key==other.key) && (lang==other.lang); } -}; -#endif //TQT_NO_IMAGE_TEXT - - -class TQ_EXPORT TQImage -{ -public: - enum Endian { IgnoreEndian, BigEndian, LittleEndian }; - - TQImage(); - TQImage( int width, int height, int depth, int numColors=0, - Endian bitOrder=IgnoreEndian ); - TQImage( const TQSize&, int depth, int numColors=0, - Endian bitOrder=IgnoreEndian ); -#ifndef TQT_NO_IMAGEIO - TQImage( const TQString &fileName, const char* format=0 ); - TQImage( const char * const xpm[] ); - TQImage( const TQByteArray &data ); -#endif - TQImage( uchar* data, int w, int h, int depth, - TQRgb* colortable, int numColors, - Endian bitOrder ); -#ifdef TQ_WS_QWS - TQImage( uchar* data, int w, int h, int depth, int pbl, - TQRgb* colortable, int numColors, - Endian bitOrder ); -#endif - TQImage( const TQImage & ); - ~TQImage(); - - TQImage &operator=( const TQImage & ); - TQImage &operator=( const TQPixmap & ); - bool operator==( const TQImage & ) const; - bool operator!=( const TQImage & ) const; - void detach(); - TQImage copy() const; - TQImage copy(int x, int y, int w, int h, int conversion_flags=0) const; - TQImage copy(const TQRect&) const; -#ifndef TQT_NO_MIME - static TQImage fromMimeSource( const TQString& abs_name ); -#endif - bool isNull() const { return data->bits == 0; } - - int width() const { return data->w; } - int height() const { return data->h; } - TQSize size() const { return TQSize(data->w,data->h); } - TQRect rect() const { return TQRect(0,0,data->w,data->h); } - int depth() const { return data->d; } - int numColors() const { return data->ncols; } - Endian bitOrder() const { return (Endian) data->bitordr; } - - TQRgb color( int i ) const; - void setColor( int i, TQRgb c ); - void setNumColors( int ); - - bool hasAlphaBuffer() const; - void setAlphaBuffer( bool ); - - bool allGray() const; - bool isGrayscale() const; - - uchar *bits() const; - uchar *scanLine( int ) const; - uchar **jumpTable() const; - TQRgb *colorTable() const; - int numBytes() const; - int bytesPerLine() const; - -#ifdef TQ_WS_QWS - TQGfx * graphicsContext(); -#endif - - bool create( int width, int height, int depth, int numColors=0, - Endian bitOrder=IgnoreEndian ); - bool create( const TQSize&, int depth, int numColors=0, - Endian bitOrder=IgnoreEndian ); - void reset(); - - void fill( uint pixel ); - void invertPixels( bool invertAlpha = TRUE ); - - TQImage convertDepth( int ) const; -#ifndef TQT_NO_IMAGE_TRUECOLOR - TQImage convertDepthWithPalette( int, TQRgb* p, int pc, int cf=0 ) const; -#endif - TQImage convertDepth( int, int conversion_flags ) const; - TQImage convertBitOrder( Endian ) const; - - enum ScaleMode { - ScaleFree, - ScaleMin, - ScaleMax - }; -#ifndef TQT_NO_IMAGE_SMOOTHSCALE - TQImage smoothScale( int w, int h, ScaleMode mode=ScaleFree ) const; - TQImage smoothScale( const TQSize& s, ScaleMode mode=ScaleFree ) const; -#endif -#ifndef TQT_NO_IMAGE_TRANSFORMATION - TQImage scale( int w, int h, ScaleMode mode=ScaleFree ) const; - TQImage scale( const TQSize& s, ScaleMode mode=ScaleFree ) const; - TQImage scaleWidth( int w ) const; - TQImage scaleHeight( int h ) const; - TQImage xForm( const TQWMatrix &matrix ) const; -#endif - -#ifndef TQT_NO_IMAGE_DITHER_TO_1 - TQImage createAlphaMask( int conversion_flags=0 ) const; -#endif -#ifndef TQT_NO_IMAGE_HEURISTIC_MASK - TQImage createHeuristicMask( bool clipTight=TRUE ) const; -#endif -#ifndef TQT_NO_IMAGE_MIRROR - TQImage mirror() const; - TQImage mirror(bool horizontally, bool vertically) const; -#endif - TQImage swapRGB() const; - - static Endian systemBitOrder(); - static Endian systemByteOrder(); - -#ifndef TQT_NO_IMAGEIO - static const char* imageFormat( const TQString &fileName ); - static TQStrList inputFormats(); - static TQStrList outputFormats(); -#ifndef TQT_NO_STRINGLIST - static TQStringList inputFormatList(); - static TQStringList outputFormatList(); -#endif - bool load( const TQString &fileName, const char* format=0 ); - bool loadFromData( const uchar *buf, uint len, - const char *format=0 ); - bool loadFromData( TQByteArray data, const char* format=0 ); - bool save( const TQString &fileName, const char* format, - int quality=-1 ) const; - bool save( TQIODevice * device, const char* format, - int quality=-1 ) const; -#endif //TQT_NO_IMAGEIO - - bool valid( int x, int y ) const; - int pixelIndex( int x, int y ) const; - TQRgb pixel( int x, int y ) const; - void setPixel( int x, int y, uint index_or_rgb ); - - // Auxiliary data - int dotsPerMeterX() const; - int dotsPerMeterY() const; - void setDotsPerMeterX(int); - void setDotsPerMeterY(int); - TQPoint offset() const; - void setOffset(const TQPoint&); -#ifndef TQT_NO_IMAGE_TEXT - TQValueList textList() const; - TQStringList textLanguages() const; - TQStringList textKeys() const; - TQString text(const char* key, const char* lang=0) const; - TQString text(const TQImageTextKeyLang&) const; - void setText(const char* key, const char* lang, const TQString&); -#endif -private: - void init(); - void reinit(); - void freeBits(); - static void warningIndexRange( const char *, int ); - - struct TQImageData : public TQShared { // internal image data - int w; // image width - int h; // image height - int d; // image depth - int ncols; // number of colors - int nbytes; // number of bytes data - int bitordr; // bit order (1 bit depth) - TQRgb *ctbl; // color table - uchar **bits; // image data - bool alpha; // alpha buffer - int dpmx; // dots per meter X (or 0) - int dpmy; // dots per meter Y (or 0) - TQPoint offset; // offset in pixels -#ifndef TQT_NO_IMAGE_TEXT - TQImageDataMisc* misc; // less common stuff -#endif - bool ctbl_mine; // this allocated ctbl - } *data; -#ifndef TQT_NO_IMAGE_TEXT - TQImageDataMisc& misc() const; -#endif -#ifndef TQT_NO_IMAGEIO - bool doImageIO( TQImageIO* io, int quality ) const; -#endif - friend TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, - const TQImage* src, int sx, int sy, - int sw, int sh, int conversion_flags ); -}; - - -// TQImage stream functions - -#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO) -TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQImage & ); -TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQImage & ); -#endif - -#ifndef TQT_NO_IMAGEIO -class TQIODevice; -typedef void (*image_io_handler)( TQImageIO * ); // image IO handler - - -struct TQImageIOData; - - -class TQ_EXPORT TQImageIO -{ -public: - TQImageIO(); - TQImageIO( TQIODevice *ioDevice, const char *format ); - TQImageIO( const TQString &fileName, const char* format ); - ~TQImageIO(); - - - const TQImage &image() const { return im; } - int status() const { return iostat; } - const char *format() const { return frmt; } - TQIODevice *ioDevice() const { return iodev; } - TQString fileName() const { return fname; } - int quality() const; - TQString description() const { return descr; } - const char *parameters() const; - float gamma() const; - - void setImage( const TQImage & ); - void setStatus( int ); - void setFormat( const char * ); - void setIODevice( TQIODevice * ); - void setFileName( const TQString & ); - void setQuality( int ); - void setDescription( const TQString & ); - void setParameters( const char * ); - void setGamma( float ); - - bool read(); - bool write(); - - static const char* imageFormat( const TQString &fileName ); - static const char *imageFormat( TQIODevice * ); - static TQStrList inputFormats(); - static TQStrList outputFormats(); - - static void defineIOHandler( const char *format, - const char *header, - const char *flags, - image_io_handler read_image, - image_io_handler write_image ); - -private: - void init(); - - TQImage im; // image - int iostat; // IO status - TQCString frmt; // image format - TQIODevice *iodev; // IO device - TQString fname; // file name - char *params; // image parameters //### change to TQImageIOData *d in 3.0 - TQString descr; // image description - TQImageIOData *d; - -private: // Disabled copy constructor and operator= -#if defined(TQ_DISABLE_COPY) - TQImageIO( const TQImageIO & ); - TQImageIO &operator=( const TQImageIO & ); -#endif -}; - -#endif //TQT_NO_IMAGEIO - -TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src, - int sx=0, int sy=0, int sw=-1, int sh=-1, - int conversion_flags=0 ); - - -/***************************************************************************** - TQImage member functions - *****************************************************************************/ - -inline bool TQImage::hasAlphaBuffer() const -{ - return data->alpha; -} - -inline uchar *TQImage::bits() const -{ - return data->bits ? data->bits[0] : 0; -} - -inline uchar **TQImage::jumpTable() const -{ - return data->bits; -} - -inline TQRgb *TQImage::colorTable() const -{ - return data->ctbl; -} - -inline int TQImage::numBytes() const -{ - return data->nbytes; -} - -inline int TQImage::bytesPerLine() const -{ - return data->h ? data->nbytes/data->h : 0; -} - -inline TQImage TQImage::copy(const TQRect& r) const -{ - return copy(r.x(), r.y(), r.width(), r.height()); -} - -inline TQRgb TQImage::color( int i ) const -{ -#if defined(QT_CHECK_RANGE) - if ( i >= data->ncols ) - warningIndexRange( "color", i ); -#endif - return data->ctbl ? data->ctbl[i] : (TQRgb)-1; -} - -inline void TQImage::setColor( int i, TQRgb c ) -{ -#if defined(QT_CHECK_RANGE) - if ( i >= data->ncols ) - warningIndexRange( "setColor", i ); -#endif - if ( data->ctbl ) - data->ctbl[i] = c; -} - -inline uchar *TQImage::scanLine( int i ) const -{ -#if defined(QT_CHECK_RANGE) - if ( i >= data->h ) - warningIndexRange( "scanLine", i ); -#endif - return data->bits ? data->bits[i] : 0; -} - -inline int TQImage::dotsPerMeterX() const -{ - return data->dpmx; -} - -inline int TQImage::dotsPerMeterY() const -{ - return data->dpmy; -} - -inline TQPoint TQImage::offset() const -{ - return data->offset; -} - - -#endif // TQIMAGE_H diff --git a/src/kernel/ntqimageformatplugin.h b/src/kernel/ntqimageformatplugin.h deleted file mode 100644 index 237817e9f..000000000 --- a/src/kernel/ntqimageformatplugin.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Definition of ??? -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQIMAGEFORMATPLUGIN_H -#define TQIMAGEFORMATPLUGIN_H - -#ifndef QT_H -#include "ntqgplugin.h" -#include "ntqstringlist.h" -#endif // QT_H - -#ifndef TQT_NO_IMAGEFORMATPLUGIN -class TQImageFormat; -class TQImageFormatPluginPrivate; - -class TQ_EXPORT TQImageFormatPlugin : public TQGPlugin -{ - TQ_OBJECT -public: - TQImageFormatPlugin(); - ~TQImageFormatPlugin(); - - virtual TQStringList keys() const = 0; - virtual bool loadImage( const TQString &format, const TQString &filename, TQImage *image ); - virtual bool saveImage( const TQString &format, const TQString &filename, const TQImage &image ); - virtual bool installIOHandler( const TQString &format ) = 0; - -private: - TQImageFormatPluginPrivate *d; -}; -#endif // TQT_NO_IMAGEFORMATPLUGIN -#endif // TQIMAGEFORMATPLUGIN_H diff --git a/src/kernel/ntqnamespace.h b/src/kernel/ntqnamespace.h index abc3bfb8b..c540c549b 100644 --- a/src/kernel/ntqnamespace.h +++ b/src/kernel/ntqnamespace.h @@ -272,7 +272,7 @@ public: // Image conversion flags. The unusual ordering is caused by // compatibility and default requirements. - // Documented in qimage.cpp + // Documented in tqimage.cpp enum ImageConversionFlags { ColorMode_Mask = 0x00000003, diff --git a/src/kernel/ntqpngio.h b/src/kernel/ntqpngio.h index ebb817d6a..42c85c653 100644 --- a/src/kernel/ntqpngio.h +++ b/src/kernel/ntqpngio.h @@ -42,7 +42,7 @@ #define TQPNGIO_H #ifndef QT_H -#include "ntqimage.h" +#include "tqimage.h" #endif // QT_H #ifndef TQT_NO_IMAGEIO_PNG diff --git a/src/kernel/ntqt.h b/src/kernel/ntqt.h index fd10a18b0..a11383bb5 100644 --- a/src/kernel/ntqt.h +++ b/src/kernel/ntqt.h @@ -105,8 +105,8 @@ #include #include #include "ntqbuffer.h" -#include "ntqimage.h" -#include +#include "tqimage.h" +#include #include "ntqlineedit.h" #include #include "ntqintdict.h" @@ -278,7 +278,7 @@ #include #include "private/qgfxdriverinterface_p.h" #include "private/qcom_p.h" -#include "private/qimageformatinterface_p.h" +#include "private/tqimageformatinterface_p.h" #include "private/qisciicodec_p.h" #include "private/qkbddriverinterface_p.h" #include "private/qlayoutengine_p.h" diff --git a/src/kernel/qbitmap.cpp b/src/kernel/qbitmap.cpp index 9a075b8f4..3c64c22b0 100644 --- a/src/kernel/qbitmap.cpp +++ b/src/kernel/qbitmap.cpp @@ -39,7 +39,7 @@ **********************************************************************/ #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" /*! diff --git a/src/kernel/qcursor.cpp b/src/kernel/qcursor.cpp index 7d128c159..d6b736460 100644 --- a/src/kernel/qcursor.cpp +++ b/src/kernel/qcursor.cpp @@ -43,7 +43,7 @@ #ifndef TQT_NO_CURSOR #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqdatastream.h" diff --git a/src/kernel/qcursor_x11.cpp b/src/kernel/qcursor_x11.cpp index f3b034da8..8cf9f6dde 100644 --- a/src/kernel/qcursor_x11.cpp +++ b/src/kernel/qcursor_x11.cpp @@ -40,7 +40,7 @@ #include "ntqcursor.h" #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqapplication.h" #include "ntqdatastream.h" #include "ntqnamespace.h" diff --git a/src/kernel/qfontengine_x11.cpp b/src/kernel/qfontengine_x11.cpp index 96f011927..5cf756265 100644 --- a/src/kernel/qfontengine_x11.cpp +++ b/src/kernel/qfontengine_x11.cpp @@ -49,7 +49,7 @@ #include "ntqpaintdevice.h" #include "ntqpaintdevicemetrics.h" #include "ntqpainter.h" -#include "ntqimage.h" +#include "tqimage.h" #include "qt_x11_p.h" diff --git a/src/kernel/qiconset.cpp b/src/kernel/qiconset.cpp index 43e74b2ba..0b17d6193 100644 --- a/src/kernel/qiconset.cpp +++ b/src/kernel/qiconset.cpp @@ -45,7 +45,7 @@ #include "ntqapplication.h" #include "ntqbitmap.h" #include "ntqcleanuphandler.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpainter.h" enum { NumSizes = 2, NumModes = 3, NumStates = 2 }; diff --git a/src/kernel/qimage.cpp b/src/kernel/qimage.cpp deleted file mode 100644 index 3d7c15bfa..000000000 --- a/src/kernel/qimage.cpp +++ /dev/null @@ -1,6531 +0,0 @@ -/**************************************************************************** -** -** Implementation of TQImage and TQImageIO classes -** -** Created : 950207 -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqimage.h" -#include "ntqregexp.h" -#include "ntqfile.h" -#include "ntqdatastream.h" -#include "ntqtextstream.h" -#include "ntqbuffer.h" -#include "tqptrlist.h" -#include "ntqasyncimageio.h" -#include "ntqpngio.h" -#include "ntqmngio.h" -#include "ntqjpegio.h" -#include "tqmap.h" -#include -#include "qimageformatinterface_p.h" -#include "ntqwmatrix.h" -#include "ntqapplication.h" -#include "ntqmime.h" -#include "ntqdragobject.h" -#include -#include - -#ifdef TQ_WS_QWS -#include "qgfx_qws.h" -#endif - -// 16bpp images on supported on TQt/Embedded -#if !defined( TQ_WS_QWS ) && !defined(TQT_NO_IMAGE_16_BIT) -#define TQT_NO_IMAGE_16_BIT -#endif - - -/*! - \class TQImage - \brief The TQImage class provides a hardware-independent pixmap - representation with direct access to the pixel data. - - \ingroup images - \ingroup graphics - \ingroup shared - \mainclass - - It is one of the two classes TQt provides for dealing with images, - the other being TQPixmap. TQImage is designed and optimized for I/O - and for direct pixel access/manipulation. TQPixmap is designed and - optimized for drawing. There are (slow) functions to convert - between TQImage and TQPixmap: TQPixmap::convertToImage() and - TQPixmap::convertFromImage(). - - An image has the parameters \link width() width\endlink, \link - height() height\endlink and \link depth() depth\endlink (bits per - pixel, bpp), a color table and the actual \link bits() - pixels\endlink. TQImage supports 1-bpp, 8-bpp and 32-bpp image - data. 1-bpp and 8-bpp images use a color lookup table; the pixel - value is a color table index. - - 32-bpp images encode an RGB value in 24 bits and ignore the color - table. The most significant byte is used for the \link - setAlphaBuffer() alpha buffer\endlink. - - An entry in the color table is an RGB triplet encoded as a \c - uint. Use the \link ::tqRed() tqRed()\endlink, \link ::tqGreen() - tqGreen()\endlink and \link ::tqBlue() tqBlue()\endlink functions (\c - ntqcolor.h) to access the components, and \link ::tqRgb() - tqRgb\endlink to make an RGB triplet (see the TQColor class - documentation). - - 1-bpp (monochrome) images have a color table with a most two - colors. There are two different formats: big endian (MSB first) or - little endian (LSB first) bit order. To access a single bit you - will must do some bit shifts: - - \code - TQImage image; - // sets bit at (x,y) to 1 - if ( image.bitOrder() == TQImage::LittleEndian ) - *(image.scanLine(y) + (x >> 3)) |= 1 << (x & 7); - else - *(image.scanLine(y) + (x >> 3)) |= 1 << (7 - (x & 7)); - \endcode - - If this looks complicated, it might be a good idea to convert the - 1-bpp image to an 8-bpp image using convertDepth(). - - 8-bpp images are much easier to work with than 1-bpp images - because they have a single byte per pixel: - - \code - TQImage image; - // set entry 19 in the color table to yellow - image.setColor( 19, tqRgb(255,255,0) ); - // set 8 bit pixel at (x,y) to value yellow (in color table) - *(image.scanLine(y) + x) = 19; - \endcode - - 32-bpp images ignore the color table; instead, each pixel contains - the RGB triplet. 24 bits contain the RGB value; the most - significant byte is reserved for the alpha buffer. - - \code - TQImage image; - // sets 32 bit pixel at (x,y) to yellow. - uint *p = (uint *)image.scanLine(y) + x; - *p = tqRgb(255,255,0); - \endcode - - On TQt/Embedded, scanlines are aligned to the pixel depth and may - be padded to any degree, while on all other platforms, the - scanlines are 32-bit aligned for all depths. The constructor - taking a \c{uchar*} argument always expects 32-bit aligned data. - On TQt/Embedded, an additional constructor allows the number of - bytes-per-line to be specified. - - TQImage supports a variety of methods for getting information about - the image, for example, colorTable(), allGray(), isGrayscale(), - bitOrder(), bytesPerLine(), depth(), dotsPerMeterX() and - dotsPerMeterY(), hasAlphaBuffer(), numBytes(), numColors(), and - width() and height(). - - Pixel colors are retrieved with pixel() and set with setPixel(). - - TQImage also supports a number of functions for creating a new - image that is a transformed version of the original. For example, - copy(), convertBitOrder(), convertDepth(), createAlphaMask(), - createHeuristicMask(), mirror(), scale(), smoothScale(), swapRGB() - and xForm(). There are also functions for changing attributes of - an image in-place, for example, setAlphaBuffer(), setColor(), - setDotsPerMeterX() and setDotsPerMeterY() and setNumColors(). - - Images can be loaded and saved in the supported formats. Images - are saved to a file with save(). Images are loaded from a file - with load() (or in the constructor) or from an array of data with - loadFromData(). The lists of supported formats are available from - inputFormatList() and outputFormatList(). - - Strings of text may be added to images using setText(). - - The TQImage class uses explicit \link shclass.html sharing\endlink, - similar to that used by TQMemArray. - - New image formats can be added as \link plugins-howto.html - plugins\endlink. - - \sa TQImageIO TQPixmap \link shclass.html Shared Classes\endlink -*/ - - -/*! - \enum TQImage::Endian - - This enum type is used to describe the endianness of the CPU and - graphics hardware. - - \value IgnoreEndian Endianness does not matter. Useful for some - operations that are independent of endianness. - \value BigEndian Network byte order, as on SPARC and Motorola CPUs. - \value LittleEndian PC/Alpha byte order. -*/ - -/*! - \enum TQt::ImageConversionFlags - - The conversion flag is a bitwise-OR of the following values. The - options marked "(default)" are set if no other values from the - list are included (since the defaults are zero): - - Color/Mono preference (ignored for TQBitmap) - \value AutoColor (default) - If the image has \link - TQImage::depth() depth\endlink 1 and contains only - black and white pixels, the pixmap becomes monochrome. - \value ColorOnly The pixmap is dithered/converted to the - \link TQPixmap::defaultDepth() native display depth\endlink. - \value MonoOnly The pixmap becomes monochrome. If necessary, - it is dithered using the chosen dithering algorithm. - - Dithering mode preference for RGB channels - \value DiffuseDither (default) - A high-quality dither. - \value OrderedDither A faster, more ordered dither. - \value ThresholdDither No dithering; closest color is used. - - Dithering mode preference for alpha channel - \value ThresholdAlphaDither (default) - No dithering. - \value OrderedAlphaDither A faster, more ordered dither. - \value DiffuseAlphaDither A high-quality dither. - \value NoAlpha Not supported. - - Color matching versus dithering preference - \value PreferDither (default when converting to a pixmap) - Always dither - 32-bit images when the image is converted to 8 bits. - \value AvoidDither (default when converting for the purpose of saving to - file) - Dither 32-bit images only if the image has more than 256 - colors and it is being converted to 8 bits. - \value AutoDither Not supported. - - The following are not values that are used directly, but masks for - the above classes: - \value ColorMode_Mask Mask for the color mode. - \value Dither_Mask Mask for the dithering mode for RGB channels. - \value AlphaDither_Mask Mask for the dithering mode for the alpha channel. - \value DitherMode_Mask Mask for the mode that determines the preference of - color matching versus dithering. - - Using 0 as the conversion flag sets all the default options. -*/ - -#if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001) -#pragma message disable narrowptr -#endif - -#ifndef TQT_NO_IMAGE_TEXT -class TQImageDataMisc { -public: - TQImageDataMisc() { } - TQImageDataMisc( const TQImageDataMisc& o ) : - text_lang(o.text_lang) { } - - TQImageDataMisc& operator=(const TQImageDataMisc& o) - { - text_lang = o.text_lang; - return *this; - } - TQValueList list() - { - return text_lang.keys(); - } - - TQStringList languages() - { - TQStringList r; - TQMap::Iterator it = text_lang.begin(); - for ( ; it != text_lang.end(); ++it ) { - r.remove( it.key().lang ); - r.append( it.key().lang ); - } - return r; - } - TQStringList keys() - { - TQStringList r; - TQMap::Iterator it = text_lang.begin(); - for ( ; it != text_lang.end(); ++it ) { - r.remove( it.key().key ); - r.append( it.key().key ); - } - return r; - } - - TQMap text_lang; -}; -#endif // TQT_NO_IMAGE_TEXT - - - -/***************************************************************************** - TQImage member functions - *****************************************************************************/ - -// table to flip bits -static const uchar bitflip[256] = { - /* - open OUT, "| fmt"; - for $i (0..255) { - print OUT (($i >> 7) & 0x01) | (($i >> 5) & 0x02) | - (($i >> 3) & 0x04) | (($i >> 1) & 0x08) | - (($i << 7) & 0x80) | (($i << 5) & 0x40) | - (($i << 3) & 0x20) | (($i << 1) & 0x10), ", "; - } - close OUT; - */ - 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, - 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, - 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, - 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, - 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, - 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, - 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, - 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, - 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, - 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, - 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, - 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, - 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, - 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, - 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, - 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 -}; - -const uchar *qt_get_bitflip_array() // called from TQPixmap code -{ - return bitflip; -} - - -/*! - Constructs a null image. - - \sa isNull() -*/ - -TQImage::TQImage() -{ - init(); -} - -/*! - Constructs an image with \a w width, \a h height, \a depth bits - per pixel, \a numColors colors and bit order \a bitOrder. - - Using this constructor is the same as first constructing a null - image and then calling the create() function. - - \sa create() -*/ - -TQImage::TQImage( int w, int h, int depth, int numColors, Endian bitOrder ) -{ - init(); - create( w, h, depth, numColors, bitOrder ); -} - -/*! - Constructs an image with size \a size pixels, depth \a depth bits, - \a numColors and \a bitOrder endianness. - - Using this constructor is the same as first constructing a null - image and then calling the create() function. - - \sa create() -*/ -TQImage::TQImage( const TQSize& size, int depth, int numColors, Endian bitOrder ) -{ - init(); - create( size, depth, numColors, bitOrder ); -} - -#ifndef TQT_NO_IMAGEIO -/*! - Constructs an image and tries to load the image from the file \a - fileName. - - If \a format is specified, the loader attempts to read the image - using the specified format. If \a format is not specified (which - is the default), the loader reads a few bytes from the header to - guess the file format. - - If the loading of the image failed, this object is a \link - isNull() null\endlink image. - - The TQImageIO documentation lists the supported image formats and - explains how to add extra formats. - - \sa load() isNull() TQImageIO -*/ - -TQImage::TQImage( const TQString &fileName, const char* format ) -{ - init(); - load( fileName, format ); -} - -#ifndef TQT_NO_IMAGEIO_XPM -// helper -static void read_xpm_image_or_array( TQImageIO *, const char * const *, TQImage & ); -#endif -/*! - Constructs an image from \a xpm, which must be a valid XPM image. - - Errors are silently ignored. - - Note that it's possible to squeeze the XPM variable a little bit - by using an unusual declaration: - - \code - static const char * const start_xpm[]={ - "16 15 8 1", - "a c #cec6bd", - .... - \endcode - - The extra \c const makes the entire definition read-only, which is - slightly more efficient (e.g. when the code is in a shared - library) and ROMable when the application is to be stored in ROM. -*/ - -TQImage::TQImage( const char * const xpm[] ) -{ - init(); -#ifndef TQT_NO_IMAGEIO_XPM - read_xpm_image_or_array( 0, xpm, *this ); -#else - // We use a tqFatal rather than disabling the whole function, as this - // constructor may be ambiguous. - tqFatal("XPM not supported"); -#endif -} - -/*! - Constructs an image from the binary data \a array. It tries to - guess the file format. - - If the loading of the image failed, this object is a \link - isNull() null\endlink image. - - \sa loadFromData() isNull() imageFormat() -*/ -TQImage::TQImage( const TQByteArray &array ) -{ - init(); - loadFromData(array); -} -#endif //TQT_NO_IMAGEIO - - -/*! - Constructs a \link shclass.html shallow copy\endlink of \a image. -*/ - -TQImage::TQImage( const TQImage &image ) -{ - data = image.data; - data->ref(); -} - -/*! - Constructs an image \a w pixels wide, \a h pixels high with a - color depth of \a depth, that uses an existing memory buffer, \a - yourdata. The buffer must remain valid throughout the life of the - TQImage. The image does not delete the buffer at destruction. - - If \a colortable is 0, a color table sufficient for \a numColors - will be allocated (and destructed later). - - Note that \a yourdata must be 32-bit aligned. - - The endianness is given in \a bitOrder. -*/ -TQImage::TQImage( uchar* yourdata, int w, int h, int depth, - TQRgb* colortable, int numColors, - Endian bitOrder ) -{ - init(); - int bpl = ((w*depth+31)/32)*4; // bytes per scanline - if ( w <= 0 || h <= 0 || depth <= 0 || numColors < 0 - || INT_MAX / sizeof(uchar *) < uint(h) - || INT_MAX / uint(depth) < uint(w) - || bpl <= 0 - || INT_MAX / uint(bpl) < uint(h) ) - return; // invalid parameter(s) - data->w = w; - data->h = h; - data->d = depth; - data->ncols = depth != 32 ? numColors : 0; - if ( !yourdata ) - return; // Image header info can be saved without needing to allocate memory. - data->nbytes = bpl*h; - if ( colortable || !data->ncols ) { - data->ctbl = colortable; - data->ctbl_mine = FALSE; - } else { - // calloc since we realloc, etc. later (ick) - data->ctbl = (TQRgb*)calloc( data->ncols*sizeof(TQRgb), data->ncols ); - TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; - } - uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); - TQ_CHECK_PTR(jt); - for (int j=0; jbits = jt; - data->bitordr = bitOrder; -} - -#ifdef TQ_WS_QWS - -/*! - Constructs an image that uses an existing memory buffer. The - buffer must remain valid for the life of the TQImage. The image - does not delete the buffer at destruction. The buffer is passed as - \a yourdata. The image's width is \a w and its height is \a h. The - color depth is \a depth. \a bpl specifies the number of bytes per - line. - - If \a colortable is 0, a color table sufficient for \a numColors - will be allocated (and destructed later). - - The endianness is specified by \a bitOrder. - - \warning This constructor is only available on TQt/Embedded. -*/ -TQImage::TQImage( uchar* yourdata, int w, int h, int depth, - int bpl, TQRgb* colortable, int numColors, - Endian bitOrder ) -{ - init(); - if ( !yourdata || w <= 0 || h <= 0 || depth <= 0 || numColors < 0 - || INT_MAX / sizeof(uchar *) < uint(h) - || INT_MAX / uint(bpl) < uint(h) - ) - return; // invalid parameter(s) - data->w = w; - data->h = h; - data->d = depth; - data->ncols = numColors; - data->nbytes = bpl * h; - if ( colortable || !numColors ) { - data->ctbl = colortable; - data->ctbl_mine = FALSE; - } else { - // calloc since we realloc, etc. later (ick) - data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), numColors ); - TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; - } - uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); - TQ_CHECK_PTR(jt); - for (int j=0; jbits = jt; - data->bitordr = bitOrder; -} -#endif // TQ_WS_QWS - -/*! - Destroys the image and cleans up. -*/ - -TQImage::~TQImage() -{ - if ( data && data->deref() ) { - reset(); - delete data; - } -} - - - - -/*! Convenience function. Gets the data associated with the absolute - name \a abs_name from the default mime source factory and decodes it - to an image. - - \sa TQMimeSourceFactory, TQImage::fromMimeSource(), TQImageDrag::decode() -*/ -#ifndef TQT_NO_MIME -TQImage TQImage::fromMimeSource( const TQString &abs_name ) -{ - const TQMimeSource *m = TQMimeSourceFactory::defaultFactory()->data( abs_name ); - if ( !m ) { -#if defined(QT_CHECK_STATE) - tqWarning("TQImage::fromMimeSource: Cannot find image \"%s\" in the mime source factory", abs_name.latin1() ); -#endif - return TQImage(); - } - TQImage img; - TQImageDrag::decode( m, img ); - return img; -} -#endif - - -/*! - Assigns a \link shclass.html shallow copy\endlink of \a image to - this image and returns a reference to this image. - - \sa copy() -*/ - -TQImage &TQImage::operator=( const TQImage &image ) -{ - image.data->ref(); // avoid 'x = x' - if ( data->deref() ) { - reset(); - delete data; - } - data = image.data; - return *this; -} - -/*! - \overload - - Sets the image bits to the \a pixmap contents and returns a - reference to the image. - - If the image shares data with other images, it will first - dereference the shared data. - - Makes a call to TQPixmap::convertToImage(). -*/ - -TQImage &TQImage::operator=( const TQPixmap &pixmap ) -{ - *this = pixmap.convertToImage(); - return *this; -} - -/*! - Detaches from shared image data and makes sure that this image is - the only one referring to the data. - - If multiple images share common data, this image makes a copy of - the data and detaches itself from the sharing mechanism. - Nothing is done if there is just a single reference. - - \sa copy() -*/ - -void TQImage::detach() -{ - if ( data->count != 1 ) - *this = copy(); -} - -/*! - Returns a \link shclass.html deep copy\endlink of the image. - - \sa detach() -*/ - -TQImage TQImage::copy() const -{ - if ( isNull() ) { - // maintain the fields of invalid TQImages when copied - return TQImage( 0, width(), height(), depth(), colorTable(), numColors(), bitOrder() ); - } else { - TQImage image; - image.create( width(), height(), depth(), numColors(), bitOrder() ); -#ifdef TQ_WS_QWS - // TQt/Embedded can create images with non-default bpl - // make sure we don't crash. - if ( image.numBytes() != numBytes() ) - for ( int i = 0; i < height(); i++ ) - memcpy( image.scanLine(i), scanLine(i), image.bytesPerLine() ); - else -#endif - memcpy( image.bits(), bits(), numBytes() ); - memcpy( image.colorTable(), colorTable(), numColors() * sizeof(TQRgb) ); - image.setAlphaBuffer( hasAlphaBuffer() ); - image.data->dpmx = dotsPerMeterX(); - image.data->dpmy = dotsPerMeterY(); - image.data->offset = offset(); -#ifndef TQT_NO_IMAGE_TEXT - if ( data->misc ) { - image.data->misc = new TQImageDataMisc; - *image.data->misc = misc(); - } -#endif - return image; - } -} - -/*! - \overload - - Returns a \link shclass.html deep copy\endlink of a sub-area of - the image. - - The returned image is always \a w by \a h pixels in size, and is - copied from position \a x, \a y in this image. In areas beyond - this image pixels are filled with pixel 0. - - If the image needs to be modified to fit in a lower-resolution - result (e.g. converting from 32-bit to 8-bit), use the \a - conversion_flags to specify how you'd prefer this to happen. - - \sa bitBlt() TQt::ImageConversionFlags -*/ - -TQImage TQImage::copy(int x, int y, int w, int h, int conversion_flags) const -{ - int dx = 0; - int dy = 0; - if ( w <= 0 || h <= 0 ) return TQImage(); // Nothing to copy - - TQImage image( w, h, depth(), numColors(), bitOrder() ); - - if ( x < 0 || y < 0 || x + w > width() || y + h > height() ) { - // bitBlt will not cover entire image - clear it. - // ### should deal with each side separately for efficiency - image.fill(0); - if ( x < 0 ) { - dx = -x; - x = 0; - } - if ( y < 0 ) { - dy = -y; - y = 0; - } - } - - bool has_alpha = hasAlphaBuffer(); - if ( has_alpha ) { - // alpha channel should be only copied, not used by bitBlt(), and - // this is mutable, we will restore the image state before returning - TQImage *that = (TQImage *) this; - that->setAlphaBuffer( FALSE ); - } - memcpy( image.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); - bitBlt( &image, dx, dy, this, x, y, -1, -1, conversion_flags ); - if ( has_alpha ) { - // restore image state - TQImage *that = (TQImage *) this; - that->setAlphaBuffer( TRUE ); - } - image.setAlphaBuffer(hasAlphaBuffer()); - image.data->dpmx = dotsPerMeterX(); - image.data->dpmy = dotsPerMeterY(); - image.data->offset = offset(); -#ifndef TQT_NO_IMAGE_TEXT - if ( data->misc ) { - image.data->misc = new TQImageDataMisc; - *image.data->misc = misc(); - } -#endif - return image; -} - -/*! - \overload TQImage TQImage::copy(const TQRect& r) const - - Returns a \link shclass.html deep copy\endlink of a sub-area of - the image. - - The returned image always has the size of the rectangle \a r. In - areas beyond this image pixels are filled with pixel 0. -*/ - -/*! - \fn bool TQImage::isNull() const - - Returns TRUE if it is a null image; otherwise returns FALSE. - - A null image has all parameters set to zero and no allocated data. -*/ - - -/*! - \fn int TQImage::width() const - - Returns the width of the image. - - \sa height() size() rect() -*/ - -/*! - \fn int TQImage::height() const - - Returns the height of the image. - - \sa width() size() rect() -*/ - -/*! - \fn TQSize TQImage::size() const - - Returns the size of the image, i.e. its width and height. - - \sa width() height() rect() -*/ - -/*! - \fn TQRect TQImage::rect() const - - Returns the enclosing rectangle (0, 0, width(), height()) of the - image. - - \sa width() height() size() -*/ - -/*! - \fn int TQImage::depth() const - - Returns the depth of the image. - - The image depth is the number of bits used to encode a single - pixel, also called bits per pixel (bpp) or bit planes of an image. - - The supported depths are 1, 8, 16 (TQt/Embedded only) and 32. - - \sa convertDepth() -*/ - -/*! - \fn int TQImage::numColors() const - - Returns the size of the color table for the image. - - Notice that numColors() returns 0 for 16-bpp (TQt/Embedded only) - and 32-bpp images because these images do not use color tables, - but instead encode pixel values as RGB triplets. - - \sa setNumColors() colorTable() -*/ - -/*! - \fn TQImage::Endian TQImage::bitOrder() const - - Returns the bit order for the image. - - If it is a 1-bpp image, this function returns either - TQImage::BigEndian or TQImage::LittleEndian. - - If it is not a 1-bpp image, this function returns - TQImage::IgnoreEndian. - - \sa depth() -*/ - -/*! - \fn uchar **TQImage::jumpTable() const - - Returns a pointer to the scanline pointer table. - - This is the beginning of the data block for the image. - - \sa bits() scanLine() -*/ - -/*! - \fn TQRgb *TQImage::colorTable() const - - Returns a pointer to the color table. - - \sa numColors() -*/ - -/*! - \fn int TQImage::numBytes() const - - Returns the number of bytes occupied by the image data. - - \sa bytesPerLine() bits() -*/ - -/*! - \fn int TQImage::bytesPerLine() const - - Returns the number of bytes per image scanline. This is equivalent - to numBytes()/height(). - - \sa numBytes() scanLine() -*/ - -/*! - \fn TQRgb TQImage::color( int i ) const - - Returns the color in the color table at index \a i. The first - color is at index 0. - - A color value is an RGB triplet. Use the \link ::tqRed() - tqRed()\endlink, \link ::tqGreen() tqGreen()\endlink and \link - ::tqBlue() tqBlue()\endlink functions (defined in \c ntqcolor.h) to - get the color value components. - - \sa setColor() numColors() TQColor -*/ - -/*! - \fn void TQImage::setColor( int i, TQRgb c ) - - Sets a color in the color table at index \a i to \a c. - - A color value is an RGB triplet. Use the \link ::tqRgb() - tqRgb()\endlink function (defined in \c ntqcolor.h) to make RGB - triplets. - - \sa color() setNumColors() numColors() -*/ - -/*! - \fn uchar *TQImage::scanLine( int i ) const - - Returns a pointer to the pixel data at the scanline with index \a - i. The first scanline is at index 0. - - The scanline data is aligned on a 32-bit boundary. - - \warning If you are accessing 32-bpp image data, cast the returned - pointer to \c{TQRgb*} (TQRgb has a 32-bit size) and use it to - read/write the pixel value. You cannot use the \c{uchar*} pointer - directly, because the pixel format depends on the byte order on - the underlying platform. Hint: use \link ::tqRed() tqRed()\endlink, - \link ::tqGreen() tqGreen()\endlink and \link ::tqBlue() - tqBlue()\endlink, etc. (ntqcolor.h) to access the pixels. - - \warning If you are accessing 16-bpp image data, you must handle - endianness yourself. (TQt/Embedded only) - - \sa bytesPerLine() bits() jumpTable() -*/ - -/*! - \fn uchar *TQImage::bits() const - - Returns a pointer to the first pixel data. This is equivalent to - scanLine(0). - - \sa numBytes() scanLine() jumpTable() -*/ - - - -void TQImage::warningIndexRange( const char *func, int i ) -{ -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::%s: Index %d out of range", func, i ); -#else - Q_UNUSED( func ) - Q_UNUSED( i ) -#endif -} - - -/*! - Resets all image parameters and deallocates the image data. -*/ - -void TQImage::reset() -{ - freeBits(); - setNumColors( 0 ); -#ifndef TQT_NO_IMAGE_TEXT - delete data->misc; -#endif - reinit(); -} - - -/*! - Fills the entire image with the pixel value \a pixel. - - If the \link depth() depth\endlink of this image is 1, only the - lowest bit is used. If you say fill(0), fill(2), etc., the image - is filled with 0s. If you say fill(1), fill(3), etc., the image is - filled with 1s. If the depth is 8, the lowest 8 bits are used. - - If the depth is 32 and the image has no alpha buffer, the \a pixel - value is written to each pixel in the image. If the image has an - alpha buffer, only the 24 RGB bits are set and the upper 8 bits - (alpha value) are left unchanged. - - Note: TQImage::pixel() returns the color of the pixel at the given - coordinates; TQColor::pixel() returns the pixel value of the - underlying window system (essentially an index value), so normally - you will want to use TQImage::pixel() to use a color from an - existing image or TQColor::rgb() to use a specific color. - - \sa invertPixels() depth() hasAlphaBuffer() create() -*/ - -void TQImage::fill( uint pixel ) -{ - if ( depth() == 1 || depth() == 8 ) { - if ( depth() == 1 ) { - if ( pixel & 1 ) - pixel = 0xffffffff; - else - pixel = 0; - } else { - uint c = pixel & 0xff; - pixel = c | ((c << 8) & 0xff00) | ((c << 16) & 0xff0000) | - ((c << 24) & 0xff000000); - } - int bpl = bytesPerLine(); - for ( int i=0; i // needed for systemBitOrder -#include -#include -#if defined(Q_OS_WIN32) -#undef open -#undef close -#undef read -#undef write -#endif -#endif - -// POSIX Large File Support redefines open -> open64 -#if defined(open) -# undef open -#endif - -// POSIX Large File Support redefines truncate -> truncate64 -#if defined(truncate) -# undef truncate -#endif - -/*! - Determines the bit order of the display hardware. Returns - TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). - - \sa systemByteOrder() -*/ - -TQImage::Endian TQImage::systemBitOrder() -{ -#if defined(TQ_WS_X11) - return BitmapBitOrder(tqt_xdisplay()) == MSBFirst ? BigEndian :LittleEndian; -#else - return BigEndian; -#endif -} - - -/*! - Resizes the color table to \a numColors colors. - - If the color table is expanded all the extra colors will be set to - black (RGB 0,0,0). - - \sa numColors() color() setColor() colorTable() -*/ - -void TQImage::setNumColors( int numColors ) -{ - if ( numColors == data->ncols ) - return; - if ( numColors == 0 ) { // use no color table - if ( data->ctbl ) { - if ( data->ctbl_mine ) - free( data->ctbl ); - else - data->ctbl_mine = TRUE; - data->ctbl = 0; - } - data->ncols = 0; - return; - } - if ( data->ctbl && data->ctbl_mine ) { // already has color table - data->ctbl = (TQRgb*)realloc( data->ctbl, numColors*sizeof(TQRgb) ); - if ( data->ctbl && numColors > data->ncols ) - memset( (char *)&data->ctbl[data->ncols], 0, - (numColors-data->ncols)*sizeof(TQRgb) ); - } else { // create new color table - data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), 1 ); - TQ_CHECK_PTR(data->ctbl); - data->ctbl_mine = TRUE; - } - data->ncols = data->ctbl == 0 ? 0 : numColors; -} - - -/*! - \fn bool TQImage::hasAlphaBuffer() const - - Returns TRUE if alpha buffer mode is enabled; otherwise returns - FALSE. - - \sa setAlphaBuffer() -*/ - -/*! - Enables alpha buffer mode if \a enable is TRUE, otherwise disables - it. The default setting is disabled. - - An 8-bpp image has 8-bit pixels. A pixel is an index into the - \link color() color table\endlink, which contains 32-bit color - values. In a 32-bpp image, the 32-bit pixels are the color values. - - This 32-bit value is encoded as follows: The lower 24 bits are - used for the red, green, and blue components. The upper 8 bits - contain the alpha component. - - The alpha component specifies the transparency of a pixel. 0 means - completely transparent and 255 means opaque. The alpha component - is ignored if you do not enable alpha buffer mode. - - The alpha buffer is used to set a mask when a TQImage is translated - to a TQPixmap. - - \sa hasAlphaBuffer() createAlphaMask() -*/ - -void TQImage::setAlphaBuffer( bool enable ) -{ - data->alpha = enable; -} - - -/*! - Sets the image \a width, \a height, \a depth, its number of colors - (in \a numColors), and bit order. Returns TRUE if successful, or - FALSE if the parameters are incorrect or if memory cannot be - allocated. - - The \a width and \a height is limited to 32767. \a depth must be - 1, 8, or 32. If \a depth is 1, \a bitOrder must be set to - either TQImage::LittleEndian or TQImage::BigEndian. For other depths - \a bitOrder must be TQImage::IgnoreEndian. - - This function allocates a color table and a buffer for the image - data. The image data is not initialized. - - The image buffer is allocated as a single block that consists of a - table of \link scanLine() scanline\endlink pointers (jumpTable()) - and the image data (bits()). - - \sa fill() width() height() depth() numColors() bitOrder() - jumpTable() scanLine() bits() bytesPerLine() numBytes() -*/ - -bool TQImage::create( int width, int height, int depth, int numColors, - Endian bitOrder ) -{ - reset(); // reset old data - if ( width <= 0 || height <= 0 || depth <= 0 || numColors < 0 ) - return FALSE; // invalid parameter(s) - if ( depth == 1 && bitOrder == IgnoreEndian ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::create: Bit order is required for 1 bpp images" ); -#endif - return FALSE; - } - if ( depth != 1 ) - bitOrder = IgnoreEndian; - -#if defined(QT_CHECK_RANGE) - if ( depth == 24 ) - tqWarning( "TQImage::create: 24-bpp images no longer supported, " - "use 32-bpp instead" ); -#endif - switch ( depth ) { - case 1: - case 8: -#ifndef TQT_NO_IMAGE_16_BIT - case 16: -#endif -#ifndef TQT_NO_IMAGE_TRUECOLOR - case 32: -#endif - break; - default: // invalid depth - return FALSE; - } - - if ( depth == 32 ) - numColors = 0; - setNumColors( numColors ); - if ( data->ncols != numColors ) // could not alloc color table - return FALSE; - - if ( INT_MAX / uint(depth) < uint(width) ) { // sanity check for potential overflow - setNumColors( 0 ); - return FALSE; - } -// TQt/Embedded doesn't waste memory on unnecessary padding. -#ifdef TQ_WS_QWS - const int bpl = (width*depth+7)/8; // bytes per scanline - const int pad = 0; -#else - const int bpl = ((width*depth+31)/32)*4; // bytes per scanline - // #### WWA: shouldn't this be (width*depth+7)/8: - const int pad = bpl - (width*depth)/8; // pad with zeros -#endif - if ( INT_MAX / uint(bpl) < uint(height) - || bpl < 0 - || INT_MAX / sizeof(uchar *) < uint(height) ) { // sanity check for potential overflow - setNumColors( 0 ); - return FALSE; - } - int nbytes = bpl*height; // image size - int ptbl = height*sizeof(uchar*); // pointer table size - int size = nbytes + ptbl; // total size of data block - uchar **p = (uchar **)malloc( size ); // alloc image bits - TQ_CHECK_PTR(p); - if ( !p ) { // no memory - setNumColors( 0 ); - return FALSE; - } - data->w = width; - data->h = height; - data->d = depth; - data->nbytes = nbytes; - data->bitordr = bitOrder; - data->bits = p; // set image pointer - //uchar *d = (uchar*)p + ptbl; // setup scanline pointers - uchar *d = (uchar*)(p + height); // setup scanline pointers - while ( height-- ) { - *p++ = d; - if ( pad ) - memset( d+bpl-pad, 0, pad ); - d += bpl; - } - return TRUE; -} - -/*! - \overload bool TQImage::create( const TQSize&, int depth, int numColors, Endian bitOrder ) -*/ -bool TQImage::create( const TQSize& size, int depth, int numColors, - TQImage::Endian bitOrder ) -{ - return create(size.width(), size.height(), depth, numColors, bitOrder); -} - -/*! - \internal - Initializes the image data structure. -*/ - -void TQImage::init() -{ - data = new TQImageData; - TQ_CHECK_PTR( data ); - reinit(); -} - -void TQImage::reinit() -{ - data->w = data->h = data->d = data->ncols = 0; - data->nbytes = 0; - data->ctbl = 0; - data->bits = 0; - data->bitordr = TQImage::IgnoreEndian; - data->alpha = FALSE; -#ifndef TQT_NO_IMAGE_TEXT - data->misc = 0; -#endif - data->dpmx = 0; - data->dpmy = 0; - data->offset = TQPoint(0,0); -} - -/*! - \internal - Deallocates the image data and sets the bits pointer to 0. -*/ - -void TQImage::freeBits() -{ - if ( data->bits ) { // dealloc image bits - free( data->bits ); - data->bits = 0; - } -} - - -/***************************************************************************** - Internal routines for converting image depth. - *****************************************************************************/ - -// -// convert_32_to_8: Converts a 32 bits depth (true color) to an 8 bit -// image with a colormap. If the 32 bit image has more than 256 colors, -// we convert the red,green and blue bytes into a single byte encoded -// as 6 shades of each of red, green and blue. -// -// if dithering is needed, only 1 color at most is available for alpha. -// -#ifndef TQT_NO_IMAGE_TRUECOLOR -struct TQRgbMap { - TQRgbMap() : rgb(0xffffffff) { } - bool used() const { return rgb!=0xffffffff; } - uchar pix; - TQRgb rgb; -}; - -static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_flags, TQRgb* palette=0, int palette_count=0 ) -{ - TQRgb *p; - uchar *b; - bool do_quant = FALSE; - int y, x; - - if ( !dst->create(src->width(), src->height(), 8, 256) ) - return FALSE; - - const int tablesize = 997; // prime - TQRgbMap table[tablesize]; - int pix=0; - TQRgb amask = src->hasAlphaBuffer() ? 0xffffffff : 0x00ffffff; - if ( src->hasAlphaBuffer() ) - dst->setAlphaBuffer(TRUE); - - if ( palette ) { - // Preload palette into table. - - p = palette; - // Almost same code as pixel insertion below - while ( palette_count-- > 0 ) { - // Find in table... - int hash = (*p & amask) % tablesize; - for (;;) { - if ( table[hash].used() ) { - if ( table[hash].rgb == (*p & amask) ) { - // Found previous insertion - use it - break; - } else { - // Keep searching... - if (++hash == tablesize) hash = 0; - } - } else { - // Cannot be in table - Q_ASSERT ( pix != 256 ); // too many colors - // Insert into table at this unused position - dst->setColor( pix, (*p & amask) ); - table[hash].pix = pix++; - table[hash].rgb = *p & amask; - break; - } - } - p++; - } - } - - if ( (conversion_flags & TQt::DitherMode_Mask) == TQt::PreferDither ) { - do_quant = TRUE; - } else { - for ( y=0; yheight(); y++ ) { // check if <= 256 colors - p = (TQRgb *)src->scanLine(y); - b = dst->scanLine(y); - x = src->width(); - while ( x-- ) { - // Find in table... - int hash = (*p & amask) % tablesize; - for (;;) { - if ( table[hash].used() ) { - if ( table[hash].rgb == (*p & amask) ) { - // Found previous insertion - use it - break; - } else { - // Keep searching... - if (++hash == tablesize) hash = 0; - } - } else { - // Cannot be in table - if ( pix == 256 ) { // too many colors - do_quant = TRUE; - // Break right out - x = 0; - y = src->height(); - } else { - // Insert into table at this unused position - dst->setColor( pix, (*p & amask) ); - table[hash].pix = pix++; - table[hash].rgb = (*p & amask); - } - break; - } - } - *b++ = table[hash].pix; // May occur once incorrectly - p++; - } - } - } - int ncols = do_quant ? 256 : pix; - - static uint bm[16][16]; - static int init=0; - if (!init) { - // Build a Bayer Matrix for dithering - - init = 1; - int n, i, j; - - bm[0][0]=0; - - for (n=1; n<16; n*=2) { - for (i=0; isetNumColors( ncols ); - - if ( do_quant ) { // quantization needed - -#define MAX_R 5 -#define MAX_G 5 -#define MAX_B 5 -#define INDEXOF(r,g,b) (((r)*(MAX_G+1)+(g))*(MAX_B+1)+(b)) - - int rc, gc, bc; - - for ( rc=0; rc<=MAX_R; rc++ ) // build 6x6x6 color cube - for ( gc=0; gc<=MAX_G; gc++ ) - for ( bc=0; bc<=MAX_B; bc++ ) { - dst->setColor( INDEXOF(rc,gc,bc), - (amask&0xff000000) - | tqRgb( rc*255/MAX_R, gc*255/MAX_G, bc*255/MAX_B ) ); - } - - int sw = src->width(); - - int* line1[3]; - int* line2[3]; - int* pv[3]; - if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::DiffuseDither ) { - line1[0] = new int[sw]; - line2[0] = new int[sw]; - line1[1] = new int[sw]; - line2[1] = new int[sw]; - line1[2] = new int[sw]; - line2[2] = new int[sw]; - pv[0] = new int[sw]; - pv[1] = new int[sw]; - pv[2] = new int[sw]; - } - - for ( y=0; y < src->height(); y++ ) { - p = (TQRgb *)src->scanLine(y); - b = dst->scanLine(y); - TQRgb *end = p + sw; - - // perform quantization - if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::ThresholdDither ) { -#define DITHER(p,m) ((uchar) ((p * (m) + 127) / 255)) - while ( p < end ) { - rc = tqRed( *p ); - gc = tqGreen( *p ); - bc = tqBlue( *p ); - - *b++ = - INDEXOF( - DITHER(rc, MAX_R), - DITHER(gc, MAX_G), - DITHER(bc, MAX_B) - ); - - p++; - } -#undef DITHER - } else if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::OrderedDither ) { -#define DITHER(p,d,m) ((uchar) ((((256 * (m) + (m) + 1)) * (p) + (d)) / 65536 )) - - int x = 0; - while ( p < end ) { - uint d = bm[y&15][x&15]; - - rc = tqRed( *p ); - gc = tqGreen( *p ); - bc = tqBlue( *p ); - - *b++ = - INDEXOF( - DITHER(rc, d, MAX_R), - DITHER(gc, d, MAX_G), - DITHER(bc, d, MAX_B) - ); - - p++; - x++; - } -#undef DITHER - } else { // Diffuse - int endian = (TQImage::systemByteOrder() == TQImage::BigEndian); - int x; - uchar* q = src->scanLine(y); - uchar* q2 = src->scanLine(y+1 < src->height() ? y + 1 : 0); - for (int chan = 0; chan < 3; chan++) { - b = dst->scanLine(y); - int *l1 = (y&1) ? line2[chan] : line1[chan]; - int *l2 = (y&1) ? line1[chan] : line2[chan]; - if ( y == 0 ) { - for (int i=0; iheight() ) { - for (int i=0; i>4; - l2[x+1] += err>>4; - } - l2[x]+=(err*5)>>4; - if (x>1) - l2[x-1]+=(err*3)>>4; - } - } else { - for (x=sw; x-->0; ) { - int pix = TQMAX(TQMIN(5, (l1[x] * 5 + 128)/ 255), 0); - int err = l1[x] - pix * 255 / 5; - pv[chan][x] = pix; - - // Spread the error around... - if ( x > 0 ) { - l1[x-1] += (err*7)>>4; - l2[x-1] += err>>4; - } - l2[x]+=(err*5)>>4; - if (x+1 < sw) - l2[x+1]+=(err*3)>>4; - } - } - } - if (endian) { - for (x=0; xhasAlphaBuffer() ) { - const int trans = 216; - dst->setColor(trans, 0x00000000); // transparent - TQImage mask = src->createAlphaMask(conversion_flags); - uchar* m; - for ( y=0; y < src->height(); y++ ) { - uchar bit = 0x80; - m = mask.scanLine(y); - b = dst->scanLine(y); - int w = src->width(); - for ( x = 0; x>= 1)) { - bit = 0x80; - while ( xcreate(src->width(), src->height(), 32) ) - return FALSE; // create failed - dst->setAlphaBuffer( src->hasAlphaBuffer() ); - for ( int y=0; yheight(); y++ ) { // for each scan line... - uint *p = (uint *)dst->scanLine(y); - uchar *b = src->scanLine(y); - uint *end = p + dst->width(); - while ( p < end ) - *p++ = src->color(*b++); - } - return TRUE; -} - - -static bool convert_1_to_32( const TQImage *src, TQImage *dst ) -{ - if ( !dst->create(src->width(), src->height(), 32) ) - return FALSE; // could not create - dst->setAlphaBuffer( src->hasAlphaBuffer() ); - for ( int y=0; yheight(); y++ ) { // for each scan line... - uint *p = (uint *)dst->scanLine(y); - uchar *b = src->scanLine(y); - int x; - if ( src->bitOrder() == TQImage::BigEndian ) { - for ( x=0; xwidth(); x++ ) { - *p++ = src->color( (*b >> (7 - (x & 7))) & 1 ); - if ( (x & 7) == 7 ) - b++; - } - } else { - for ( x=0; xwidth(); x++ ) { - *p++ = src->color( (*b >> (x & 7)) & 1 ); - if ( (x & 7) == 7 ) - b++; - } - } - } - return TRUE; -} -#endif // TQT_NO_IMAGE_TRUECOLOR - -static bool convert_1_to_8( const TQImage *src, TQImage *dst ) -{ - if ( !dst->create(src->width(), src->height(), 8, 2) ) - return FALSE; // something failed - dst->setAlphaBuffer( src->hasAlphaBuffer() ); - if (src->numColors() >= 2) { - dst->setColor( 0, src->color(0) ); // copy color table - dst->setColor( 1, src->color(1) ); - } else { - // Unlikely, but they do exist - if (src->numColors() >= 1) - dst->setColor( 0, src->color(0) ); - else - dst->setColor( 0, 0xffffffff ); - dst->setColor( 1, 0xff000000 ); - } - for ( int y=0; yheight(); y++ ) { // for each scan line... - uchar *p = dst->scanLine(y); - uchar *b = src->scanLine(y); - int x; - if ( src->bitOrder() == TQImage::BigEndian ) { - for ( x=0; xwidth(); x++ ) { - *p++ = (*b >> (7 - (x & 7))) & 1; - if ( (x & 7) == 7 ) - b++; - } - } else { - for ( x=0; xwidth(); x++ ) { - *p++ = (*b >> (x & 7)) & 1; - if ( (x & 7) == 7 ) - b++; - } - } - } - return TRUE; -} - -#ifndef TQT_NO_IMAGE_DITHER_TO_1 -// -// dither_to_1: Uses selected dithering algorithm. -// - -static bool dither_to_1( const TQImage *src, TQImage *dst, - int conversion_flags, bool fromalpha ) -{ - if ( !dst->create(src->width(), src->height(), 1, 2, TQImage::BigEndian) ) - return FALSE; // something failed - - enum { Threshold, Ordered, Diffuse } dithermode; - - if ( fromalpha ) { - if ( ( conversion_flags & TQt::AlphaDither_Mask ) == TQt::DiffuseAlphaDither ) - dithermode = Diffuse; - else if ( ( conversion_flags & TQt::AlphaDither_Mask ) == TQt::OrderedAlphaDither ) - dithermode = Ordered; - else - dithermode = Threshold; - } else { - if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::ThresholdDither ) - dithermode = Threshold; - else if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::OrderedDither ) - dithermode = Ordered; - else - dithermode = Diffuse; - } - - dst->setColor( 0, tqRgb(255, 255, 255) ); - dst->setColor( 1, tqRgb( 0, 0, 0) ); - int w = src->width(); - int h = src->height(); - int d = src->depth(); - uchar gray[256]; // gray map for 8 bit images - bool use_gray = d == 8; - if ( use_gray ) { // make gray map - if ( fromalpha ) { - // Alpha 0x00 -> 0 pixels (white) - // Alpha 0xFF -> 1 pixels (black) - for ( int i=0; inumColors(); i++ ) - gray[i] = (255 - (src->color(i) >> 24)); - } else { - // Pixel 0x00 -> 1 pixels (black) - // Pixel 0xFF -> 0 pixels (white) - for ( int i=0; inumColors(); i++ ) - gray[i] = tqGray( src->color(i) & 0x00ffffff ); - } - } - - switch ( dithermode ) { - case Diffuse: { - int *line1 = new int[w]; - int *line2 = new int[w]; - int bmwidth = (w+7)/8; - if ( !(line1 && line2) ) - return FALSE; - uchar *p; - uchar *end; - int *b1, *b2; - int wbytes = w * (d/8); - p = src->bits(); - end = p + wbytes; - b2 = line2; - if ( use_gray ) { // 8 bit image - while ( p < end ) - *b2++ = gray[*p++]; -#ifndef TQT_NO_IMAGE_TRUECOLOR - } else { // 32 bit image - if ( fromalpha ) { - while ( p < end ) { - *b2++ = 255 - (*(uint*)p >> 24); - p += 4; - } - } else { - while ( p < end ) { - *b2++ = tqGray(*(uint*)p); - p += 4; - } - } -#endif - } - int x, y; - for ( y=0; yscanLine(y+1); - end = p + wbytes; - b2 = line2; - if ( use_gray ) { // 8 bit image - while ( p < end ) - *b2++ = gray[*p++]; -#ifndef TQT_NO_IMAGE_TRUECOLOR - } else { // 24 bit image - if ( fromalpha ) { - while ( p < end ) { - *b2++ = 255 - (*(uint*)p >> 24); - p += 4; - } - } else { - while ( p < end ) { - *b2++ = tqGray(*(uint*)p); - p += 4; - } - } -#endif - } - } - - int err; - p = dst->scanLine( y ); - memset( p, 0, bmwidth ); - b1 = line1; - b2 = line2; - int bit = 7; - for ( x=1; x<=w; x++ ) { - if ( *b1 < 128 ) { // black pixel - err = *b1++; - *p |= 1 << bit; - } else { // white pixel - err = *b1++ - 255; - } - if ( bit == 0 ) { - p++; - bit = 7; - } else { - bit--; - } - if ( x < w ) - *b1 += (err*7)>>4; // spread error to right pixel - if ( not_last_line ) { - b2[0] += (err*5)>>4; // pixel below - if ( x > 1 ) - b2[-1] += (err*3)>>4; // pixel below left - if ( x < w ) - b2[1] += err>>4; // pixel below right - } - b2++; - } - } - delete [] line1; - delete [] line2; - } break; - case Ordered: { - static uint bm[16][16]; - static int init=0; - if (!init) { - // Build a Bayer Matrix for dithering - - init = 1; - int n, i, j; - - bm[0][0]=0; - - for (n=1; n<16; n*=2) { - for (i=0; ifill( 0 ); - uchar** mline = dst->jumpTable(); -#ifndef TQT_NO_IMAGE_TRUECOLOR - if ( d == 32 ) { - uint** line = (uint**)src->jumpTable(); - for ( int i=0; i> 24) >= bm[j++&15][i&15] ) - *m |= 1 << bit; - if ( bit == 0 ) { - m++; - bit = 7; - } else { - bit--; - } - } - } else { - while ( p < end ) { - if ( (uint)tqGray(*p++) < bm[j++&15][i&15] ) - *m |= 1 << bit; - if ( bit == 0 ) { - m++; - bit = 7; - } else { - bit--; - } - } - } - } - } else -#endif // TQT_NO_IMAGE_TRUECOLOR - /* ( d == 8 ) */ { - uchar** line = src->jumpTable(); - for ( int i=0; ifill( 0 ); - uchar** mline = dst->jumpTable(); -#ifndef TQT_NO_IMAGE_TRUECOLOR - if ( d == 32 ) { - uint** line = (uint**)src->jumpTable(); - for ( int i=0; i> 24) >= 128 ) - *m |= 1 << bit; // Set mask "on" - if ( bit == 0 ) { - m++; - bit = 7; - } else { - bit--; - } - } - } else { - while ( p < end ) { - if ( tqGray(*p++) < 128 ) - *m |= 1 << bit; // Set pixel "black" - if ( bit == 0 ) { - m++; - bit = 7; - } else { - bit--; - } - } - } - } - } else -#endif //TQT_NO_IMAGE_TRUECOLOR - if ( d == 8 ) { - uchar** line = src->jumpTable(); - for ( int i=0; i> 11; - int g=(c & 0x07e0) >> 6; //green/2 - int b=(c & 0x001f); - return r == g && g == b; -} - - -static bool convert_16_to_32( const TQImage *src, TQImage *dst ) -{ - if ( !dst->create(src->width(), src->height(), 32) ) - return FALSE; // create failed - dst->setAlphaBuffer( src->hasAlphaBuffer() ); - for ( int y=0; yheight(); y++ ) { // for each scan line... - uint *p = (uint *)dst->scanLine(y); - ushort *s = (ushort*)src->scanLine(y); - uint *end = p + dst->width(); - while ( p < end ) - *p++ = qt_conv16ToRgb( *s++ ); - } - return TRUE; -} - - -static bool convert_32_to_16( const TQImage *src, TQImage *dst ) -{ - if ( !dst->create(src->width(), src->height(), 16) ) - return FALSE; // create failed - dst->setAlphaBuffer( src->hasAlphaBuffer() ); - for ( int y=0; yheight(); y++ ) { // for each scan line... - ushort *p = (ushort *)dst->scanLine(y); - uint *s = (uint*)src->scanLine(y); - ushort *end = p + dst->width(); - while ( p < end ) - *p++ = qt_convRgbTo16( *s++ ); - } - return TRUE; -} - - -#endif - -/*! - Converts the depth (bpp) of the image to \a depth and returns the - converted image. The original image is not changed. - - The \a depth argument must be 1, 8, 16 (TQt/Embedded only) or 32. - - Returns \c *this if \a depth is equal to the image depth, or a - \link isNull() null\endlink image if this image cannot be - converted. - - If the image needs to be modified to fit in a lower-resolution - result (e.g. converting from 32-bit to 8-bit), use the \a - conversion_flags to specify how you'd prefer this to happen. - - \sa TQt::ImageConversionFlags depth() isNull() -*/ - -TQImage TQImage::convertDepth( int depth, int conversion_flags ) const -{ - TQImage image; - if ( data->d == depth ) - image = *this; // no conversion -#ifndef TQT_NO_IMAGE_DITHER_TO_1 - else if ( (data->d == 8 || data->d == 32) && depth == 1 ) // dither - dither_to_1( this, &image, conversion_flags, FALSE ); -#endif -#ifndef TQT_NO_IMAGE_TRUECOLOR - else if ( data->d == 32 && depth == 8 ) // 32 -> 8 - convert_32_to_8( this, &image, conversion_flags ); - else if ( data->d == 8 && depth == 32 ) // 8 -> 32 - convert_8_to_32( this, &image ); -#endif - else if ( data->d == 1 && depth == 8 ) // 1 -> 8 - convert_1_to_8( this, &image ); -#ifndef TQT_NO_IMAGE_TRUECOLOR - else if ( data->d == 1 && depth == 32 ) // 1 -> 32 - convert_1_to_32( this, &image ); -#endif -#ifndef TQT_NO_IMAGE_16_BIT - else if ( data->d == 16 && depth != 16 ) { - TQImage tmp; - convert_16_to_32( this, &tmp ); - image = tmp.convertDepth( depth, conversion_flags ); - } else if ( data->d != 16 && depth == 16 ) { - TQImage tmp = convertDepth( 32, conversion_flags ); - convert_32_to_16( &tmp, &image ); - } -#endif - else { -#if defined(QT_CHECK_RANGE) - if ( isNull() ) - tqWarning( "TQImage::convertDepth: Image is a null image" ); - else - tqWarning( "TQImage::convertDepth: Depth %d not supported", depth ); -#endif - } - return image; -} - -/*! - \overload -*/ - -TQImage TQImage::convertDepth( int depth ) const -{ - return convertDepth( depth, 0 ); -} - -/*! - Returns TRUE if ( \a x, \a y ) is a valid coordinate in the image; - otherwise returns FALSE. - - \sa width() height() pixelIndex() -*/ - -bool TQImage::valid( int x, int y ) const -{ - return x >= 0 && x < width() - && y >= 0 && y < height(); -} - -/*! - Returns the pixel index at the given coordinates. - - If (\a x, \a y) is not \link valid() valid\endlink, or if the - image is not a paletted image (depth() \> 8), the results are - undefined. - - \sa valid() depth() -*/ - -int TQImage::pixelIndex( int x, int y ) const -{ -#if defined(QT_CHECK_RANGE) - if ( x < 0 || x >= width() ) { - tqWarning( "TQImage::pixel: x=%d out of range", x ); - return -12345; - } -#endif - uchar * s = scanLine( y ); - switch( depth() ) { - case 1: - if ( bitOrder() == TQImage::LittleEndian ) - return (*(s + (x >> 3)) >> (x & 7)) & 1; - else - return (*(s + (x >> 3)) >> (7- (x & 7))) & 1; - case 8: - return (int)s[x]; -#ifndef TQT_NO_IMAGE_TRUECOLOR -#ifndef TQT_NO_IMAGE_16_BIT - case 16: -#endif - case 32: -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::pixelIndex: Not applicable for %d-bpp images " - "(no palette)", depth() ); -#endif - return 0; -#endif //TQT_NO_IMAGE_TRUECOLOR - } - return 0; -} - - -/*! - Returns the color of the pixel at the coordinates (\a x, \a y). - - If (\a x, \a y) is not \link valid() on the image\endlink, the - results are undefined. - - \sa setPixel() tqRed() tqGreen() tqBlue() valid() -*/ - -TQRgb TQImage::pixel( int x, int y ) const -{ -#if defined(QT_CHECK_RANGE) - if ( x < 0 || x >= width() ) { - tqWarning( "TQImage::pixel: x=%d out of range", x ); - return 12345; - } -#endif - uchar * s = scanLine( y ); - switch( depth() ) { - case 1: - if ( bitOrder() == TQImage::LittleEndian ) - return color( (*(s + (x >> 3)) >> (x & 7)) & 1 ); - else - return color( (*(s + (x >> 3)) >> (7- (x & 7))) & 1 ); - case 8: - return color( (int)s[x] ); -#ifndef TQT_NO_IMAGE_16_BIT - case 16: - return qt_conv16ToRgb(((ushort*)s)[x]); -#endif -#ifndef TQT_NO_IMAGE_TRUECOLOR - case 32: - return ((TQRgb*)s)[x]; -#endif - default: - return 100367; - } -} - - -/*! - Sets the pixel index or color at the coordinates (\a x, \a y) to - \a index_or_rgb. - - If (\a x, \a y) is not \link valid() valid\endlink, the result is - undefined. - - If the image is a paletted image (depth() \<= 8) and \a - index_or_rgb \>= numColors(), the result is undefined. - - \sa pixelIndex() pixel() tqRgb() tqRgba() valid() -*/ - -void TQImage::setPixel( int x, int y, uint index_or_rgb ) -{ - if ( x < 0 || x >= width() ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::setPixel: x=%d out of range", x ); -#endif - return; - } - if ( depth() == 1 ) { - uchar * s = scanLine( y ); - if ( index_or_rgb > 1) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::setPixel: index=%d out of range", - index_or_rgb ); -#endif - } else if ( bitOrder() == TQImage::LittleEndian ) { - if (index_or_rgb==0) - *(s + (x >> 3)) &= ~(1 << (x & 7)); - else - *(s + (x >> 3)) |= (1 << (x & 7)); - } else { - if (index_or_rgb==0) - *(s + (x >> 3)) &= ~(1 << (7-(x & 7))); - else - *(s + (x >> 3)) |= (1 << (7-(x & 7))); - } - } else if ( depth() == 8 ) { - if (index_or_rgb > (uint)numColors()) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::setPixel: index=%d out of range", - index_or_rgb ); -#endif - return; - } - uchar * s = scanLine( y ); - s[x] = index_or_rgb; -#ifndef TQT_NO_IMAGE_16_BIT - } else if ( depth() == 16 ) { - ushort * s = (ushort*)scanLine( y ); - s[x] = qt_convRgbTo16(index_or_rgb); -#endif -#ifndef TQT_NO_IMAGE_TRUECOLOR - } else if ( depth() == 32 ) { - TQRgb * s = (TQRgb*)scanLine( y ); - s[x] = index_or_rgb; -#endif - } -} - - -/*! - Converts the bit order of the image to \a bitOrder and returns the - converted image. The original image is not changed. - - Returns \c *this if the \a bitOrder is equal to the image bit - order, or a \link isNull() null\endlink image if this image cannot - be converted. - - \sa bitOrder() systemBitOrder() isNull() -*/ - -TQImage TQImage::convertBitOrder( Endian bitOrder ) const -{ - if ( isNull() || data->d != 1 || // invalid argument(s) - !(bitOrder == BigEndian || bitOrder == LittleEndian) ) { - TQImage nullImage; - return nullImage; - } - if ( data->bitordr == bitOrder ) // nothing to do - return copy(); - - TQImage image( data->w, data->h, 1, data->ncols, bitOrder ); - - int bpl = (width() + 7) / 8; - for ( int y = 0; y < data->h; y++ ) { - uchar *p = jumpTable()[y]; - uchar *end = p + bpl; - uchar *b = image.jumpTable()[y]; - while ( p < end ) - *b++ = bitflip[*p++]; - } - memcpy( image.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); - return image; -} - -// ### Candidate (renamed) for ntqcolor.h -static -bool isGray(TQRgb c) -{ - return tqRed(c) == tqGreen(c) - && tqRed(c) == tqBlue(c); -} - -/*! - Returns TRUE if all the colors in the image are shades of gray - (i.e. their red, green and blue components are equal); otherwise - returns FALSE. - - This function is slow for large 16-bit (TQt/Embedded only) and 32-bit images. - - \sa isGrayscale() -*/ -bool TQImage::allGray() const -{ -#ifndef TQT_NO_IMAGE_TRUECOLOR - if (depth()==32) { - int p = width()*height(); - TQRgb* b = (TQRgb*)bits(); - while (p--) - if (!isGray(*b++)) - return FALSE; -#ifndef TQT_NO_IMAGE_16_BIT - } else if (depth()==16) { - int p = width()*height(); - ushort* b = (ushort*)bits(); - while (p--) - if (!is16BitGray(*b++)) - return FALSE; -#endif - } else -#endif //TQT_NO_IMAGE_TRUECOLOR - { - if (!data->ctbl) return TRUE; - for (int i=0; ictbl[i])) - return FALSE; - } - return TRUE; -} - -/*! - For 16-bit (TQt/Embedded only) and 32-bit images, this function is - equivalent to allGray(). - - For 8-bpp images, this function returns TRUE if color(i) is - TQRgb(i,i,i) for all indices of the color table; otherwise returns - FALSE. - - \sa allGray() depth() -*/ -bool TQImage::isGrayscale() const -{ - switch (depth()) { -#ifndef TQT_NO_IMAGE_TRUECOLOR - case 32: -#ifndef TQT_NO_IMAGE_16_BIT - case 16: -#endif - return allGray(); -#endif //TQT_NO_IMAGE_TRUECOLOR - case 8: { - for (int i=0; ictbl[i] != tqRgb(i,i,i)) - return FALSE; - return TRUE; - } - } - return FALSE; -} - -#ifndef TQT_NO_IMAGE_SMOOTHSCALE -static -void pnmscale(const TQImage& src, TQImage& dst) -{ - TQRgb* xelrow = 0; - TQRgb* tempxelrow = 0; - TQRgb* xP; - TQRgb* nxP; - int rows, cols, rowsread, newrows, newcols; - int row, col, needtoreadrow; - const uchar maxval = 255; - double xscale, yscale; - long sxscale, syscale; - long fracrowtofill, fracrowleft; - long* as; - long* rs; - long* gs; - long* bs; - int rowswritten = 0; - - cols = src.width(); - rows = src.height(); - newcols = dst.width(); - newrows = dst.height(); - - long SCALE; - long HALFSCALE; - - if (cols > 4096) - { - SCALE = 4096; - HALFSCALE = 2048; - } - else - { - int fac = 4096; - - while (cols * fac > 4096) - { - fac /= 2; - } - - SCALE = fac * cols; - HALFSCALE = fac * cols / 2; - } - - xscale = (double) newcols / (double) cols; - yscale = (double) newrows / (double) rows; - - sxscale = (long)(xscale * SCALE); - syscale = (long)(yscale * SCALE); - - if ( newrows != rows ) /* shortcut Y scaling if possible */ - tempxelrow = new TQRgb[cols]; - - if ( src.hasAlphaBuffer() ) { - dst.setAlphaBuffer(TRUE); - as = new long[cols]; - for ( col = 0; col < cols; ++col ) - as[col] = HALFSCALE; - } else { - as = 0; - } - rs = new long[cols]; - gs = new long[cols]; - bs = new long[cols]; - rowsread = 0; - fracrowleft = syscale; - needtoreadrow = 1; - for ( col = 0; col < cols; ++col ) - rs[col] = gs[col] = bs[col] = HALFSCALE; - fracrowtofill = SCALE; - - for ( row = 0; row < newrows; ++row ) { - /* First scale Y from xelrow into tempxelrow. */ - if ( newrows == rows ) { - /* shortcut Y scaling if possible */ - tempxelrow = xelrow = (TQRgb*)src.scanLine(rowsread++); - } else { - while ( fracrowleft < fracrowtofill ) { - if ( needtoreadrow && rowsread < rows ) - xelrow = (TQRgb*)src.scanLine(rowsread++); - for ( col = 0, xP = xelrow; col < cols; ++col, ++xP ) { - if (as) { - as[col] += fracrowleft * tqAlpha( *xP ); - rs[col] += fracrowleft * tqRed( *xP ) * tqAlpha( *xP ) / 255; - gs[col] += fracrowleft * tqGreen( *xP ) * tqAlpha( *xP ) / 255; - bs[col] += fracrowleft * tqBlue( *xP ) * tqAlpha( *xP ) / 255; - } else { - rs[col] += fracrowleft * tqRed( *xP ); - gs[col] += fracrowleft * tqGreen( *xP ); - bs[col] += fracrowleft * tqBlue( *xP ); - } - } - fracrowtofill -= fracrowleft; - fracrowleft = syscale; - needtoreadrow = 1; - } - /* Now fracrowleft is >= fracrowtofill, so we can produce a row. */ - if ( needtoreadrow && rowsread < rows ) { - xelrow = (TQRgb*)src.scanLine(rowsread++); - needtoreadrow = 0; - } - long a=0; - for ( col = 0, xP = xelrow, nxP = tempxelrow; - col < cols; ++col, ++xP, ++nxP ) - { - long r, g, b; - - if ( as ) { - r = rs[col] + fracrowtofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; - g = gs[col] + fracrowtofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; - b = bs[col] + fracrowtofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; - a = as[col] + fracrowtofill * tqAlpha( *xP ); - if ( a ) { - r = r * 255 / a * SCALE; - g = g * 255 / a * SCALE; - b = b * 255 / a * SCALE; - } - } else { - r = rs[col] + fracrowtofill * tqRed( *xP ); - g = gs[col] + fracrowtofill * tqGreen( *xP ); - b = bs[col] + fracrowtofill * tqBlue( *xP ); - } - r /= SCALE; - if ( r > maxval ) r = maxval; - g /= SCALE; - if ( g > maxval ) g = maxval; - b /= SCALE; - if ( b > maxval ) b = maxval; - if ( as ) { - a /= SCALE; - if ( a > maxval ) a = maxval; - *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); - as[col] = HALFSCALE; - } else { - *nxP = tqRgb( (int)r, (int)g, (int)b ); - } - rs[col] = gs[col] = bs[col] = HALFSCALE; - } - fracrowleft -= fracrowtofill; - if ( fracrowleft == 0 ) { - fracrowleft = syscale; - needtoreadrow = 1; - } - fracrowtofill = SCALE; - } - - /* Now scale X from tempxelrow into dst and write it out. */ - if ( newcols == cols ) { - /* shortcut X scaling if possible */ - memcpy(dst.scanLine(rowswritten++), tempxelrow, newcols*4); - } else { - long a, r, g, b; - long fraccoltofill, fraccolleft = 0; - int needcol; - - nxP = (TQRgb*)dst.scanLine(rowswritten++); - fraccoltofill = SCALE; - a = r = g = b = HALFSCALE; - needcol = 0; - for ( col = 0, xP = tempxelrow; col < cols; ++col, ++xP ) { - fraccolleft = sxscale; - while ( fraccolleft >= fraccoltofill ) { - if ( needcol ) { - ++nxP; - a = r = g = b = HALFSCALE; - } - if ( as ) { - r += fraccoltofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; - g += fraccoltofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; - b += fraccoltofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; - a += fraccoltofill * tqAlpha( *xP ); - if ( a ) { - r = r * 255 / a * SCALE; - g = g * 255 / a * SCALE; - b = b * 255 / a * SCALE; - } - } else { - r += fraccoltofill * tqRed( *xP ); - g += fraccoltofill * tqGreen( *xP ); - b += fraccoltofill * tqBlue( *xP ); - } - r /= SCALE; - if ( r > maxval ) r = maxval; - g /= SCALE; - if ( g > maxval ) g = maxval; - b /= SCALE; - if ( b > maxval ) b = maxval; - if (as) { - a /= SCALE; - if ( a > maxval ) a = maxval; - *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); - } else { - *nxP = tqRgb( (int)r, (int)g, (int)b ); - } - fraccolleft -= fraccoltofill; - fraccoltofill = SCALE; - needcol = 1; - } - if ( fraccolleft > 0 ) { - if ( needcol ) { - ++nxP; - a = r = g = b = HALFSCALE; - needcol = 0; - } - if (as) { - a += fraccolleft * tqAlpha( *xP ); - r += fraccolleft * tqRed( *xP ) * tqAlpha( *xP ) / 255; - g += fraccolleft * tqGreen( *xP ) * tqAlpha( *xP ) / 255; - b += fraccolleft * tqBlue( *xP ) * tqAlpha( *xP ) / 255; - } else { - r += fraccolleft * tqRed( *xP ); - g += fraccolleft * tqGreen( *xP ); - b += fraccolleft * tqBlue( *xP ); - } - fraccoltofill -= fraccolleft; - } - } - if ( fraccoltofill > 0 ) { - --xP; - if (as) { - a += fraccolleft * tqAlpha( *xP ); - r += fraccoltofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; - g += fraccoltofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; - b += fraccoltofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; - if ( a ) { - r = r * 255 / a * SCALE; - g = g * 255 / a * SCALE; - b = b * 255 / a * SCALE; - } - } else { - r += fraccoltofill * tqRed( *xP ); - g += fraccoltofill * tqGreen( *xP ); - b += fraccoltofill * tqBlue( *xP ); - } - } - if ( ! needcol ) { - r /= SCALE; - if ( r > maxval ) r = maxval; - g /= SCALE; - if ( g > maxval ) g = maxval; - b /= SCALE; - if ( b > maxval ) b = maxval; - if (as) { - a /= SCALE; - if ( a > maxval ) a = maxval; - *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); - } else { - *nxP = tqRgb( (int)r, (int)g, (int)b ); - } - } - } - } - - if ( newrows != rows && tempxelrow )// Robust, tempxelrow might be 0 1 day - delete [] tempxelrow; - if ( as ) // Avoid purify complaint - delete [] as; - if ( rs ) // Robust, rs might be 0 one day - delete [] rs; - if ( gs ) // Robust, gs might be 0 one day - delete [] gs; - if ( bs ) // Robust, bs might be 0 one day - delete [] bs; -} -#endif - -/*! - \enum TQImage::ScaleMode - - The functions scale() and smoothScale() use different modes for - scaling the image. The purpose of these modes is to retain the - ratio of the image if this is required. - - \img scaling.png - - \value ScaleFree The image is scaled freely: the resulting image - fits exactly into the specified size; the ratio will not - necessarily be preserved. - \value ScaleMin The ratio of the image is preserved and the - resulting image is guaranteed to fit into the specified size - (it is as large as possible within these constraints) - the - image might be smaller than the requested size. - \value ScaleMax The ratio of the image is preserved and the - resulting image fills the whole specified rectangle (it is as - small as possible within these constraints) - the image might - be larger than the requested size. -*/ - -#ifndef TQT_NO_IMAGE_SMOOTHSCALE -/*! - Returns a smoothly scaled copy of the image. The returned image - has a size of width \a w by height \a h pixels if \a mode is \c - ScaleFree. The modes \c ScaleMin and \c ScaleMax may be used to - preserve the ratio of the image: if \a mode is \c ScaleMin, the - returned image is guaranteed to fit into the rectangle specified - by \a w and \a h (it is as large as possible within the - constraints); if \a mode is \c ScaleMax, the returned image fits - at least into the specified rectangle (it is a small as possible - within the constraints). - - For 32-bpp images and 1-bpp/8-bpp color images the result will be - 32-bpp, whereas \link allGray() all-gray \endlink images - (including black-and-white 1-bpp) will produce 8-bit \link - isGrayscale() grayscale \endlink images with the palette spanning - 256 grays from black to white. - - This function uses code based on pnmscale.c by Jef Poskanzer. - - pnmscale.c - read a portable anymap and scale it - - \legalese - - Copyright (C) 1989, 1991 by Jef Poskanzer. - - Permission to use, copy, modify, and distribute this software and - its documentation for any purpose and without fee is hereby - granted, provided that the above copyright notice appear in all - copies and that both that copyright notice and this permission - notice appear in supporting documentation. This software is - provided "as is" without express or implied warranty. - - \sa scale() mirror() -*/ -TQImage TQImage::smoothScale( int w, int h, ScaleMode mode ) const -{ - return smoothScale( TQSize( w, h ), mode ); -} -#endif - -#ifndef TQT_NO_IMAGE_SMOOTHSCALE -/*! - \overload - - The requested size of the image is \a s. -*/ -TQImage TQImage::smoothScale( const TQSize& s, ScaleMode mode ) const -{ - if ( isNull() ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::smoothScale: Image is a null image" ); -#endif - return copy(); - } - - TQSize newSize = size(); - newSize.scale( s, (TQSize::ScaleMode)mode ); // ### remove cast in TQt 4.0 - if ( newSize == size() ) - return copy(); - - if ( depth() == 32 ) { - TQImage img( newSize, 32 ); - // 32-bpp to 32-bpp - pnmscale( *this, img ); - return img; - } else if ( depth() != 16 && allGray() && !hasAlphaBuffer() ) { - // Inefficient - return convertDepth(32).smoothScale(newSize, mode).convertDepth(8); - } else { - // Inefficient - return convertDepth(32).smoothScale(newSize, mode); - } -} -#endif - -/*! - Returns a copy of the image scaled to a rectangle of width \a w - and height \a h according to the ScaleMode \a mode. - - \list - \i If \a mode is \c ScaleFree, the image is scaled to (\a w, - \a h). - \i If \a mode is \c ScaleMin, the image is scaled to a rectangle - as large as possible inside (\a w, \a h), preserving the aspect - ratio. - \i If \a mode is \c ScaleMax, the image is scaled to a rectangle - as small as possible outside (\a w, \a h), preserving the aspect - ratio. - \endlist - - If either the width \a w or the height \a h is 0 or negative, this - function returns a \link isNull() null\endlink image. - - This function uses a simple, fast algorithm. If you need better - quality, use smoothScale() instead. - - \sa scaleWidth() scaleHeight() smoothScale() xForm() -*/ -#ifndef TQT_NO_IMAGE_TRANSFORMATION -TQImage TQImage::scale( int w, int h, ScaleMode mode ) const -{ - return scale( TQSize( w, h ), mode ); -} -#endif - -/*! - \overload - - The requested size of the image is \a s. -*/ -#ifndef TQT_NO_IMAGE_TRANSFORMATION -TQImage TQImage::scale( const TQSize& s, ScaleMode mode ) const -{ - if ( isNull() ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::scale: Image is a null image" ); -#endif - return copy(); - } - if ( s.isEmpty() ) - return TQImage(); - - TQSize newSize = size(); - newSize.scale( s, (TQSize::ScaleMode)mode ); // ### remove cast in TQt 4.0 - if ( newSize == size() ) - return copy(); - - TQImage img; - TQWMatrix wm; - wm.scale( (double)newSize.width() / width(), (double)newSize.height() / height() ); - img = xForm( wm ); - // ### I should test and resize the image if it has not the right size -// if ( img.width() != newSize.width() || img.height() != newSize.height() ) -// img.resize( newSize.width(), newSize.height() ); - return img; -} -#endif - -/*! - Returns a scaled copy of the image. The returned image has a width - of \a w pixels. This function automatically calculates the height - of the image so that the ratio of the image is preserved. - - If \a w is 0 or negative a \link isNull() null\endlink image is - returned. - - \sa scale() scaleHeight() smoothScale() xForm() -*/ -#ifndef TQT_NO_IMAGE_TRANSFORMATION -TQImage TQImage::scaleWidth( int w ) const -{ - if ( isNull() ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::scaleWidth: Image is a null image" ); -#endif - return copy(); - } - if ( w <= 0 ) - return TQImage(); - - TQWMatrix wm; - double factor = (double) w / width(); - wm.scale( factor, factor ); - return xForm( wm ); -} -#endif - -/*! - Returns a scaled copy of the image. The returned image has a - height of \a h pixels. This function automatically calculates the - width of the image so that the ratio of the image is preserved. - - If \a h is 0 or negative a \link isNull() null\endlink image is - returned. - - \sa scale() scaleWidth() smoothScale() xForm() -*/ -#ifndef TQT_NO_IMAGE_TRANSFORMATION -TQImage TQImage::scaleHeight( int h ) const -{ - if ( isNull() ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage::scaleHeight: Image is a null image" ); -#endif - return copy(); - } - if ( h <= 0 ) - return TQImage(); - - TQWMatrix wm; - double factor = (double) h / height(); - wm.scale( factor, factor ); - return xForm( wm ); -} -#endif - - -/*! - Returns a copy of the image that is transformed using the - transformation matrix, \a matrix. - - The transformation \a matrix is internally adjusted to compensate - for unwanted translation, i.e. xForm() returns the smallest image - that contains all the transformed points of the original image. - - \sa scale() TQPixmap::xForm() TQPixmap::trueMatrix() TQWMatrix -*/ -#ifndef TQT_NO_IMAGE_TRANSFORMATION -TQImage TQImage::xForm( const TQWMatrix &matrix ) const -{ - // This function uses the same algorithm as (and steals quite some - // code from) TQPixmap::xForm(). - - if ( isNull() ) - return copy(); - - if ( depth() == 16 ) { - // inefficient - return convertDepth( 32 ).xForm( matrix ); - } - - // source image data - int ws = width(); - int hs = height(); - int sbpl = bytesPerLine(); - uchar *sptr = bits(); - - // target image data - int wd; - int hd; - - int bpp = depth(); - - // compute size of target image - TQWMatrix mat = TQPixmap::trueMatrix( matrix, ws, hs ); - if ( mat.m12() == 0.0F && mat.m21() == 0.0F ) { - if ( mat.m11() == 1.0F && mat.m22() == 1.0F ) // identity matrix - return copy(); - hd = tqRound( mat.m22() * hs ); - wd = tqRound( mat.m11() * ws ); - hd = TQABS( hd ); - wd = TQABS( wd ); - } else { // rotation or shearing - TQPointArray a( TQRect(0, 0, ws, hs) ); - a = mat.map( a ); - TQRect r = a.boundingRect().normalize(); - wd = r.width(); - hd = r.height(); - } - - bool invertible; - mat = mat.invert( &invertible ); // invert matrix - if ( hd == 0 || wd == 0 || !invertible ) // error, return null image - return TQImage(); - - // create target image (some of the code is from TQImage::copy()) - TQImage dImage( wd, hd, depth(), numColors(), bitOrder() ); - - // If the image allocation failed, we need to gracefully abort. - if (dImage.isNull()) - return dImage; - - memcpy( dImage.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); - dImage.setAlphaBuffer( hasAlphaBuffer() ); - dImage.data->dpmx = dotsPerMeterX(); - dImage.data->dpmy = dotsPerMeterY(); - - switch ( bpp ) { - // initizialize the data - case 1: - memset( dImage.bits(), 0, dImage.numBytes() ); - break; - case 8: - if ( dImage.data->ncols < 256 ) { - // colors are left in the color table, so pick that one as transparent - dImage.setNumColors( dImage.data->ncols+1 ); - dImage.setColor( dImage.data->ncols-1, 0x00 ); - memset( dImage.bits(), dImage.data->ncols-1, dImage.numBytes() ); - } else { - memset( dImage.bits(), 0, dImage.numBytes() ); - } - break; - case 16: - memset( dImage.bits(), 0xff, dImage.numBytes() ); - break; - case 32: - memset( dImage.bits(), 0x00, dImage.numBytes() ); - break; - } - - int type; - if ( bitOrder() == BigEndian ) - type = QT_XFORM_TYPE_MSBFIRST; - else - type = QT_XFORM_TYPE_LSBFIRST; - int dbpl = dImage.bytesPerLine(); - qt_xForm_helper( mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, - ws, hs ); - return dImage; -} -#endif - -/*! - Builds and returns a 1-bpp mask from the alpha buffer in this - image. Returns a \link isNull() null\endlink image if \link - setAlphaBuffer() alpha buffer mode\endlink is disabled. - - See TQPixmap::convertFromImage() for a description of the \a - conversion_flags argument. - - The returned image has little-endian bit order, which you can - convert to big-endianness using convertBitOrder(). - - \sa createHeuristicMask() hasAlphaBuffer() setAlphaBuffer() -*/ -#ifndef TQT_NO_IMAGE_DITHER_TO_1 -TQImage TQImage::createAlphaMask( int conversion_flags ) const -{ - if ( conversion_flags == 1 ) { - // Old code is passing "TRUE". - conversion_flags = TQt::DiffuseAlphaDither; - } - - if ( isNull() || !hasAlphaBuffer() ) - return TQImage(); - - if ( depth() == 1 ) { - // A monochrome pixmap, with alpha channels on those two colors. - // Pretty unlikely, so use less efficient solution. - return convertDepth(8, conversion_flags) - .createAlphaMask( conversion_flags ); - } - - TQImage mask1; - dither_to_1( this, &mask1, conversion_flags, TRUE ); - return mask1; -} -#endif - -#ifndef TQT_NO_IMAGE_HEURISTIC_MASK -/*! - Creates and returns a 1-bpp heuristic mask for this image. It - works by selecting a color from one of the corners, then chipping - away pixels of that color starting at all the edges. - - The four corners vote for which color is to be masked away. In - case of a draw (this generally means that this function is not - applicable to the image), the result is arbitrary. - - The returned image has little-endian bit order, which you can - convert to big-endianness using convertBitOrder(). - - If \a clipTight is TRUE the mask is just large enough to cover the - pixels; otherwise, the mask is larger than the data pixels. - - This function disregards the \link hasAlphaBuffer() alpha buffer - \endlink. - - \sa createAlphaMask() -*/ - -TQImage TQImage::createHeuristicMask( bool clipTight ) const -{ - if ( isNull() ) { - TQImage nullImage; - return nullImage; - } - if ( depth() != 32 ) { - TQImage img32 = convertDepth(32); - return img32.createHeuristicMask(clipTight); - } - -#define PIX(x,y) (*((TQRgb*)scanLine(y)+x) & 0x00ffffff) - - int w = width(); - int h = height(); - TQImage m(w, h, 1, 2, TQImage::LittleEndian); - m.setColor( 0, 0xffffff ); - m.setColor( 1, 0 ); - m.fill( 0xff ); - - TQRgb background = PIX(0,0); - if ( background != PIX(w-1,0) && - background != PIX(0,h-1) && - background != PIX(w-1,h-1) ) { - background = PIX(w-1,0); - if ( background != PIX(w-1,h-1) && - background != PIX(0,h-1) && - PIX(0,h-1) == PIX(w-1,h-1) ) { - background = PIX(w-1,h-1); - } - } - - int x,y; - bool done = FALSE; - uchar *ypp, *ypc, *ypn; - while( !done ) { - done = TRUE; - ypn = m.scanLine(0); - ypc = 0; - for ( y = 0; y < h; y++ ) { - ypp = ypc; - ypc = ypn; - ypn = (y == h-1) ? 0 : m.scanLine(y+1); - TQRgb *p = (TQRgb *)scanLine(y); - for ( x = 0; x < w; x++ ) { - // slowness here - it's possible to do six of these tests - // together in one go. oh well. - if ( ( x == 0 || y == 0 || x == w-1 || y == h-1 || - !(*(ypc + ((x-1) >> 3)) & (1 << ((x-1) & 7))) || - !(*(ypc + ((x+1) >> 3)) & (1 << ((x+1) & 7))) || - !(*(ypp + (x >> 3)) & (1 << (x & 7))) || - !(*(ypn + (x >> 3)) & (1 << (x & 7))) ) && - ( (*(ypc + (x >> 3)) & (1 << (x & 7))) ) && - ( (*p & 0x00ffffff) == background ) ) { - done = FALSE; - *(ypc + (x >> 3)) &= ~(1 << (x & 7)); - } - p++; - } - } - } - - if ( !clipTight ) { - ypn = m.scanLine(0); - ypc = 0; - for ( y = 0; y < h; y++ ) { - ypp = ypc; - ypc = ypn; - ypn = (y == h-1) ? 0 : m.scanLine(y+1); - TQRgb *p = (TQRgb *)scanLine(y); - for ( x = 0; x < w; x++ ) { - if ( (*p & 0x00ffffff) != background ) { - if ( x > 0 ) - *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7)); - if ( x < w-1 ) - *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7)); - if ( y > 0 ) - *(ypp + (x >> 3)) |= (1 << (x & 7)); - if ( y < h-1 ) - *(ypn + (x >> 3)) |= (1 << (x & 7)); - } - p++; - } - } - } - -#undef PIX - - return m; -} -#endif //TQT_NO_IMAGE_HEURISTIC_MASK - -#ifndef TQT_NO_IMAGE_MIRROR -/* - This code is contributed by Philipp Lang, - GeneriCom Software Germany (www.generi.com) - under the terms of the TQPL, Version 1.0 -*/ - -/*! - \overload - - Returns a mirror of the image, mirrored in the horizontal and/or - the vertical direction depending on whether \a horizontal and \a - vertical are set to TRUE or FALSE. The original image is not - changed. - - \sa smoothScale() -*/ -TQImage TQImage::mirror(bool horizontal, bool vertical) const -{ - int w = width(); - int h = height(); - if ( (w <= 1 && h <= 1) || (!horizontal && !vertical) ) - return copy(); - - // Create result image, copy colormap - TQImage result(w, h, depth(), numColors(), bitOrder()); - memcpy(result.colorTable(), colorTable(), numColors()*sizeof(TQRgb)); - result.setAlphaBuffer(hasAlphaBuffer()); - - if (depth() == 1) - w = (w+7)/8; - int dxi = horizontal ? -1 : 1; - int dxs = horizontal ? w-1 : 0; - int dyi = vertical ? -1 : 1; - int dy = vertical ? h-1: 0; - - // 1 bit, 8 bit - if (depth() == 1 || depth() == 8) { - for (int sy = 0; sy < h; sy++, dy += dyi) { - TQ_UINT8* ssl = (TQ_UINT8*)(data->bits[sy]); - TQ_UINT8* dsl = (TQ_UINT8*)(result.data->bits[dy]); - int dx = dxs; - for (int sx = 0; sx < w; sx++, dx += dxi) - dsl[dx] = ssl[sx]; - } - } -#ifndef TQT_NO_IMAGE_TRUECOLOR -#ifndef TQT_NO_IMAGE_16_BIT - // 16 bit - else if (depth() == 16) { - for (int sy = 0; sy < h; sy++, dy += dyi) { - TQ_UINT16* ssl = (TQ_UINT16*)(data->bits[sy]); - TQ_UINT16* dsl = (TQ_UINT16*)(result.data->bits[dy]); - int dx = dxs; - for (int sx = 0; sx < w; sx++, dx += dxi) - dsl[dx] = ssl[sx]; - } - } -#endif - // 32 bit - else if (depth() == 32) { - for (int sy = 0; sy < h; sy++, dy += dyi) { - TQ_UINT32* ssl = (TQ_UINT32*)(data->bits[sy]); - TQ_UINT32* dsl = (TQ_UINT32*)(result.data->bits[dy]); - int dx = dxs; - for (int sx = 0; sx < w; sx++, dx += dxi) - dsl[dx] = ssl[sx]; - } - } -#endif - - // special handling of 1 bit images for horizontal mirroring - if (horizontal && depth() == 1) { - int shift = width() % 8; - for (int y = h-1; y >= 0; y--) { - TQ_UINT8* a0 = (TQ_UINT8*)(result.data->bits[y]); - // Swap bytes - TQ_UINT8* a = a0+dxs; - while (a >= a0) { - *a = bitflip[*a]; - a--; - } - // Shift bits if unaligned - if (shift != 0) { - a = a0+dxs; - TQ_UINT8 c = 0; - if (bitOrder() == TQImage::LittleEndian) { - while (a >= a0) { - TQ_UINT8 nc = *a << shift; - *a = (*a >> (8-shift)) | c; - --a; - c = nc; - } - } else { - while (a >= a0) { - TQ_UINT8 nc = *a >> shift; - *a = (*a << (8-shift)) | c; - --a; - c = nc; - } - } - } - } - } - - return result; -} - -/*! - Returns a TQImage which is a vertically mirrored copy of this - image. The original TQImage is not changed. -*/ - -TQImage TQImage::mirror() const -{ - return mirror(FALSE,TRUE); -} -#endif //TQT_NO_IMAGE_MIRROR - -/*! - Returns a TQImage in which the values of the red and blue - components of all pixels have been swapped, effectively converting - an RGB image to a BGR image. The original TQImage is not changed. -*/ - -TQImage TQImage::swapRGB() const -{ - TQImage res = copy(); - if ( !isNull() ) { -#ifndef TQT_NO_IMAGE_TRUECOLOR - if ( depth() == 32 ) { - for ( int i=0; i < height(); i++ ) { - uint *p = (uint*)scanLine( i ); - uint *q = (uint*)res.scanLine( i ); - uint *end = p + width(); - while ( p < end ) { - *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | - (*p & 0xff00ff00); - p++; - q++; - } - } -#ifndef TQT_NO_IMAGE_16_BIT - } else if ( depth() == 16 ) { - tqWarning( "TQImage::swapRGB not implemented for 16bpp" ); -#endif - } else -#endif //TQT_NO_IMAGE_TRUECOLOR - { - uint* p = (uint*)colorTable(); - uint* q = (uint*)res.colorTable(); - if ( p && q ) { - for ( int i=0; i < numColors(); i++ ) { - *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | - (*p & 0xff00ff00); - p++; - q++; - } - } - } - } - return res; -} - -#ifndef TQT_NO_IMAGEIO -/*! - Returns a string that specifies the image format of the file \a - fileName, or 0 if the file cannot be read or if the format is not - recognized. - - The TQImageIO documentation lists the guaranteed supported image - formats, or use TQImage::inputFormats() and TQImage::outputFormats() - to get lists that include the installed formats. - - \sa load() save() -*/ - -const char* TQImage::imageFormat( const TQString &fileName ) -{ - return TQImageIO::imageFormat( fileName ); -} - -/*! - Returns a list of image formats that are supported for image - input. - - \sa outputFormats() inputFormatList() TQImageIO -*/ -TQStrList TQImage::inputFormats() -{ - return TQImageIO::inputFormats(); -} -#ifndef TQT_NO_STRINGLIST -/*! - Returns a list of image formats that are supported for image - input. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - TQStringList list = myImage.inputFormatList(); - TQStringList::Iterator it = list.begin(); - while( it != list.end() ) { - myProcessing( *it ); - ++it; - } - \endcode - - \sa outputFormatList() inputFormats() TQImageIO -*/ -TQStringList TQImage::inputFormatList() -{ - return TQStringList::fromStrList(TQImageIO::inputFormats()); -} - - -/*! - Returns a list of image formats that are supported for image - output. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - TQStringList list = myImage.outputFormatList(); - TQStringList::Iterator it = list.begin(); - while( it != list.end() ) { - myProcessing( *it ); - ++it; - } - \endcode - - \sa inputFormatList() outputFormats() TQImageIO -*/ -TQStringList TQImage::outputFormatList() -{ - return TQStringList::fromStrList(TQImageIO::outputFormats()); -} -#endif //TQT_NO_STRINGLIST - -/*! - Returns a list of image formats that are supported for image - output. - - \sa inputFormats() outputFormatList() TQImageIO -*/ -TQStrList TQImage::outputFormats() -{ - return TQImageIO::outputFormats(); -} - - -/*! - Loads an image from the file \a fileName. Returns TRUE if the - image was successfully loaded; otherwise returns FALSE. - - If \a format is specified, the loader attempts to read the image - using the specified format. If \a format is not specified (which - is the default), the loader reads a few bytes from the header to - guess the file format. - - The TQImageIO documentation lists the supported image formats and - explains how to add extra formats. - - \sa loadFromData() save() imageFormat() TQPixmap::load() TQImageIO -*/ - -bool TQImage::load( const TQString &fileName, const char* format ) -{ - TQImageIO io( fileName, format ); - bool result = io.read(); - if ( result ) - operator=( io.image() ); - return result; -} - -/*! - Loads an image from the first \a len bytes of binary data in \a - buf. Returns TRUE if the image was successfully loaded; otherwise - returns FALSE. - - If \a format is specified, the loader attempts to read the image - using the specified format. If \a format is not specified (which - is the default), the loader reads a few bytes from the header to - guess the file format. - - The TQImageIO documentation lists the supported image formats and - explains how to add extra formats. - - \sa load() save() imageFormat() TQPixmap::loadFromData() TQImageIO -*/ - -bool TQImage::loadFromData( const uchar *buf, uint len, const char *format ) -{ - TQByteArray a; - a.setRawData( (char *)buf, len ); - TQBuffer b( a ); - b.open( IO_ReadOnly ); - TQImageIO io( &b, format ); - bool result = io.read(); - b.close(); - a.resetRawData( (char *)buf, len ); - if ( result ) - operator=( io.image() ); - return result; -} - -/*! - \overload - - Loads an image from the TQByteArray \a buf. -*/ -bool TQImage::loadFromData( TQByteArray buf, const char *format ) -{ - return loadFromData( (const uchar *)(buf.data()), buf.size(), format ); -} - -/*! - Saves the image to the file \a fileName, using the image file - format \a format and a quality factor of \a quality. \a quality - must be in the range 0..100 or -1. Specify 0 to obtain small - compressed files, 100 for large uncompressed files, and -1 (the - default) to use the default settings. - - Returns TRUE if the image was successfully saved; otherwise - returns FALSE. - - \sa load() loadFromData() imageFormat() TQPixmap::save() TQImageIO -*/ - -bool TQImage::save( const TQString &fileName, const char* format, int quality ) const -{ - if ( isNull() ) - return FALSE; // nothing to save - TQImageIO io( fileName, format ); - return doImageIO( &io, quality ); -} - -/*! - \overload - - This function writes a TQImage to the TQIODevice, \a device. This - can be used, for example, to save an image directly into a - TQByteArray: - \code - TQImage image; - TQByteArray ba; - TQBuffer buffer( ba ); - buffer.open( IO_WriteOnly ); - image.save( &buffer, "PNG" ); // writes image into ba in PNG format - \endcode -*/ - -bool TQImage::save( TQIODevice* device, const char* format, int quality ) const -{ - if ( isNull() ) - return FALSE; // nothing to save - TQImageIO io( device, format ); - return doImageIO( &io, quality ); -} - -/* \internal -*/ - -bool TQImage::doImageIO( TQImageIO* io, int quality ) const -{ - if ( !io ) - return FALSE; - io->setImage( *this ); -#if defined(QT_CHECK_RANGE) - if ( quality > 100 || quality < -1 ) - tqWarning( "TQPixmap::save: quality out of range [-1,100]" ); -#endif - if ( quality >= 0 ) - io->setQuality( TQMIN(quality,100) ); - return io->write(); -} -#endif //TQT_NO_IMAGEIO - -/***************************************************************************** - TQImage stream functions - *****************************************************************************/ -#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO) -/*! - \relates TQImage - - Writes the image \a image to the stream \a s as a PNG image, or as a - BMP image if the stream's version is 1. - - Note that writing the stream to a file will not produce a valid image file. - - \sa TQImage::save() - \link datastreamformat.html Format of the TQDataStream operators \endlink -*/ - -TQDataStream &operator<<( TQDataStream &s, const TQImage &image ) -{ - if ( s.version() >= 5 ) { - if ( image.isNull() ) { - s << (TQ_INT32) 0; // null image marker - return s; - } else { - s << (TQ_INT32) 1; - // continue ... - } - } - TQImageIO io; - io.setIODevice( s.device() ); - if ( s.version() == 1 ) - io.setFormat( "BMP" ); - else - io.setFormat( "PNG" ); - - io.setImage( image ); - io.write(); - return s; -} - -/*! - \relates TQImage - - Reads an image from the stream \a s and stores it in \a image. - - \sa TQImage::load() - \link datastreamformat.html Format of the TQDataStream operators \endlink -*/ - -TQDataStream &operator>>( TQDataStream &s, TQImage &image ) -{ - if ( s.version() >= 5 ) { - TQ_INT32 nullMarker; - s >> nullMarker; - if ( !nullMarker ) { - image = TQImage(); // null image - return s; - } - } - TQImageIO io( s.device(), 0 ); - if ( io.read() ) - image = io.image(); - return s; -} -#endif - -/***************************************************************************** - Standard image io handlers (defined below) - *****************************************************************************/ - -// standard image io handlers (defined below) -#ifndef TQT_NO_IMAGEIO_BMP -static void read_bmp_image( TQImageIO * ); -static void write_bmp_image( TQImageIO * ); -#endif -#ifndef TQT_NO_IMAGEIO_PPM -static void read_pbm_image( TQImageIO * ); -static void write_pbm_image( TQImageIO * ); -#endif -#ifndef TQT_NO_IMAGEIO_XBM -static void read_xbm_image( TQImageIO * ); -static void write_xbm_image( TQImageIO * ); -#endif -#ifndef TQT_NO_IMAGEIO_XPM -static void read_xpm_image( TQImageIO * ); -static void write_xpm_image( TQImageIO * ); -#endif - -#ifndef TQT_NO_ASYNC_IMAGE_IO -static void read_async_image( TQImageIO * ); // Not in table of handlers -#endif - -/***************************************************************************** - Misc. utility functions - *****************************************************************************/ -#if !defined(TQT_NO_IMAGEIO_XPM) || !defined(TQT_NO_IMAGEIO_XBM) -static TQString fbname( const TQString &fileName ) // get file basename (sort of) -{ - TQString s = fileName; - if ( !s.isEmpty() ) { - int i; - if ( (i = s.findRev('/')) >= 0 ) - s = s.mid( i ); - if ( (i = s.findRev('\\')) >= 0 ) - s = s.mid( i ); - TQRegExp r( TQString::fromLatin1("[a-zA-Z][a-zA-Z0-9_]*") ); - int p = r.search( s ); - if ( p == -1 ) - s.truncate( 0 ); - else - s = s.mid( p, r.matchedLength() ); - } - if ( s.isEmpty() ) - s = TQString::fromLatin1( "dummy" ); - return s; -} -#endif - -#ifndef TQT_NO_IMAGEIO_BMP -static void swapPixel01( TQImage *image ) // 1-bpp: swap 0 and 1 pixels -{ - int i; - if ( image->depth() == 1 && image->numColors() == 2 ) { - uint *p = (uint *)image->bits(); - int nbytes = image->numBytes(); - for ( i=0; icolor(0); // swap color 0 and 1 - image->setColor( 0, image->color(1) ); - image->setColor( 1, t ); - } -} -#endif - - -/***************************************************************************** - TQImageIO member functions - *****************************************************************************/ - -/*! - \class TQImageIO ntqimage.h - - \brief The TQImageIO class contains parameters for loading and - saving images. - - \ingroup images - \ingroup graphics - \ingroup io - - TQImageIO contains a TQIODevice object that is used for image data - I/O. The programmer can install new image file formats in addition - to those that TQt provides. - - TQt currently supports the following image file formats: PNG, BMP, - XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if - specially configured during compilation. The different PNM formats - are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6). - - You don't normally need to use this class; TQPixmap::load(), - TQPixmap::save(), and TQImage contain sufficient functionality. - - For image files that contain sequences of images, only the first - is read. See TQMovie for loading multiple images. - - PBM, PGM, and PPM format \e output is always in the more condensed - raw format. PPM and PGM files with more than 256 levels of - intensity are scaled down when reading. - - \warning If you are in a country which recognizes software patents - and in which Unisys holds a patent on LZW compression and/or - decompression and you want to use GIF, Unisys may require you to - license the technology. Such countries include Canada, Japan, the - USA, France, Germany, Italy and the UK. - - GIF support may be removed completely in a future version of TQt. - We recommend using the PNG format. - - \sa TQImage TQPixmap TQFile TQMovie -*/ - -#ifndef TQT_NO_IMAGEIO -struct TQImageIOData -{ - const char *parameters; - int quality; - float gamma; -}; - -/*! - Constructs a TQImageIO object with all parameters set to zero. -*/ - -TQImageIO::TQImageIO() -{ - init(); -} - -/*! - Constructs a TQImageIO object with the I/O device \a ioDevice and a - \a format tag. -*/ - -TQImageIO::TQImageIO( TQIODevice *ioDevice, const char *format ) - : frmt(format) -{ - init(); - iodev = ioDevice; -} - -/*! - Constructs a TQImageIO object with the file name \a fileName and a - \a format tag. -*/ - -TQImageIO::TQImageIO( const TQString &fileName, const char* format ) - : frmt(format), fname(fileName) -{ - init(); -} - -/*! - Contains initialization common to all TQImageIO constructors. -*/ - -void TQImageIO::init() -{ - d = new TQImageIOData(); - d->parameters = 0; - d->quality = -1; // default quality of the current format - d->gamma=0.0f; - iostat = 0; - iodev = 0; -} - -/*! - Destroys the object and all related data. -*/ - -TQImageIO::~TQImageIO() -{ - if ( d->parameters ) - delete [] (char*)d->parameters; - delete d; -} - - -/***************************************************************************** - TQImageIO image handler functions - *****************************************************************************/ - -class TQImageHandler -{ -public: - TQImageHandler( const char *f, const char *h, const TQCString& fl, - image_io_handler r, image_io_handler w ); - TQCString format; // image format - TQRegExp header; // image header pattern - enum TMode { Untranslated=0, TranslateIn, TranslateInOut } text_mode; - image_io_handler read_image; // image read function - image_io_handler write_image; // image write function - bool obsolete; // support not "published" -}; - -TQImageHandler::TQImageHandler( const char *f, const char *h, const TQCString& fl, - image_io_handler r, image_io_handler w ) - : format(f), header(TQString::fromLatin1(h)) -{ - text_mode = Untranslated; - if ( fl.contains('t') ) - text_mode = TranslateIn; - else if ( fl.contains('T') ) - text_mode = TranslateInOut; - obsolete = fl.contains('O'); - read_image = r; - write_image = w; -} - -typedef TQPtrList TQIHList;// list of image handlers -static TQIHList *imageHandlers = 0; -#ifndef TQT_NO_COMPONENT -static TQPluginManager *plugin_manager = 0; -#else -static void *plugin_manager = 0; -#endif - -void tqt_init_image_plugins() -{ -#ifndef TQT_NO_COMPONENT - if ( plugin_manager ) - return; - - plugin_manager = new TQPluginManager( IID_QImageFormat, TQApplication::libraryPaths(), "/imageformats" ); - - TQStringList features = plugin_manager->featureList(); - TQStringList::Iterator it = features.begin(); - while ( it != features.end() ) { - TQString str = *it; - ++it; - TQInterfacePtr iface; - plugin_manager->queryInterface( str, &iface ); - if ( iface ) - iface->installIOHandler( str ); - } -#endif -} - -static void cleanup() -{ - // make sure that image handlers are delete before plugin manager - delete imageHandlers; - imageHandlers = 0; -#ifndef TQT_NO_COMPONENT - delete plugin_manager; - plugin_manager = 0; -#endif -} - -void tqt_init_image_handlers() // initialize image handlers -{ - if ( !imageHandlers ) { - imageHandlers = new TQIHList; - TQ_CHECK_PTR( imageHandlers ); - imageHandlers->setAutoDelete( TRUE ); - tqAddPostRoutine( cleanup ); -#ifndef TQT_NO_IMAGEIO_BMP - TQImageIO::defineIOHandler( "BMP", "^BM", 0, - read_bmp_image, write_bmp_image ); -#endif -#ifndef TQT_NO_IMAGEIO_PPM - TQImageIO::defineIOHandler( "PBM", "^P1", "t", - read_pbm_image, write_pbm_image ); - TQImageIO::defineIOHandler( "PBMRAW", "^P4", "O", - read_pbm_image, write_pbm_image ); - TQImageIO::defineIOHandler( "PGM", "^P2", "t", - read_pbm_image, write_pbm_image ); - TQImageIO::defineIOHandler( "PGMRAW", "^P5", "O", - read_pbm_image, write_pbm_image ); - TQImageIO::defineIOHandler( "PPM", "^P3", "t", - read_pbm_image, write_pbm_image ); - TQImageIO::defineIOHandler( "PPMRAW", "^P6", "O", - read_pbm_image, write_pbm_image ); -#endif -#ifndef TQT_NO_IMAGEIO_XBM - TQImageIO::defineIOHandler( "XBM", "^((/\\*(?!.XPM.\\*/))|#define)", "T", - read_xbm_image, write_xbm_image ); -#endif -#ifndef TQT_NO_IMAGEIO_XPM - TQImageIO::defineIOHandler( "XPM", "/\\*.XPM.\\*/", "T", - read_xpm_image, write_xpm_image ); -#endif -#ifndef TQT_NO_IMAGEIO_MNG - qInitMngIO(); -#endif -#ifndef TQT_NO_IMAGEIO_PNG - qInitPngIO(); -#endif -#ifndef TQT_NO_IMAGEIO_JPEG - qInitJpegIO(); -#endif - } -} - -static TQImageHandler *get_image_handler( const char *format ) -{ // get pointer to handler - tqt_init_image_handlers(); - tqt_init_image_plugins(); - TQImageHandler *p = imageHandlers->first(); - while ( p ) { // traverse list - if ( p->format == format ) - return p; - p = imageHandlers->next(); - } - return 0; // no such handler -} - - -/*! - Defines an image I/O handler for the image format called \a - format, which is recognized using the \link ntqregexp.html#details - regular expression\endlink \a header, read using \a readImage and - written using \a writeImage. - - \a flags is a string of single-character flags for this format. - The only flag defined currently is T (upper case), so the only - legal value for \a flags are "T" and the empty string. The "T" - flag means that the image file is a text file, and TQt should treat - all newline conventions as equivalent. (XPM files and some PPM - files are text files for example.) - - \a format is used to select a handler to write a TQImage; \a header - is used to select a handler to read an image file. - - If \a readImage is a null pointer, the TQImageIO will not be able - to read images in \a format. If \a writeImage is a null pointer, - the TQImageIO will not be able to write images in \a format. If - both are null, the TQImageIO object is valid but useless. - - Example: - \code - void readGIF( TQImageIO *image ) - { - // read the image using the image->ioDevice() - } - - void writeGIF( TQImageIO *image ) - { - // write the image using the image->ioDevice() - } - - // add the GIF image handler - - TQImageIO::defineIOHandler( "GIF", - "^GIF[0-9][0-9][a-z]", - 0, - readGIF, - writeGIF ); - \endcode - - Before the regex test, all the 0 bytes in the file header are - converted to 1 bytes. This is done because when TQt was - ASCII-based, TQRegExp could not handle 0 bytes in strings. - - The regexp is only applied on the first 14 bytes of the file. - - Note that TQt assumes that there is only one handler per format; if - two handlers support the same format, TQt will choose one - arbitrarily. It is not possible to have one handler support - reading, and another support writing. -*/ - -void TQImageIO::defineIOHandler( const char *format, - const char *header, - const char *flags, - image_io_handler readImage, - image_io_handler writeImage ) -{ - tqt_init_image_handlers(); - TQImageHandler *p; - p = new TQImageHandler( format, header, flags, - readImage, writeImage ); - TQ_CHECK_PTR( p ); - imageHandlers->insert( 0, p ); -} - - -/***************************************************************************** - TQImageIO normal member functions - *****************************************************************************/ - -/*! - \fn const TQImage &TQImageIO::image() const - - Returns the image currently set. - - \sa setImage() -*/ - -/*! - \fn int TQImageIO::status() const - - Returns the image's IO status. A non-zero value indicates an - error, whereas 0 means that the IO operation was successful. - - \sa setStatus() -*/ - -/*! - \fn const char *TQImageIO::format() const - - Returns the image format string or 0 if no format has been - explicitly set. -*/ - -/*! - \fn TQIODevice *TQImageIO::ioDevice() const - - Returns the IO device currently set. - - \sa setIODevice() -*/ - -/*! - \fn TQString TQImageIO::fileName() const - - Returns the file name currently set. - - \sa setFileName() -*/ - -/*! - \fn TQString TQImageIO::description() const - - Returns the image description string. - - \sa setDescription() -*/ - - -/*! - Sets the image to \a image. - - \sa image() -*/ - -void TQImageIO::setImage( const TQImage &image ) -{ - im = image; -} - -/*! - Sets the image IO status to \a status. A non-zero value indicates - an error, whereas 0 means that the IO operation was successful. - - \sa status() -*/ - -void TQImageIO::setStatus( int status ) -{ - iostat = status; -} - -/*! - Sets the image format to \a format for the image to be read or - written. - - It is necessary to specify a format before writing an image, but - it is not necessary to specify a format before reading an image. - - If no format has been set, TQt guesses the image format before - reading it. If a format is set the image will only be read if it - has that format. - - \sa read() write() format() -*/ - -void TQImageIO::setFormat( const char *format ) -{ - frmt = format; -} - -/*! - Sets the IO device to be used for reading or writing an image. - - Setting the IO device allows images to be read/written to any - block-oriented TQIODevice. - - If \a ioDevice is not null, this IO device will override file name - settings. - - \sa setFileName() -*/ - -void TQImageIO::setIODevice( TQIODevice *ioDevice ) -{ - iodev = ioDevice; -} - -/*! - Sets the name of the file to read or write an image from to \a - fileName. - - \sa setIODevice() -*/ - -void TQImageIO::setFileName( const TQString &fileName ) -{ - fname = fileName; -} - -/*! - Returns the quality of the written image, related to the - compression ratio. - - \sa setQuality() TQImage::save() -*/ - -int TQImageIO::quality() const -{ - return d->quality; -} - -/*! - Sets the quality of the written image to \a q, related to the - compression ratio. - - \a q must be in the range -1..100. Specify 0 to obtain small - compressed files, 100 for large uncompressed files. (-1 signifies - the default compression.) - - \sa quality() TQImage::save() -*/ - -void TQImageIO::setQuality( int q ) -{ - d->quality = q; -} - -/*! - Returns the image's parameters string. - - \sa setParameters() -*/ - -const char *TQImageIO::parameters() const -{ - return d->parameters; -} - -/*! - Sets the image's parameter string to \a parameters. This is for - image handlers that require special parameters. - - Although the current image formats supported by TQt ignore the - parameters string, it may be used in future extensions or by - contributions (for example, JPEG). - - \sa parameters() -*/ - -void TQImageIO::setParameters( const char *parameters ) -{ - if ( d && d->parameters ) - delete [] (char*)d->parameters; - d->parameters = tqstrdup( parameters ); -} - -/*! - Sets the gamma value at which the image will be viewed to \a - gamma. If the image format stores a gamma value for which the - image is intended to be used, then this setting will be used to - modify the image. Setting to 0.0 will disable gamma correction - (i.e. any specification in the file will be ignored). - - The default value is 0.0. - - \sa gamma() -*/ -void TQImageIO::setGamma( float gamma ) -{ - d->gamma=gamma; -} - -/*! - Returns the gamma value at which the image will be viewed. - - \sa setGamma() -*/ -float TQImageIO::gamma() const -{ - return d->gamma; -} - -/*! - Sets the image description string for image handlers that support - image descriptions to \a description. - - Currently, no image format supported by TQt uses the description - string. -*/ - -void TQImageIO::setDescription( const TQString &description ) -{ - descr = description; -} - - -/*! - Returns a string that specifies the image format of the file \a - fileName, or null if the file cannot be read or if the format is - not recognized. -*/ - -const char* TQImageIO::imageFormat( const TQString &fileName ) -{ - TQFile file( fileName ); - if ( !file.open(IO_ReadOnly) ) - return 0; - const char* format = imageFormat( &file ); - file.close(); - return format; -} - -/*! - \overload - - Returns a string that specifies the image format of the image read - from IO device \a d, or 0 if the device cannot be read or if the - format is not recognized. - - Make sure that \a d is at the right position in the device (for - example, at the beginning of the file). - - \sa TQIODevice::at() -*/ - -const char *TQImageIO::imageFormat( TQIODevice *d ) -{ - // if you change this change the documentation for defineIOHandler() - const int buflen = 14; - - char buf[buflen]; - char buf2[buflen]; - tqt_init_image_handlers(); - tqt_init_image_plugins(); - int pos = d->at(); // save position - int rdlen = d->readBlock( buf, buflen ); // read a few bytes - - if ( rdlen != buflen ) - return 0; - - memcpy( buf2, buf, buflen ); - - const char* format = 0; - for ( int n = 0; n < rdlen; n++ ) - if ( buf[n] == '\0' ) - buf[n] = '\001'; - if ( d->status() == IO_Ok && rdlen > 0 ) { - buf[rdlen - 1] = '\0'; - TQString bufStr = TQString::fromLatin1(buf); - TQImageHandler *p = imageHandlers->first(); - int bestMatch = -1; - while ( p ) { - if ( p->read_image && p->header.search(bufStr) != -1 ) { - // try match with header if a read function is available - if (p->header.matchedLength() > bestMatch) { - // keep looking for best match - format = p->format; - bestMatch = p->header.matchedLength(); - } - } - p = imageHandlers->next(); - } - } - d->at( pos ); // restore position -#ifndef TQT_NO_ASYNC_IMAGE_IO - if ( !format ) - format = TQImageDecoder::formatName( (uchar*)buf2, rdlen ); -#endif - - return format; -} - -/*! - Returns a sorted list of image formats that are supported for - image input. -*/ -TQStrList TQImageIO::inputFormats() -{ - TQStrList result; - - tqt_init_image_handlers(); - tqt_init_image_plugins(); - -#ifndef TQT_NO_ASYNC_IMAGE_IO - // Include asynchronous loaders first. - result = TQImageDecoder::inputFormats(); -#endif - - TQImageHandler *p = imageHandlers->first(); - while ( p ) { - if ( p->read_image - && !p->obsolete - && !result.contains(p->format) ) - { - result.inSort(p->format); - } - p = imageHandlers->next(); - } - - return result; -} - -/*! - Returns a sorted list of image formats that are supported for - image output. -*/ -TQStrList TQImageIO::outputFormats() -{ - TQStrList result; - - tqt_init_image_handlers(); - tqt_init_image_plugins(); - - // Include asynchronous writers (!) first. - // (None) - - TQImageHandler *p = imageHandlers->first(); - while ( p ) { - if ( p->write_image - && !p->obsolete - && !result.contains(p->format) ) - { - result.inSort(p->format); - } - p = imageHandlers->next(); - } - - return result; -} - - - -/*! - Reads an image into memory and returns TRUE if the image was - successfully read; otherwise returns FALSE. - - Before reading an image you must set an IO device or a file name. - If both an IO device and a file name have been set, the IO device - will be used. - - Setting the image file format string is optional. - - Note that this function does \e not set the \link format() - format\endlink used to read the image. If you need that - information, use the imageFormat() static functions. - - Example: - - \code - TQImageIO iio; - TQPixmap pixmap; - iio.setFileName( "vegeburger.bmp" ); - if ( image.read() ) // ok - pixmap = iio.image(); // convert to pixmap - \endcode - - \sa setIODevice() setFileName() setFormat() write() TQPixmap::load() -*/ - -bool TQImageIO::read() -{ - TQFile file; - const char *image_format; - TQImageHandler *h; - - if ( iodev ) { // read from io device - // ok, already open - } else if ( !fname.isEmpty() ) { // read from file - file.setName( fname ); - if ( !file.open(IO_ReadOnly) ) - return FALSE; // cannot open file - iodev = &file; - } else { // no file name or io device - return FALSE; - } - if (frmt.isEmpty()) { - // Try to guess format - image_format = imageFormat( iodev ); // get image format - if ( !image_format ) { - if ( file.isOpen() ) { // unknown format - file.close(); - iodev = 0; - } - return FALSE; - } - } else { - image_format = frmt; - } - - h = get_image_handler( image_format ); - if ( file.isOpen() ) { -#if !defined(Q_OS_UNIX) - if ( h && h->text_mode ) { // reopen in translated mode - file.close(); - file.open( IO_ReadOnly | IO_Translate ); - } - else -#endif - file.at( 0 ); // position to start - } - iostat = 1; // assume error - - if ( h && h->read_image ) { - (*h->read_image)( this ); - } -#ifndef TQT_NO_ASYNC_IMAGE_IO - else { - // Format name, but no handler - must be an asychronous reader - read_async_image( this ); - } -#endif - - if ( file.isOpen() ) { // image was read using file - file.close(); - iodev = 0; - } - return iostat == 0; // image successfully read? -} - - -/*! - Writes an image to an IO device and returns TRUE if the image was - successfully written; otherwise returns FALSE. - - Before writing an image you must set an IO device or a file name. - If both an IO device and a file name have been set, the IO device - will be used. - - The image will be written using the specified image format. - - Example: - \code - TQImageIO iio; - TQImage im; - im = pixmap; // convert to image - iio.setImage( im ); - iio.setFileName( "vegeburger.bmp" ); - iio.setFormat( "BMP" ); - if ( iio.write() ) - // returned TRUE if written successfully - \endcode - - \sa setIODevice() setFileName() setFormat() read() TQPixmap::save() -*/ - -bool TQImageIO::write() -{ - if ( frmt.isEmpty() ) - return FALSE; - TQImageHandler *h = get_image_handler( frmt ); - if ( !h && !plugin_manager) { - tqt_init_image_plugins(); - h = get_image_handler( frmt ); - } - if ( !h || !h->write_image ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImageIO::write: No such image format handler: %s", - format() ); -#endif - return FALSE; - } - TQFile file; - if ( !iodev && !fname.isEmpty() ) { - file.setName( fname ); - bool translate = h->text_mode==TQImageHandler::TranslateInOut; - int fmode = translate ? IO_WriteOnly|IO_Translate : IO_WriteOnly; - if ( !file.open(fmode) ) // couldn't create file - return FALSE; - iodev = &file; - } - iostat = 1; - (*h->write_image)( this ); - if ( file.isOpen() ) { // image was written using file - file.close(); - iodev = 0; - } - return iostat == 0; // image successfully written? -} -#endif //TQT_NO_IMAGEIO - -#ifndef TQT_NO_IMAGEIO_BMP - -/***************************************************************************** - BMP (DIB) image read/write functions - *****************************************************************************/ - -const int BMP_FILEHDR_SIZE = 14; // size of BMP_FILEHDR data - -struct BMP_FILEHDR { // BMP file header - char bfType[2]; // "BM" - TQ_INT32 bfSize; // size of file - TQ_INT16 bfReserved1; - TQ_INT16 bfReserved2; - TQ_INT32 bfOffBits; // pointer to the pixmap bits -}; - -TQDataStream &operator>>( TQDataStream &s, BMP_FILEHDR &bf ) -{ // read file header - s.readRawBytes( bf.bfType, 2 ); - s >> bf.bfSize >> bf.bfReserved1 >> bf.bfReserved2 >> bf.bfOffBits; - return s; -} - -TQDataStream &operator<<( TQDataStream &s, const BMP_FILEHDR &bf ) -{ // write file header - s.writeRawBytes( bf.bfType, 2 ); - s << bf.bfSize << bf.bfReserved1 << bf.bfReserved2 << bf.bfOffBits; - return s; -} - - -const int BMP_OLD = 12; // old Windows/OS2 BMP size -const int BMP_WIN = 40; // new Windows BMP size -const int BMP_OS2 = 64; // new OS/2 BMP size - -const int BMP_RGB = 0; // no compression -const int BMP_RLE8 = 1; // run-length encoded, 8 bits -const int BMP_RLE4 = 2; // run-length encoded, 4 bits -const int BMP_BITFIELDS = 3; // RGB values encoded in data as bit-fields - -struct BMP_INFOHDR { // BMP information header - TQ_INT32 biSize; // size of this struct - TQ_INT32 biWidth; // pixmap width - TQ_INT32 biHeight; // pixmap height - TQ_INT16 biPlanes; // should be 1 - TQ_INT16 biBitCount; // number of bits per pixel - TQ_INT32 biCompression; // compression method - TQ_INT32 biSizeImage; // size of image - TQ_INT32 biXPelsPerMeter; // horizontal resolution - TQ_INT32 biYPelsPerMeter; // vertical resolution - TQ_INT32 biClrUsed; // number of colors used - TQ_INT32 biClrImportant; // number of important colors -}; - - -TQDataStream &operator>>( TQDataStream &s, BMP_INFOHDR &bi ) -{ - s >> bi.biSize; - if ( bi.biSize == BMP_WIN || bi.biSize == BMP_OS2 ) { - s >> bi.biWidth >> bi.biHeight >> bi.biPlanes >> bi.biBitCount; - s >> bi.biCompression >> bi.biSizeImage; - s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; - s >> bi.biClrUsed >> bi.biClrImportant; - } - else { // probably old Windows format - TQ_INT16 w, h; - s >> w >> h >> bi.biPlanes >> bi.biBitCount; - bi.biWidth = w; - bi.biHeight = h; - bi.biCompression = BMP_RGB; // no compression - bi.biSizeImage = 0; - bi.biXPelsPerMeter = bi.biYPelsPerMeter = 0; - bi.biClrUsed = bi.biClrImportant = 0; - } - return s; -} - -TQDataStream &operator<<( TQDataStream &s, const BMP_INFOHDR &bi ) -{ - s << bi.biSize; - s << bi.biWidth << bi.biHeight; - s << bi.biPlanes; - s << bi.biBitCount; - s << bi.biCompression; - s << bi.biSizeImage; - s << bi.biXPelsPerMeter << bi.biYPelsPerMeter; - s << bi.biClrUsed << bi.biClrImportant; - return s; -} - -static -int calc_shift(int mask) -{ - int result = 0; - while (!(mask & 1)) { - result++; - mask >>= 1; - } - return result; -} - -static -bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) -{ - BMP_INFOHDR bi; - TQIODevice* d = s.device(); - - s >> bi; // read BMP info header - if ( d->atEnd() ) // end of stream/file - return FALSE; -#if 0 - tqDebug( "offset...........%d", offset ); - tqDebug( "startpos.........%d", startpos ); - tqDebug( "biSize...........%d", bi.biSize ); - tqDebug( "biWidth..........%d", bi.biWidth ); - tqDebug( "biHeight.........%d", bi.biHeight ); - tqDebug( "biPlanes.........%d", bi.biPlanes ); - tqDebug( "biBitCount.......%d", bi.biBitCount ); - tqDebug( "biCompression....%d", bi.biCompression ); - tqDebug( "biSizeImage......%d", bi.biSizeImage ); - tqDebug( "biXPelsPerMeter..%d", bi.biXPelsPerMeter ); - tqDebug( "biYPelsPerMeter..%d", bi.biYPelsPerMeter ); - tqDebug( "biClrUsed........%d", bi.biClrUsed ); - tqDebug( "biClrImportant...%d", bi.biClrImportant ); -#endif - int w = bi.biWidth, h = bi.biHeight, nbits = bi.biBitCount; - int t = bi.biSize, comp = bi.biCompression; - int red_mask, green_mask, blue_mask; - int red_shift = 0; - int green_shift = 0; - int blue_shift = 0; - int red_scale = 0; - int green_scale = 0; - int blue_scale = 0; - - if ( !(nbits == 1 || nbits == 4 || nbits == 8 || nbits == 16 || nbits == 24 || nbits == 32) || - bi.biPlanes != 1 || comp > BMP_BITFIELDS ) - return FALSE; // weird BMP image - if ( !(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || - (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS)) ) - return FALSE; // weird compression type - if ((w < 0) || ((w * abs(h)) > (16384 * 16384))) - return FALSE; - - int ncols; - int depth; - switch ( nbits ) { - case 32: - case 24: - case 16: - depth = 32; - break; - case 8: - case 4: - depth = 8; - break; - default: - depth = 1; - } - if ( depth == 32 ) // there's no colormap - ncols = 0; - else // # colors used - ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; - - image.create( w, h, depth, ncols, nbits == 1 ? - TQImage::BigEndian : TQImage::IgnoreEndian ); - if ( image.isNull() ) // could not create image - return FALSE; - - image.setDotsPerMeterX( bi.biXPelsPerMeter ); - image.setDotsPerMeterY( bi.biYPelsPerMeter ); - - d->at( startpos + BMP_FILEHDR_SIZE + bi.biSize ); // goto start of colormap - - if ( ncols > 0 ) { // read color table - uchar rgb[4]; - int rgb_len = t == BMP_OLD ? 3 : 4; - for ( int i=0; ireadBlock( (char *)rgb, rgb_len ) != rgb_len ) - return FALSE; - image.setColor( i, tqRgb(rgb[2],rgb[1],rgb[0]) ); - if ( d->atEnd() ) // truncated file - return FALSE; - } - } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { - if ( (TQ_ULONG)d->readBlock( (char *)&red_mask, sizeof(red_mask) ) != sizeof(red_mask) ) - return FALSE; - if ( (TQ_ULONG)d->readBlock( (char *)&green_mask, sizeof(green_mask) ) != sizeof(green_mask) ) - return FALSE; - if ( (TQ_ULONG)d->readBlock( (char *)&blue_mask, sizeof(blue_mask) ) != sizeof(blue_mask) ) - return FALSE; - red_shift = calc_shift(red_mask); - if (((red_mask >> red_shift) + 1) == 0) - return FALSE; - red_scale = 256 / ((red_mask >> red_shift) + 1); - green_shift = calc_shift(green_mask); - if (((green_mask >> green_shift) + 1) == 0) - return FALSE; - green_scale = 256 / ((green_mask >> green_shift) + 1); - blue_shift = calc_shift(blue_mask); - if (((blue_mask >> blue_shift) + 1) == 0) - return FALSE; - blue_scale = 256 / ((blue_mask >> blue_shift) + 1); - } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { - blue_mask = 0x000000ff; - green_mask = 0x0000ff00; - red_mask = 0x00ff0000; - blue_shift = 0; - green_shift = 8; - red_shift = 16; - blue_scale = green_scale = red_scale = 1; - } else if (comp == BMP_RGB && nbits == 16) // don't support RGB values for 15/16 bpp - return FALSE; - - // offset can be bogus, be careful - if (offset>=0 && startpos + offset > (TQ_LONG)d->at() ) - d->at( startpos + offset ); // start of image data - - int bpl = image.bytesPerLine(); -#ifdef TQ_WS_QWS - // - // Guess the number of bytes-per-line if we don't know how much - // image data is in the file (bogus image ?). - // - int bmpbpl = bi.biSizeImage > 0 ? - bi.biSizeImage / bi.biHeight : - (d->size() - offset) / bi.biHeight; - int pad = bmpbpl-bpl; -#endif - uchar **line = image.jumpTable(); - - if ( nbits == 1 ) { // 1 bit BMP image - while ( --h >= 0 ) { - if ( d->readBlock((char*)line[h],bpl) != bpl ) - break; -#ifdef TQ_WS_QWS - if ( pad > 0 ) - d->at(d->at()+pad); -#endif - } - if ( ncols == 2 && tqGray(image.color(0)) < tqGray(image.color(1)) ) - swapPixel01( &image ); // pixel 0 is white! - } - - else if ( nbits == 4 ) { // 4 bit BMP image - int buflen = ((w+7)/8)*4; - uchar *buf = new uchar[buflen]; - TQ_CHECK_PTR( buf ); - if ( comp == BMP_RLE4 ) { // run length compression - int x=0, y=0, b, c, i; - uchar *p = line[h-1]; - uchar *endp = line[h-1]+w; - while ( y < h ) { - if ( (b=d->getch()) == EOF ) - break; - if ( b == 0 ) { // escape code - switch ( (b=d->getch()) ) { - case 0: // end of line - x = 0; - y++; - p = line[h-y-1]; - break; - case 1: // end of image - case EOF: // end of file - y = h; // exit loop - break; - case 2: // delta (jump) - x += d->getch(); - y += d->getch(); - - // Protection - if ( (uint)x >= (uint)w ) - x = w-1; - if ( (uint)y >= (uint)h ) - y = h-1; - - p = line[h-y-1] + x; - break; - default: // absolute mode - // Protection - if ( p + b > endp ) - b = endp-p; - - i = (c = b)/2; - while ( i-- ) { - b = d->getch(); - *p++ = b >> 4; - *p++ = b & 0x0f; - } - if ( c & 1 ) - *p++ = d->getch() >> 4; - if ( (((c & 3) + 1) & 2) == 2 ) - d->getch(); // align on word boundary - x += c; - } - } else { // encoded mode - // Protection - if ( p + b > endp ) - b = endp-p; - - i = (c = b)/2; - b = d->getch(); // 2 pixels to be repeated - while ( i-- ) { - *p++ = b >> 4; - *p++ = b & 0x0f; - } - if ( c & 1 ) - *p++ = b >> 4; - x += c; - } - } - } else if ( comp == BMP_RGB ) { // no compression - while ( --h >= 0 ) { - if ( d->readBlock((char*)buf,buflen) != buflen ) - break; - uchar *p = line[h]; - uchar *b = buf; - for ( int i=0; i> 4; - *p++ = *b++ & 0x0f; - } - if ( w & 1 ) // the last nibble - *p = *b >> 4; - } - } - delete [] buf; - } - - else if ( nbits == 8 ) { // 8 bit BMP image - if ( comp == BMP_RLE8 ) { // run length compression - int x=0, y=0, b; - uchar *p = line[h-1]; - const uchar *endp = line[h-1]+w; - while ( y < h ) { - if ( (b=d->getch()) == EOF ) - break; - if ( b == 0 ) { // escape code - switch ( (b=d->getch()) ) { - case 0: // end of line - x = 0; - y++; - p = line[h-y-1]; - break; - case 1: // end of image - case EOF: // end of file - y = h; // exit loop - break; - case 2: // delta (jump) - x += d->getch(); - y += d->getch(); - - // Protection - if ( (uint)x >= (uint)w ) - x = w-1; - if ( (uint)y >= (uint)h ) - y = h-1; - - p = line[h-y-1] + x; - break; - default: // absolute mode - // Protection - if ( p + b > endp ) - b = endp-p; - - if ( d->readBlock( (char *)p, b ) != b ) - return FALSE; - if ( (b & 1) == 1 ) - d->getch(); // align on word boundary - x += b; - p += b; - } - } else { // encoded mode - // Protection - if ( p + b > endp ) - b = endp-p; - - memset( p, d->getch(), b ); // repeat pixel - x += b; - p += b; - } - } - } else if ( comp == BMP_RGB ) { // uncompressed - while ( --h >= 0 ) { - if ( d->readBlock((char *)line[h],bpl) != bpl ) - break; -#ifdef TQ_WS_QWS - if ( pad > 0 ) - d->at(d->at()+pad); -#endif - } - } - } - - else if ( nbits == 16 || nbits == 24 || nbits == 32 ) { // 16,24,32 bit BMP image - TQRgb *p; - TQRgb *end; - uchar *buf24 = new uchar[bpl]; - int bpl24 = ((w*nbits+31)/32)*4; - uchar *b; - int c; - - while ( --h >= 0 ) { - p = (TQRgb *)line[h]; - end = p + w; - if ( d->readBlock( (char *)buf24,bpl24) != bpl24 ) - break; - b = buf24; - while ( p < end ) { - c = *(uchar*)b | (*(uchar*)(b+1)<<8); - if (nbits != 16) - c |= *(uchar*)(b+2)<<16; - *p++ = tqRgb(((c & red_mask) >> red_shift) * red_scale, - ((c & green_mask) >> green_shift) * green_scale, - ((c & blue_mask) >> blue_shift) * blue_scale); - b += nbits/8; - } - } - delete[] buf24; - } - - return TRUE; -} - -bool qt_read_dib( TQDataStream& s, TQImage& image ) -{ - return read_dib(s,-1,-BMP_FILEHDR_SIZE,image); -} - - -static void read_bmp_image( TQImageIO *iio ) -{ - TQIODevice *d = iio->ioDevice(); - TQDataStream s( d ); - BMP_FILEHDR bf; - int startpos = d->at(); - - s.setByteOrder( TQDataStream::LittleEndian );// Intel byte order - s >> bf; // read BMP file header - - if ( tqstrncmp(bf.bfType,"BM",2) != 0 ) // not a BMP image - return; - - TQImage image; - if (read_dib( s, bf.bfOffBits, startpos, image )) { - iio->setImage( image ); - iio->setStatus( 0 ); // image ok - } -} - -bool qt_write_dib( TQDataStream& s, TQImage image ) -{ - int nbits; - int bpl_bmp; - int bpl = image.bytesPerLine(); - - TQIODevice* d = s.device(); - - if ( image.depth() == 8 && image.numColors() <= 16 ) { - bpl_bmp = (((bpl+1)/2+3)/4)*4; - nbits = 4; - } else if ( image.depth() == 32 ) { - bpl_bmp = ((image.width()*24+31)/32)*4; - nbits = 24; -#ifdef TQ_WS_QWS - } else if ( image.depth() == 1 || image.depth() == 8 ) { - // TQt/E doesn't word align. - bpl_bmp = ((image.width()*image.depth()+31)/32)*4; - nbits = image.depth(); -#endif - } else { - bpl_bmp = bpl; - nbits = image.depth(); - } - - BMP_INFOHDR bi; - bi.biSize = BMP_WIN; // build info header - bi.biWidth = image.width(); - bi.biHeight = image.height(); - bi.biPlanes = 1; - bi.biBitCount = nbits; - bi.biCompression = BMP_RGB; - bi.biSizeImage = bpl_bmp*image.height(); - bi.biXPelsPerMeter = image.dotsPerMeterX() ? image.dotsPerMeterX() - : 2834; // 72 dpi default - bi.biYPelsPerMeter = image.dotsPerMeterY() ? image.dotsPerMeterY() : 2834; - bi.biClrUsed = image.numColors(); - bi.biClrImportant = image.numColors(); - s << bi; // write info header - - if ( image.depth() != 32 ) { // write color table - uchar *color_table = new uchar[4*image.numColors()]; - uchar *rgb = color_table; - TQRgb *c = image.colorTable(); - for ( int i=0; iwriteBlock( (char *)color_table, 4*image.numColors() ); - delete [] color_table; - } - - if ( image.depth() == 1 && image.bitOrder() != TQImage::BigEndian ) - image = image.convertBitOrder( TQImage::BigEndian ); - - int y; - - if ( nbits == 1 || nbits == 8 ) { // direct output -#ifdef TQ_WS_QWS - // TQt/E doesn't word align. - int pad = bpl_bmp - bpl; - char padding[4]; -#endif - for ( y=image.height()-1; y>=0; y-- ) { - d->writeBlock( (char*)image.scanLine(y), bpl ); -#ifdef TQ_WS_QWS - d->writeBlock( padding, pad ); -#endif - } - return TRUE; - } - - uchar *buf = new uchar[bpl_bmp]; - uchar *b, *end; - uchar *p; - - memset( buf, 0, bpl_bmp ); - for ( y=image.height()-1; y>=0; y-- ) { // write the image bits - if ( nbits == 4 ) { // convert 8 -> 4 bits - p = image.scanLine(y); - b = buf; - end = b + image.width()/2; - while ( b < end ) { - *b++ = (*p << 4) | (*(p+1) & 0x0f); - p += 2; - } - if ( image.width() & 1 ) - *b = *p << 4; - } else { // 32 bits - TQRgb *p = (TQRgb *)image.scanLine( y ); - TQRgb *end = p + image.width(); - b = buf; - while ( p < end ) { - *b++ = tqBlue(*p); - *b++ = tqGreen(*p); - *b++ = tqRed(*p); - p++; - } - } - if ( bpl_bmp != d->writeBlock( (char*)buf, bpl_bmp ) ) { - delete[] buf; - return FALSE; - } - } - delete[] buf; - return TRUE; -} - - -static void write_bmp_image( TQImageIO *iio ) -{ - TQIODevice *d = iio->ioDevice(); - TQImage image = iio->image(); - TQDataStream s( d ); - BMP_FILEHDR bf; - int bpl_bmp; - int bpl = image.bytesPerLine(); - - // Code partially repeated in qt_write_dib - if ( image.depth() == 8 && image.numColors() <= 16 ) { - bpl_bmp = (((bpl+1)/2+3)/4)*4; - } else if ( image.depth() == 32 ) { - bpl_bmp = ((image.width()*24+31)/32)*4; - } else { - bpl_bmp = bpl; - } - - iio->setStatus( 0 ); - s.setByteOrder( TQDataStream::LittleEndian );// Intel byte order - strncpy( bf.bfType, "BM", 2 ); // build file header - bf.bfReserved1 = bf.bfReserved2 = 0; // reserved, should be zero - bf.bfOffBits = BMP_FILEHDR_SIZE + BMP_WIN + image.numColors()*4; - bf.bfSize = bf.bfOffBits + bpl_bmp*image.height(); - s << bf; // write file header - - if ( !qt_write_dib( s, image ) ) - iio->setStatus( 1 ); - -} - -#endif // TQT_NO_IMAGEIO_BMP - -#ifndef TQT_NO_IMAGEIO_PPM - -/***************************************************************************** - PBM/PGM/PPM (ASCII and RAW) image read/write functions - *****************************************************************************/ - -static int read_pbm_int( TQIODevice *d ) -{ - int c; - int val = -1; - bool digit; - const int buflen = 100; - char buf[buflen]; - for ( ;; ) { - if ( (c=d->getch()) == EOF ) // end of file - break; - digit = isdigit( (uchar) c ); - if ( val != -1 ) { - if ( digit ) { - val = 10*val + c - '0'; - continue; - } else { - if ( c == '#' ) // comment - d->readLine( buf, buflen ); - break; - } - } - if ( digit ) // first digit - val = c - '0'; - else if ( isspace((uchar) c) ) - continue; - else if ( c == '#' ) - d->readLine( buf, buflen ); - else - break; - } - return val; -} - -static void read_pbm_image( TQImageIO *iio ) // read PBM image data -{ - const int buflen = 300; - char buf[buflen]; - TQIODevice *d = iio->ioDevice(); - int w, h, nbits, mcc, y; - int pbm_bpl; - char type; - bool raw; - TQImage image; - - if ( d->readBlock( buf, 3 ) != 3 ) // read P[1-6] - return; - if ( !(buf[0] == 'P' && isdigit((uchar) buf[1]) && isspace((uchar) buf[2])) ) - return; - switch ( (type=buf[1]) ) { - case '1': // ascii PBM - case '4': // raw PBM - nbits = 1; - break; - case '2': // ascii PGM - case '5': // raw PGM - nbits = 8; - break; - case '3': // ascii PPM - case '6': // raw PPM - nbits = 32; - break; - default: - return; - } - raw = type >= '4'; - w = read_pbm_int( d ); // get image width - h = read_pbm_int( d ); // get image height - if ( nbits == 1 ) - mcc = 1; // ignore max color component - else - mcc = read_pbm_int( d ); // get max color component - if ( w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0 || mcc > 0xffff ) - return; // weird P.M image - - int maxc = mcc; - if ( maxc > 255 ) - maxc = 255; - image.create( w, h, nbits, 0, - nbits == 1 ? TQImage::BigEndian : TQImage::IgnoreEndian ); - if ( image.isNull() ) - return; - - pbm_bpl = (nbits*w+7)/8; // bytes per scanline in PBM - - if ( raw ) { // read raw data - if ( nbits == 32 ) { // type 6 - pbm_bpl = 3*w; - uchar *buf24 = new uchar[pbm_bpl], *b; - TQRgb *p; - TQRgb *end; - for ( y=0; yreadBlock( (char *)buf24, pbm_bpl ) != pbm_bpl ) { - delete[] buf24; - return; - } - p = (TQRgb *)image.scanLine( y ); - end = p + w; - b = buf24; - while ( p < end ) { - *p++ = tqRgb(b[0],b[1],b[2]); - b += 3; - } - } - delete[] buf24; - } else { // type 4,5 - for ( y=0; yreadBlock( (char *)image.scanLine(y), pbm_bpl ) - != pbm_bpl ) - return; - } - } - } else { // read ascii data - uchar *p; - int n; - for ( y=0; ysetImage( image ); - iio->setStatus( 0 ); // image ok -} - - -static void write_pbm_image( TQImageIO *iio ) -{ - TQIODevice* out = iio->ioDevice(); - TQCString str; - - TQImage image = iio->image(); - TQCString format = iio->format(); - format = format.left(3); // ignore RAW part - bool gray = format == "PGM"; - - if ( format == "PBM" ) { - image = image.convertDepth(1); - } else if ( image.depth() == 1 ) { - image = image.convertDepth(8); - } - - if ( image.depth() == 1 && image.numColors() == 2 ) { - if ( tqGray(image.color(0)) < tqGray(image.color(1)) ) { - // 0=dark/black, 1=light/white - invert - image.detach(); - for ( int y=0; ywriteBlock(str, str.length()) != str.length()) { - iio->setStatus(1); - return; - } - w = (w+7)/8; - for (uint y=0; ywriteBlock((char*)line, w) ) { - iio->setStatus(1); - return; - } - } - } - break; - - case 8: { - str.insert(1, gray ? '5' : '6'); - str.append("255\n"); - if ((uint)out->writeBlock(str, str.length()) != str.length()) { - iio->setStatus(1); - return; - } - TQRgb *color = image.colorTable(); - uint bpl = w*(gray ? 1 : 3); - uchar *buf = new uchar[bpl]; - for (uint y=0; ywriteBlock((char*)buf, bpl) ) { - iio->setStatus(1); - return; - } - } - delete [] buf; - } - break; - - case 32: { - str.insert(1, gray ? '5' : '6'); - str.append("255\n"); - if ((uint)out->writeBlock(str, str.length()) != str.length()) { - iio->setStatus(1); - return; - } - uint bpl = w*(gray ? 1 : 3); - uchar *buf = new uchar[bpl]; - for (uint y=0; ywriteBlock((char*)buf, bpl) ) { - iio->setStatus(1); - return; - } - } - delete [] buf; - } - } - - iio->setStatus(0); -} - -#endif // TQT_NO_IMAGEIO_PPM - -#ifndef TQT_NO_ASYNC_IMAGE_IO - -class TQImageIOFrameGrabber : public TQImageConsumer { -public: - TQImageIOFrameGrabber() : framecount(0) { } - virtual ~TQImageIOFrameGrabber() { } - - TQImageDecoder *decoder; - int framecount; - - void changed(const TQRect&) { } - void end() { } - void frameDone(const TQPoint&, const TQRect&) { framecount++; } - void frameDone() { framecount++; } - void setLooping(int) { } - void setFramePeriod(int) { } - void setSize(int, int) { } -}; - -static void read_async_image( TQImageIO *iio ) -{ - const int buf_len = 2048; - uchar buffer[buf_len]; - TQIODevice *d = iio->ioDevice(); - TQImageIOFrameGrabber* consumer = new TQImageIOFrameGrabber(); - TQImageDecoder *decoder = new TQImageDecoder(consumer); - consumer->decoder = decoder; - int startAt = d->at(); - int totLen = 0; - - for (;;) { - int length = d->readBlock((char*)buffer, buf_len); - if ( length <= 0 ) { - iio->setStatus(length); - break; - } - uchar* b = buffer; - int r = -1; - while (length > 0 && consumer->framecount==0) { - r = decoder->decode(b, length); - if ( r <= 0 ) break; - b += r; - totLen += r; - length -= r; - } - if ( consumer->framecount ) { - // Stopped after first frame - if ( d->isDirectAccess() ) - d->at( startAt + totLen ); - else { - // ### We have (probably) read too much from the stream into - // the buffer, and there is no way to put it back! - } - iio->setImage(decoder->image()); - iio->setStatus(0); - break; - } - if ( r <= 0 ) { - iio->setStatus(r); - break; - } - } - - consumer->decoder = 0; - delete decoder; - delete consumer; -} - -#endif // TQT_NO_ASYNC_IMAGE_IO - -#ifndef TQT_NO_IMAGEIO_XBM - -/***************************************************************************** - X bitmap image read/write functions - *****************************************************************************/ - -static inline int hex2byte( char *p ) -{ - return ( (isdigit((uchar) *p) ? *p - '0' : toupper((uchar) *p) - 'A' + 10) << 4 ) | - ( isdigit((uchar) *(p+1)) ? *(p+1) - '0' : toupper((uchar) *(p+1)) - 'A' + 10 ); -} - -static void read_xbm_image( TQImageIO *iio ) -{ - const int buflen = 300; - const int maxlen = 4096; - char buf[buflen]; - TQRegExp r1, r2; - TQIODevice *d = iio->ioDevice(); - int w=-1, h=-1; - TQImage image; - TQ_INT64 readBytes = 0; - TQ_INT64 totalReadBytes = 0; - - r1 = TQString::fromLatin1("^#define[ \t]+[a-zA-Z0-9._]+[ \t]+"); - r2 = TQString::fromLatin1("[0-9]+"); - - buf[0] = '\0'; - while (buf[0] != '#') { //skip leading comment, if any - readBytes = d->readLine(buf, buflen); - - // if readBytes >= buflen, it's very probably not a C file - if ((readBytes <= 0) || (readBytes >= (buflen-1))) - return; - - // limit xbm headers to the first 4k in the file to prevent - // excessive reads on non-xbm files - totalReadBytes += readBytes; - if (totalReadBytes >= maxlen) - return; - } - - TQString sbuf; - sbuf = TQString::fromLatin1(buf); - - if ( r1.search(sbuf) == 0 && - r2.search(sbuf, r1.matchedLength()) == r1.matchedLength() ) - w = atoi( &buf[r1.matchedLength()] ); - - readBytes = d->readLine(buf, buflen ); // "#define .._height " - if (readBytes <= 0) { - return; - } - sbuf = TQString::fromLatin1(buf); - - if ( r1.search(sbuf) == 0 && - r2.search(sbuf, r1.matchedLength()) == r1.matchedLength() ) - h = atoi( &buf[r1.matchedLength()] ); - - if ( w <= 0 || w > 32767 || h <= 0 || h > 32767 ) - return; // format error - - for ( ;; ) { // scan for data - readBytes = d->readLine(buf, buflen); - if (readBytes <= 0) { // end of file - return; - } - buf[readBytes] = '\0'; - if ( strstr(buf,"0x") != 0 ) // does line contain data? - break; - } - - image.create( w, h, 1, 2, TQImage::LittleEndian ); - if ( image.isNull() ) - return; - - image.setColor( 0, tqRgb(255,255,255) ); // white - image.setColor( 1, tqRgb(0,0,0) ); // black - - int x = 0, y = 0; - uchar *b = image.scanLine(0); - char *p = strstr( buf, "0x" ); - w = (w+7)/8; // byte width - - while ( y < h ) { // for all encoded bytes... - if (p && (p < (buf + readBytes - 3))) { // p = "0x.." - if (!isxdigit(p[2]) || !isxdigit(p[3])) { - return; - } - *b++ = hex2byte(p+2); - p += 2; - if ( ++x == w && ++y < h ) { - b = image.scanLine(y); - x = 0; - } - p = strstr( p, "0x" ); - } else { // read another line - readBytes = d->readLine(buf, buflen); - if (readBytes <= 0) // EOF ==> truncated image - break; - buf[readBytes] = '\0'; - p = strstr( buf, "0x" ); - } - } - - iio->setImage( image ); - iio->setStatus( 0 ); // image ok -} - - -static void write_xbm_image( TQImageIO *iio ) -{ - TQIODevice *d = iio->ioDevice(); - TQImage image = iio->image(); - int w = image.width(); - int h = image.height(); - int i; - TQString s = fbname(iio->fileName()); // get file base name - char *buf = new char[s.length() + 100]; - - sprintf( buf, "#define %s_width %d\n", s.ascii(), w ); - d->writeBlock( buf, tqstrlen(buf) ); - sprintf( buf, "#define %s_height %d\n", s.ascii(), h ); - d->writeBlock( buf, tqstrlen(buf) ); - sprintf( buf, "static char %s_bits[] = {\n ", s.ascii() ); - d->writeBlock( buf, tqstrlen(buf) ); - - iio->setStatus( 0 ); - - if ( image.depth() != 1 ) - image = image.convertDepth( 1 ); // dither - if ( image.bitOrder() != TQImage::LittleEndian ) - image = image.convertBitOrder( TQImage::LittleEndian ); - - bool invert = tqGray(image.color(0)) < tqGray(image.color(1)); - char hexrep[16]; - for ( i=0; i<10; i++ ) - hexrep[i] = '0' + i; - for ( i=10; i<16; i++ ) - hexrep[i] = 'a' -10 + i; - if ( invert ) { - char t; - for ( i=0; i<8; i++ ) { - t = hexrep[15-i]; - hexrep[15-i] = hexrep[i]; - hexrep[i] = t; - } - } - int bcnt = 0; - char *p = buf; - int bpl = (w+7)/8; - for (int y = 0; y < h; ++y) { - uchar *b = image.scanLine(y); - for (i = 0; i < bpl; ++i) { - *p++ = '0'; *p++ = 'x'; - *p++ = hexrep[*b >> 4]; - *p++ = hexrep[*b++ & 0xf]; - - if ( i < bpl - 1 || y < h - 1 ) { - *p++ = ','; - if ( ++bcnt > 14 ) { - *p++ = '\n'; - *p++ = ' '; - *p = '\0'; - if ( (int)tqstrlen(buf) != d->writeBlock( buf, tqstrlen(buf) ) ) { - iio->setStatus( 1 ); - delete [] buf; - return; - } - p = buf; - bcnt = 0; - } - } - } - } - strcpy( p, " };\n" ); - if ( (int)tqstrlen(buf) != d->writeBlock( buf, tqstrlen(buf) ) ) - iio->setStatus( 1 ); - delete [] buf; -} - -#endif // TQT_NO_IMAGEIO_XBM - - -#ifndef TQT_NO_IMAGEIO_XPM - -/***************************************************************************** - XPM image read/write functions - *****************************************************************************/ - - -// Skip until ", read until the next ", return the rest in *buf -// Returns FALSE on error, TRUE on success - -static bool read_xpm_string( TQCString &buf, TQIODevice *d, - const char * const *source, int &index ) -{ - if ( source ) { - buf = source[index++]; - return TRUE; - } - - if ( buf.size() < 69 ) //# just an approximation - buf.resize( 123 ); - - buf[0] = '\0'; - int c; - int i; - while ( (c=d->getch()) != EOF && c != '"' ) { } - if ( c == EOF ) { - return FALSE; - } - i = 0; - while ( (c=d->getch()) != EOF && c != '"' ) { - if ( i == (int)buf.size() ) - buf.resize( i*2+42 ); - buf[i++] = c; - } - if ( c == EOF ) { - return FALSE; - } - - if ( i == (int)buf.size() ) // always use a 0 terminator - buf.resize( i+1 ); - buf[i] = '\0'; - return TRUE; -} - - - -static int nextColorSpec(const TQCString & buf) -{ - int i = buf.find(" c "); - if (i < 0) - i = buf.find(" g "); - if (i < 0) - i = buf.find(" g4 "); - if (i < 0) - i = buf.find(" m "); - if (i < 0) - i = buf.find(" s "); - return i; -} - -// -// INTERNAL -// -// Reads an .xpm from either the TQImageIO or from the TQString *. -// One of the two HAS to be 0, the other one is used. -// - -static void read_xpm_image_or_array( TQImageIO * iio, const char * const * source, - TQImage & image) -{ - TQCString buf; - TQIODevice *d = 0; - buf.resize( 200 ); - - int i, cpp, ncols, w, h, index = 0; - - if ( iio ) { - iio->setStatus( 1 ); - d = iio ? iio->ioDevice() : 0; - d->readLine( buf.data(), buf.size() ); // "/* XPM */" - TQRegExp r( TQString::fromLatin1("/\\*.XPM.\\*/") ); - if ( buf.find(r) == -1 ) - return; // bad magic - } else if ( !source ) { - return; - } - - if ( !read_xpm_string( buf, d, source, index ) ) - return; - - if ( sscanf( buf, "%d %d %d %d", &w, &h, &ncols, &cpp ) < 4 ) - return; // < 4 numbers parsed - - if ( cpp > 15 ) - return; - - if ( ncols > 256 ) { - image.create( w, h, 32 ); - } else { - image.create( w, h, 8, ncols ); - } - - if (image.isNull()) - return; - - TQMap colorMap; - int currentColor; - - for( currentColor=0; currentColor < ncols; ++currentColor ) { - if ( !read_xpm_string( buf, d, source, index ) ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage: XPM color specification missing"); -#endif - return; - } - TQString index; - index = buf.left( cpp ); - buf = buf.mid( cpp ).simplifyWhiteSpace().lower(); - buf.prepend( " " ); - i = nextColorSpec(buf); - if ( i < 0 ) { -#if defined(QT_CHECK_RANGE) - tqWarning( "TQImage: XPM color specification is missing: %s", buf.data()); -#endif - return; // no c/g/g4/m/s specification at all - } - buf = buf.mid( i+3 ); - // Strip any other colorspec - int end = nextColorSpec(buf); - if (end != -1) - buf.truncate(end); - buf = buf.stripWhiteSpace(); - if ( buf == "none" ) { - image.setAlphaBuffer( TRUE ); - int transparentColor = currentColor; - if ( image.depth() == 8 ) { - image.setColor( transparentColor, - TQT_RGB_MASK & tqRgb(198,198,198) ); - colorMap.insert( index, transparentColor ); - } else { - TQRgb rgb = TQT_RGB_MASK & tqRgb(198,198,198); - colorMap.insert( index, rgb ); - } - } else { - if ( ((buf.length()-1) % 3) && (buf[0] == '#') ) { - buf.truncate (((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick - } - TQColor c( buf.data() ); - if ( image.depth() == 8 ) { - image.setColor( currentColor, 0xff000000 | c.rgb() ); - colorMap.insert( index, currentColor ); - } else { - TQRgb rgb = 0xff000000 | c.rgb(); - colorMap.insert( index, rgb ); - } - } - } - - // Read pixels - for( int y=0; ysetImage( image ); - iio->setStatus( 0 ); // image ok - } -} - - -static void read_xpm_image( TQImageIO * iio ) -{ - TQImage i; - (void)read_xpm_image_or_array( iio, 0, i ); - return; -} - - -static const char* xpm_color_name( int cpp, int index ) -{ - static char returnable[5]; - static const char code[] = ".#abcdefghijklmnopqrstuvwxyzABCD" - "EFGHIJKLMNOPQRSTUVWXYZ0123456789"; - // cpp is limited to 4 and index is limited to 64^cpp - if ( cpp > 1 ) { - if ( cpp > 2 ) { - if ( cpp > 3 ) { - returnable[3] = code[index % 64]; - index /= 64; - } else - returnable[3] = '\0'; - returnable[2] = code[index % 64]; - index /= 64; - } else - returnable[2] = '\0'; - // the following 4 lines are a joke! - if ( index == 0 ) - index = 64*44+21; - else if ( index == 64*44+21 ) - index = 0; - returnable[1] = code[index % 64]; - index /= 64; - } else - returnable[1] = '\0'; - returnable[0] = code[index]; - - return returnable; -} - - -// write XPM image data -static void write_xpm_image( TQImageIO * iio ) -{ - if ( iio ) - iio->setStatus( 1 ); - else - return; - - // ### 8-bit case could be made faster - TQImage image; - if ( iio->image().depth() != 32 ) - image = iio->image().convertDepth( 32 ); - else - image = iio->image(); - - TQMap colorMap; - - int w = image.width(), h = image.height(), ncolors = 0; - int x, y; - - // build color table - for( y=0; y k; k *= 64 ) { - ++cpp; - // limit to 4 characters per pixel - // 64^4 colors is enough for a 4096x4096 image - if ( cpp > 4) - break; - } - - TQString line; - - // write header - TQTextStream s( iio->ioDevice() ); - s << "/* XPM */" << endl - << "static char *" << fbname(iio->fileName()) << "[]={" << endl - << "\"" << w << " " << h << " " << ncolors << " " << cpp << "\""; - - // write palette - TQMap::Iterator c = colorMap.begin(); - while ( c != colorMap.end() ) { - TQRgb color = c.key(); - if ( image.hasAlphaBuffer() && color == (color & TQT_RGB_MASK) ) - line.sprintf( "\"%s c None\"", - xpm_color_name(cpp, *c) ); - else - line.sprintf( "\"%s c #%02x%02x%02x\"", - xpm_color_name(cpp, *c), - tqRed(color), - tqGreen(color), - tqBlue(color) ); - ++c; - s << "," << endl << line; - } - - // write pixels, limit to 4 characters per pixel - line.truncate( cpp*w ); - for( y=0; y 1 ) { - line[cc++] = chars[1]; - if ( cpp > 2 ) { - line[cc++] = chars[2]; - if ( cpp > 3 ) { - line[cc++] = chars[3]; - } - } - } - } - s << "," << endl << "\"" << line << "\""; - } - s << "};" << endl; - - iio->setStatus( 0 ); -} - -#endif // TQT_NO_IMAGEIO_XPM - -/*! - Returns an image with depth \a d, using the \a palette_count - colors pointed to by \a palette. If \a d is 1 or 8, the returned - image will have its color table ordered the same as \a palette. - - If the image needs to be modified to fit in a lower-resolution - result (e.g. converting from 32-bit to 8-bit), use the \a - conversion_flags to specify how you'd prefer this to happen. - - Note: currently no closest-color search is made. If colors are - found that are not in the palette, the palette may not be used at - all. This result should not be considered valid because it may - change in future implementations. - - Currently inefficient for non-32-bit images. - - \sa TQt::ImageConversionFlags -*/ -#ifndef TQT_NO_IMAGE_TRUECOLOR -TQImage TQImage::convertDepthWithPalette( int d, TQRgb* palette, int palette_count, int conversion_flags ) const -{ - if ( depth() == 1 ) { - return convertDepth( 8, conversion_flags ) - .convertDepthWithPalette( d, palette, palette_count, conversion_flags ); - } else if ( depth() == 8 ) { - // ### this could be easily made more efficient - return convertDepth( 32, conversion_flags ) - .convertDepthWithPalette( d, palette, palette_count, conversion_flags ); - } else { - TQImage result; - convert_32_to_8( this, &result, - (conversion_flags&~TQt::DitherMode_Mask) | TQt::AvoidDither, - palette, palette_count ); - return result.convertDepth( d ); - } -} -#endif -static -bool -haveSamePalette(const TQImage& a, const TQImage& b) -{ - if (a.depth() != b.depth()) return FALSE; - if (a.numColors() != b.numColors()) return FALSE; - TQRgb* ca = a.colorTable(); - TQRgb* cb = b.colorTable(); - for (int i=a.numColors(); i--; ) { - if (*ca++ != *cb++) return FALSE; - } - return TRUE; -} - -/*! - \relates TQImage - - Copies a block of pixels from \a src to \a dst. The pixels - copied from source (src) are converted according to - \a conversion_flags if it is incompatible with the destination - (\a dst). - - \a sx, \a sy is the top-left pixel in \a src, \a dx, \a dy - is the top-left position in \a dst and \a sw, \a sh is the - size of the copied block. - - The copying is clipped if areas outside \a src or \a dst are - specified. - - If \a sw is -1, it is adjusted to src->width(). Similarly, if \a - sh is -1, it is adjusted to src->height(). - - Currently inefficient for non 32-bit images. -*/ -void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src, - int sx, int sy, int sw, int sh, int conversion_flags ) -{ - // Parameter correction - if ( sw < 0 ) sw = src->width(); - if ( sh < 0 ) sh = src->height(); - if ( sx < 0 ) { dx -= sx; sw += sx; sx = 0; } - if ( sy < 0 ) { dy -= sy; sh += sy; sy = 0; } - if ( dx < 0 ) { sx -= dx; sw += dx; dx = 0; } - if ( dy < 0 ) { sy -= dy; sh += dy; dy = 0; } - if ( sx + sw > src->width() ) sw = src->width() - sx; - if ( sy + sh > src->height() ) sh = src->height() - sy; - if ( dx + sw > dst->width() ) sw = dst->width() - dx; - if ( dy + sh > dst->height() ) sh = dst->height() - dy; - if ( sw <= 0 || sh <= 0 ) return; // Nothing left to copy - if ( (dst->data == src->data) && dx==sx && dy==sy ) return; // Same pixels - - // "Easy" to copy if both same depth and one of: - // - 32 bit - // - 8 bit, identical palette - // - 1 bit, identical palette and byte-aligned area - // - if ( haveSamePalette(*dst,*src) - && ( (dst->depth() != 1) || - (!( (dx&7) || (sx&7) || - (((sw&7) && (sx+sw < src->width())) || - (dx+sw < dst->width()) ) )) ) ) - { - // easy to copy - } else if ( dst->depth() != 32 ) { -#ifndef TQT_NO_IMAGE_TRUECOLOR - - TQImage dstconv = dst->convertDepth( 32 ); - bitBlt( &dstconv, dx, dy, src, sx, sy, sw, sh, - (conversion_flags&~TQt::DitherMode_Mask) | TQt::AvoidDither ); - *dst = dstconv.convertDepthWithPalette( dst->depth(), - dst->colorTable(), dst->numColors() ); -#endif - return; - } - - // Now assume palette can be ignored - - if ( dst->depth() != src->depth() ) { - if ( ((sw == src->width()) && (sh == src->height())) || (dst->depth()==32) ) { - TQImage srcconv = src->convertDepth( dst->depth(), conversion_flags ); - bitBlt( dst, dx, dy, &srcconv, sx, sy, sw, sh, conversion_flags ); - } else { - TQImage srcconv = src->copy( sx, sy, sw, sh ); // ie. bitBlt - bitBlt( dst, dx, dy, &srcconv, 0, 0, sw, sh, conversion_flags ); - } - return; - } - - // Now assume both are the same depth. - - // Now assume both are 32-bit or 8-bit with compatible palettes. - - // "Easy" - - switch ( dst->depth() ) { - case 1: - { - uchar* d = dst->scanLine(dy) + dx/8; - uchar* s = src->scanLine(sy) + sx/8; - const int bw = (sw+7)/8; - if ( bw < 64 ) { - // Trust ourselves - const int dd = dst->bytesPerLine() - bw; - const int ds = src->bytesPerLine() - bw; - while ( sh-- ) { - for ( int t=bw; t--; ) - *d++ = *s++; - d += dd; - s += ds; - } - } else { - // Trust libc - const int dd = dst->bytesPerLine(); - const int ds = src->bytesPerLine(); - while ( sh-- ) { - memcpy( d, s, bw ); - d += dd; - s += ds; - } - } - } - break; - case 8: - { - uchar* d = dst->scanLine(dy) + dx; - uchar* s = src->scanLine(sy) + sx; - if ( sw < 64 ) { - // Trust ourselves - const int dd = dst->bytesPerLine() - sw; - const int ds = src->bytesPerLine() - sw; - while ( sh-- ) { - for ( int t=sw; t--; ) - *d++ = *s++; - d += dd; - s += ds; - } - } else { - // Trust libc - const int dd = dst->bytesPerLine(); - const int ds = src->bytesPerLine(); - while ( sh-- ) { - memcpy( d, s, sw ); - d += dd; - s += ds; - } - } - } - break; -#ifndef TQT_NO_IMAGE_TRUECOLOR - case 32: - if ( src->hasAlphaBuffer() ) { - TQRgb* d = (TQRgb*)dst->scanLine(dy) + dx; - TQRgb* s = (TQRgb*)src->scanLine(sy) + sx; - const int dd = dst->width() - sw; - const int ds = src->width() - sw; - while ( sh-- ) { - for ( int t=sw; t--; ) { - unsigned char a = tqAlpha(*s); - if ( a == 255 ) - *d++ = *s++; - else if ( a == 0 ) - ++d,++s; // nothing - else { - unsigned char r = ((tqRed(*s)-tqRed(*d)) * a) / 256 + tqRed(*d); - unsigned char g = ((tqGreen(*s)-tqGreen(*d)) * a) / 256 + tqGreen(*d); - unsigned char b = ((tqBlue(*s)-tqBlue(*d)) * a) / 256 + tqBlue(*d); - a = TQMAX(tqAlpha(*d),a); // alternatives... - *d++ = tqRgba(r,g,b,a); - ++s; - } - } - d += dd; - s += ds; - } - } else { - TQRgb* d = (TQRgb*)dst->scanLine(dy) + dx; - TQRgb* s = (TQRgb*)src->scanLine(sy) + sx; - if ( sw < 64 ) { - // Trust ourselves - const int dd = dst->width() - sw; - const int ds = src->width() - sw; - while ( sh-- ) { - for ( int t=sw; t--; ) - *d++ = *s++; - d += dd; - s += ds; - } - } else { - // Trust libc - const int dd = dst->width(); - const int ds = src->width(); - const int b = sw*sizeof(TQRgb); - while ( sh-- ) { - memcpy( d, s, b ); - d += dd; - s += ds; - } - } - } - break; -#endif // TQT_NO_IMAGE_TRUECOLOR - } -} - - -/*! - Returns TRUE if this image and image \a i have the same contents; - otherwise returns FALSE. The comparison can be slow, unless there - is some obvious difference, such as different widths, in which - case the function will return quickly. - - \sa operator=() -*/ - -bool TQImage::operator==( const TQImage & i ) const -{ - // same object, or shared? - if ( i.data == data ) - return TRUE; - // obviously different stuff? - if ( i.data->h != data->h || - i.data->w != data->w ) - return FALSE; - // not equal if one has alphabuffer and the other does not - if ( i.hasAlphaBuffer() != hasAlphaBuffer() ) - return FALSE; - // that was the fast bit... - TQImage i1 = convertDepth( 32 ); - TQImage i2 = i.convertDepth( 32 ); - int l; - // if no alpha buffer used, there might still be junk in the - // alpha bits; thus, we can't do memcmp-style comparison of scanlines - if ( !hasAlphaBuffer() ) { - int m; - TQRgb *i1line; - TQRgb *i2line; - for( l=0; l < data->h; l++ ) { - i1line = (uint *)i1.scanLine( l ); - i2line = (uint *)i2.scanLine( l ); - // compare pixels of scanline individually - for ( m=0; m < data->w; m++ ) - if ( (i1line[m] ^ i2line[m]) & 0x00FFFFFF ) - return FALSE; - } - } else { - // yay, we can do fast binary comparison on entire scanlines - for( l=0; l < data->h; l++ ) - if ( memcmp( i1.scanLine( l ), i2.scanLine( l ), 4*data->w ) ) - return FALSE; - } - return TRUE; -} - - -/*! - Returns TRUE if this image and image \a i have different contents; - otherwise returns FALSE. The comparison can be slow, unless there - is some obvious difference, such as different widths, in which - case the function will return quickly. - - \sa operator=() -*/ - -bool TQImage::operator!=( const TQImage & i ) const -{ - return !(*this == i); -} - - - - -/*! - \fn int TQImage::dotsPerMeterX() const - - Returns the number of pixels that fit horizontally in a physical - meter. This and dotsPerMeterY() define the intended scale and - aspect ratio of the image. - - \sa setDotsPerMeterX() -*/ - -/*! - \fn int TQImage::dotsPerMeterY() const - - Returns the number of pixels that fit vertically in a physical - meter. This and dotsPerMeterX() define the intended scale and - aspect ratio of the image. - - \sa setDotsPerMeterY() -*/ - -/*! - Sets the value returned by dotsPerMeterX() to \a x. -*/ -void TQImage::setDotsPerMeterX(int x) -{ - data->dpmx = x; -} - -/*! - Sets the value returned by dotsPerMeterY() to \a y. -*/ -void TQImage::setDotsPerMeterY(int y) -{ - data->dpmy = y; -} - -/*! - \fn TQPoint TQImage::offset() const - - Returns the number of pixels by which the image is intended to be - offset by when positioning relative to other images. -*/ - -/*! - Sets the value returned by offset() to \a p. -*/ -void TQImage::setOffset(const TQPoint& p) -{ - data->offset = p; -} -#ifndef TQT_NO_IMAGE_TEXT -/*! - \internal - - Returns the internal TQImageDataMisc object. This object will be - created if it doesn't already exist. -*/ -TQImageDataMisc& TQImage::misc() const -{ - if ( !data->misc ) - data->misc = new TQImageDataMisc; - return *data->misc; -} - -/*! - Returns the string recorded for the keyword \a key in language \a - lang, or in a default language if \a lang is 0. -*/ -TQString TQImage::text(const char* key, const char* lang) const -{ - TQImageTextKeyLang x(key,lang); - return misc().text_lang[x]; -} - -/*! - \overload - - Returns the string recorded for the keyword and language \a kl. -*/ -TQString TQImage::text(const TQImageTextKeyLang& kl) const -{ - return misc().text_lang[kl]; -} - -/*! - Returns the language identifiers for which some texts are - recorded. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - TQStringList list = myImage.textLanguages(); - TQStringList::Iterator it = list.begin(); - while( it != list.end() ) { - myProcessing( *it ); - ++it; - } - \endcode - - \sa textList() text() setText() textKeys() -*/ -TQStringList TQImage::textLanguages() const -{ - if ( !data->misc ) - return TQStringList(); - return misc().languages(); -} - -/*! - Returns the keywords for which some texts are recorded. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - TQStringList list = myImage.textKeys(); - TQStringList::Iterator it = list.begin(); - while( it != list.end() ) { - myProcessing( *it ); - ++it; - } - \endcode - - \sa textList() text() setText() textLanguages() -*/ -TQStringList TQImage::textKeys() const -{ - if ( !data->misc ) - return TQStringList(); - return misc().keys(); -} - -/*! - Returns a list of TQImageTextKeyLang objects that enumerate all the - texts key/language pairs set by setText() for this image. - - Note that if you want to iterate over the list, you should iterate - over a copy, e.g. - \code - TQValueList list = myImage.textList(); - TQValueList::Iterator it = list.begin(); - while( it != list.end() ) { - myProcessing( *it ); - ++it; - } - \endcode -*/ -TQValueList TQImage::textList() const -{ - if ( !data->misc ) - return TQValueList(); - return misc().list(); -} - -/*! - Records string \a s for the keyword \a key. The \a key should be a - portable keyword recognizable by other software - some suggested - values can be found in \link - http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.Anc-text - the PNG specification \endlink. \a s can be any text. \a lang - should specify the language code (see - \link http://www.rfc-editor.org/rfc/rfc1766.txt RFC 1766 \endlink) or 0. -*/ -void TQImage::setText(const char* key, const char* lang, const TQString& s) -{ - TQImageTextKeyLang x(key,lang); - misc().text_lang.replace(x,s); -} - -#endif // TQT_NO_IMAGE_TEXT - -#ifdef TQ_WS_QWS -/*! - \internal -*/ -TQGfx * TQImage::graphicsContext() -{ - TQGfx * ret=0; - if(depth()) { - int w = qt_screen->mapToDevice( TQSize(width(),height()) ).width(); - int h = qt_screen->mapToDevice( TQSize(width(),height()) ).height(); - ret=TQGfx::createGfx(depth(),bits(),w,h,bytesPerLine()); - } else { - tqDebug("Trying to create image for null depth"); - return 0; - } - if(depth()<=8) { - TQRgb * tmp=colorTable(); - int nc=numColors(); - if(tmp==0) { - static TQRgb table[2] = { tqRgb(255,255,255), tqRgb(0,0,0) }; - tmp=table; - nc=2; - } - ret->setClut(tmp,nc); - } - return ret; -} - -#endif diff --git a/src/kernel/qimageformatinterface_p.h b/src/kernel/qimageformatinterface_p.h deleted file mode 100644 index 8abe49c2d..000000000 --- a/src/kernel/qimageformatinterface_p.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#ifndef TQIMAGEFORMATINTERFACE_P_H -#define TQIMAGEFORMATINTERFACE_P_H - -#ifndef QT_H -#include -#endif // QT_H - -#if __GNUC__ - 0 > 3 -#pragma GCC system_header -#endif - -// -// W A R N I N G -// ------------- -// -// This file is not part of the TQt API. It exists for the convenience -// of internal files. This header file may change from version to version -// without notice, or even be removed. -// -// We mean it. -// -// - -#ifndef TQT_NO_COMPONENT - -// {04903F05-54B1-4726-A849-FB5CB097CA87} -#ifndef IID_QImageFormat -#define IID_QImageFormat TQUuid( 0x04903f05, 0x54b1, 0x4726, 0xa8, 0x49, 0xfb, 0x5c, 0xb0, 0x97, 0xca, 0x87 ) -#endif - -class TQImage; - -struct TQ_EXPORT TQImageFormatInterface : public TQFeatureListInterface -{ - virtual TQRESULT loadImage( const TQString &format, const TQString &filename, TQImage * ) = 0; - virtual TQRESULT saveImage( const TQString &format, const TQString &filename, const TQImage & ) = 0; - - virtual TQRESULT installIOHandler( const TQString & ) = 0; -}; - -#endif // TQT_NO_COMPONENT - -#endif // TQIMAGEFORMATINTERFACE_P_H diff --git a/src/kernel/qimageformatplugin.cpp b/src/kernel/qimageformatplugin.cpp deleted file mode 100644 index 3982053e0..000000000 --- a/src/kernel/qimageformatplugin.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/**************************************************************************** -** -** ... -** -** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. -** -** This file is part of the kernel module of the TQt GUI Toolkit. -** -** This file may be used under the terms of the GNU General -** Public License versions 2.0 or 3.0 as published by the Free -** Software Foundation and appearing in the files LICENSE.GPL2 -** and LICENSE.GPL3 included in the packaging of this file. -** Alternatively you may (at your option) use any later version -** of the GNU General Public License if such license has been -** publicly approved by Trolltech ASA (or its successors, if any) -** and the KDE Free TQt Foundation. -** -** Please review the following information to ensure GNU General -** Public Licensing requirements will be met: -** http://trolltech.com/products/qt/licenses/licensing/opensource/. -** If you are unsure which license is appropriate for your use, please -** review the following information: -** http://trolltech.com/products/qt/licenses/licensing/licensingoverview -** or contact the sales department at sales@trolltech.com. -** -** This file may be used under the terms of the Q Public License as -** defined by Trolltech ASA and appearing in the file LICENSE.TQPL -** included in the packaging of this file. Licensees holding valid TQt -** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted -** herein. -** -**********************************************************************/ - -#include "ntqimageformatplugin.h" -#ifndef TQT_NO_IMAGEFORMATPLUGIN -#include "qimageformatinterface_p.h" -#include "ntqimage.h" - -/*! - \class TQImageFormatPlugin ntqimageformatplugin.h - \brief The TQImageFormatPlugin class provides an abstract base for custom image format plugins. - - \ingroup plugins - - The image format plugin is a simple plugin interface that makes - it easy to create custom image formats that can be used - transparently by applications. - - Writing an image format plugin is achieved by subclassing this - base class, reimplementing the pure virtual functions keys() and - installIOHandler(), and exporting the class with the - TQ_EXPORT_PLUGIN macro. See the \link plugins-howto.html Plugins - documentation\endlink for details. -*/ - -/*! - \fn TQStringList TQImageFormatPlugin::keys() const - - Returns the list of image formats this plugin supports. - - \sa installIOHandler() -*/ - - -/*! - \fn bool TQImageFormatPlugin::installIOHandler( const TQString &format ) - - Installs a TQImageIO image I/O handler for the image format \a - format. - - \sa keys() -*/ - -class TQImageFormatPluginPrivate : public TQImageFormatInterface -{ -public: - TQImageFormatPluginPrivate( TQImageFormatPlugin *p ) - : plugin( p ) - { - } - virtual ~TQImageFormatPluginPrivate(); - - TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); - TQ_REFCOUNT; - - TQStringList featureList() const; - - TQRESULT loadImage( const TQString &format, const TQString &filename, TQImage * ); - TQRESULT saveImage( const TQString &format, const TQString &filename, const TQImage & ); - - TQRESULT installIOHandler( const TQString & ); - -private: - TQImageFormatPlugin *plugin; -}; - -TQImageFormatPluginPrivate::~TQImageFormatPluginPrivate() -{ - delete plugin; -} - -TQRESULT TQImageFormatPluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) -{ - *iface = 0; - - if ( iid == IID_QUnknown ) - *iface = this; - else if ( iid == IID_QFeatureList ) - *iface = this; - else if ( iid == IID_QImageFormat ) - *iface = this; - else - return TQE_NOINTERFACE; - - (*iface)->addRef(); - return TQS_OK; -} - -TQStringList TQImageFormatPluginPrivate::featureList() const -{ - return plugin->keys(); -} - -TQRESULT TQImageFormatPluginPrivate::loadImage( const TQString &format, const TQString &filename, TQImage *image ) -{ - return plugin->loadImage( format, filename, image ) ? TQS_FALSE : TQS_OK; -} - -TQRESULT TQImageFormatPluginPrivate::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) -{ - return plugin->saveImage( format, filename, image ) ? TQS_FALSE : TQS_OK; -} - -TQRESULT TQImageFormatPluginPrivate::installIOHandler( const TQString &format ) -{ - return plugin->installIOHandler( format ) ? TQS_FALSE : TQS_OK; -} - -/*! - Constructs an image format plugin. This is invoked automatically - by the TQ_EXPORT_PLUGIN macro. -*/ -TQImageFormatPlugin::TQImageFormatPlugin() - : TQGPlugin( d = new TQImageFormatPluginPrivate( this ) ) -{ -} - -/*! - Destroys the image format plugin. - - You never have to call this explicitly. TQt destroys a plugin - automatically when it is no longer used. -*/ -TQImageFormatPlugin::~TQImageFormatPlugin() -{ -} - - -/*!\internal - */ -bool TQImageFormatPlugin::loadImage( const TQString &format, const TQString &filename, TQImage *image ) -{ - Q_UNUSED( format ) - Q_UNUSED( filename ) - Q_UNUSED( image ) - return FALSE; -} - -/*! \internal - */ -bool TQImageFormatPlugin::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) -{ - Q_UNUSED( format ) - Q_UNUSED( filename ) - Q_UNUSED( image ) - return FALSE; -} - -#endif // TQT_NO_IMAGEFORMATPLUGIN diff --git a/src/kernel/qjpegio.cpp b/src/kernel/qjpegio.cpp index 91df6f976..c30853d02 100644 --- a/src/kernel/qjpegio.cpp +++ b/src/kernel/qjpegio.cpp @@ -38,7 +38,7 @@ ** **********************************************************************/ -#include "ntqimage.h" +#include "tqimage.h" #ifndef TQT_NO_IMAGEIO_JPEG diff --git a/src/kernel/qmngio.cpp b/src/kernel/qmngio.cpp index fad1aa9b3..deb0225c3 100644 --- a/src/kernel/qmngio.cpp +++ b/src/kernel/qmngio.cpp @@ -42,7 +42,7 @@ #ifndef TQT_NO_IMAGEIO_MNG -#include "ntqimage.h" +#include "tqimage.h" #include "ntqasyncimageio.h" #include "ntqiodevice.h" #include "ntqmngio.h" @@ -310,7 +310,7 @@ TQMNGFormat::TQMNGFormat() TQMNGFormat::~TQMNGFormat() { // We're setting the consumer to 0 since it may have been - // deleted by read_async_image in qimage.cpp + // deleted by read_async_image in tqimage.cpp consumer = 0; if (handle) mng_cleanup(&handle); } diff --git a/src/kernel/qpainter.cpp b/src/kernel/qpainter.cpp index da78db89f..3f91a8023 100644 --- a/src/kernel/qpainter.cpp +++ b/src/kernel/qpainter.cpp @@ -45,7 +45,7 @@ #include "tqptrdict.h" #include "ntqdatastream.h" #include "tqwidget.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpaintdevicemetrics.h" #include "ntqapplication.h" #include "qrichtext_p.h" diff --git a/src/kernel/qpicture.cpp b/src/kernel/qpicture.cpp index 0fd609d79..912fbfb5b 100644 --- a/src/kernel/qpicture.cpp +++ b/src/kernel/qpicture.cpp @@ -44,7 +44,7 @@ #include "ntqpainter.h" #include "ntqpixmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqfile.h" #include "ntqdatastream.h" #include "ntqpaintdevicemetrics.h" diff --git a/src/kernel/qpixmap.cpp b/src/kernel/qpixmap.cpp index 9c93632c1..7ba49ee4e 100644 --- a/src/kernel/qpixmap.cpp +++ b/src/kernel/qpixmap.cpp @@ -41,7 +41,7 @@ #include "ntqpixmap.h" #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "tqwidget.h" #include "ntqpainter.h" #include "ntqdatastream.h" diff --git a/src/kernel/qpixmap_x11.cpp b/src/kernel/qpixmap_x11.cpp index d0bfa97a2..b40247af9 100644 --- a/src/kernel/qpixmap_x11.cpp +++ b/src/kernel/qpixmap_x11.cpp @@ -69,7 +69,7 @@ #include "ntqbitmap.h" #include "ntqpaintdevicemetrics.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqwmatrix.h" #include "ntqapplication.h" #include "qt_x11_p.h" @@ -286,7 +286,7 @@ static XImage* qt_XShmGetImage( const TQPixmap* pix, int format, Internal functions *****************************************************************************/ -extern const uchar *qt_get_bitflip_array(); // defined in qimage.cpp +extern const uchar *qt_get_bitflip_array(); // defined in tqimage.cpp static uchar *flip_bits( const uchar *bits, int len ) { diff --git a/src/kernel/qpsprinter.cpp b/src/kernel/qpsprinter.cpp index 58a23dfcf..d845f8c30 100644 --- a/src/kernel/qpsprinter.cpp +++ b/src/kernel/qpsprinter.cpp @@ -59,7 +59,7 @@ #include "ntqpainter.h" #include "ntqapplication.h" #include "ntqpaintdevicemetrics.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqdatetime.h" #include "ntqstring.h" #include "ntqdict.h" diff --git a/src/kernel/qregion_x11.cpp b/src/kernel/qregion_x11.cpp index b5417a40a..7662a168d 100644 --- a/src/kernel/qregion_x11.cpp +++ b/src/kernel/qregion_x11.cpp @@ -41,7 +41,7 @@ #include "ntqregion.h" #include "ntqpointarray.h" #include "ntqbuffer.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqbitmap.h" #include "qt_x11_p.h" diff --git a/src/kernel/qrichtext.cpp b/src/kernel/qrichtext.cpp index a74433d47..c5e4be5e3 100644 --- a/src/kernel/qrichtext.cpp +++ b/src/kernel/qrichtext.cpp @@ -52,7 +52,7 @@ #include "ntqfileinfo.h" #include "ntqstylesheet.h" #include "ntqmime.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqdragobject.h" #include "ntqpaintdevicemetrics.h" #include "ntqpainter.h" diff --git a/src/kernel/qt_kernel.pri b/src/kernel/qt_kernel.pri index f21fbfd17..cf370058b 100644 --- a/src/kernel/qt_kernel.pri +++ b/src/kernel/qt_kernel.pri @@ -32,9 +32,9 @@ kernel { $$KERNEL_H/ntqguardedptr.h \ $$KERNEL_H/ntqgif.h \ $$KERNEL_H/ntqiconset.h \ - $$KERNEL_H/ntqimage.h \ - $$KERNEL_P/qimageformatinterface_p.h \ - $$KERNEL_H/ntqimageformatplugin.h \ + $$KERNEL_H/tqimage.h \ + $$KERNEL_P/tqimageformatinterface_p.h \ + $$KERNEL_H/tqimageformatplugin.h \ $$KERNEL_H/ntqkeycode.h \ $$KERNEL_H/ntqkeysequence.h \ $$KERNEL_H/ntqlayout.h \ @@ -216,8 +216,8 @@ kernel { $$KERNEL_CPP/qfontdatabase.cpp \ $$KERNEL_CPP/qguardedptr.cpp \ $$KERNEL_CPP/qiconset.cpp \ - $$KERNEL_CPP/qimage.cpp \ - $$KERNEL_CPP/qimageformatplugin.cpp \ + $$KERNEL_CPP/tqimage.cpp \ + $$KERNEL_CPP/tqimageformatplugin.cpp \ $$KERNEL_CPP/qkeysequence.cpp \ $$KERNEL_CPP/qlayout.cpp \ $$KERNEL_CPP/qlayoutengine.cpp \ diff --git a/src/kernel/qt_pch.h b/src/kernel/qt_pch.h index 54b968234..49f0cf73d 100644 --- a/src/kernel/qt_pch.h +++ b/src/kernel/qt_pch.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include // All moc genereated code has this include #include #include diff --git a/src/kernel/qvariant.cpp b/src/kernel/qvariant.cpp index f7479fb68..991dfcd35 100644 --- a/src/kernel/qvariant.cpp +++ b/src/kernel/qvariant.cpp @@ -46,7 +46,7 @@ #include "ntqcstring.h" #include "ntqfont.h" #include "ntqpixmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqbrush.h" #include "ntqpoint.h" #include "ntqrect.h" diff --git a/src/kernel/tqimage.cpp b/src/kernel/tqimage.cpp new file mode 100644 index 000000000..7a454818e --- /dev/null +++ b/src/kernel/tqimage.cpp @@ -0,0 +1,6531 @@ +/**************************************************************************** +** +** Implementation of TQImage and TQImageIO classes +** +** Created : 950207 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqimage.h" +#include "ntqregexp.h" +#include "ntqfile.h" +#include "ntqdatastream.h" +#include "ntqtextstream.h" +#include "ntqbuffer.h" +#include "tqptrlist.h" +#include "ntqasyncimageio.h" +#include "ntqpngio.h" +#include "ntqmngio.h" +#include "ntqjpegio.h" +#include "tqmap.h" +#include +#include "tqimageformatinterface_p.h" +#include "ntqwmatrix.h" +#include "ntqapplication.h" +#include "ntqmime.h" +#include "ntqdragobject.h" +#include +#include + +#ifdef TQ_WS_QWS +#include "qgfx_qws.h" +#endif + +// 16bpp images on supported on TQt/Embedded +#if !defined( TQ_WS_QWS ) && !defined(TQT_NO_IMAGE_16_BIT) +#define TQT_NO_IMAGE_16_BIT +#endif + + +/*! + \class TQImage + \brief The TQImage class provides a hardware-independent pixmap + representation with direct access to the pixel data. + + \ingroup images + \ingroup graphics + \ingroup shared + \mainclass + + It is one of the two classes TQt provides for dealing with images, + the other being TQPixmap. TQImage is designed and optimized for I/O + and for direct pixel access/manipulation. TQPixmap is designed and + optimized for drawing. There are (slow) functions to convert + between TQImage and TQPixmap: TQPixmap::convertToImage() and + TQPixmap::convertFromImage(). + + An image has the parameters \link width() width\endlink, \link + height() height\endlink and \link depth() depth\endlink (bits per + pixel, bpp), a color table and the actual \link bits() + pixels\endlink. TQImage supports 1-bpp, 8-bpp and 32-bpp image + data. 1-bpp and 8-bpp images use a color lookup table; the pixel + value is a color table index. + + 32-bpp images encode an RGB value in 24 bits and ignore the color + table. The most significant byte is used for the \link + setAlphaBuffer() alpha buffer\endlink. + + An entry in the color table is an RGB triplet encoded as a \c + uint. Use the \link ::tqRed() tqRed()\endlink, \link ::tqGreen() + tqGreen()\endlink and \link ::tqBlue() tqBlue()\endlink functions (\c + ntqcolor.h) to access the components, and \link ::tqRgb() + tqRgb\endlink to make an RGB triplet (see the TQColor class + documentation). + + 1-bpp (monochrome) images have a color table with a most two + colors. There are two different formats: big endian (MSB first) or + little endian (LSB first) bit order. To access a single bit you + will must do some bit shifts: + + \code + TQImage image; + // sets bit at (x,y) to 1 + if ( image.bitOrder() == TQImage::LittleEndian ) + *(image.scanLine(y) + (x >> 3)) |= 1 << (x & 7); + else + *(image.scanLine(y) + (x >> 3)) |= 1 << (7 - (x & 7)); + \endcode + + If this looks complicated, it might be a good idea to convert the + 1-bpp image to an 8-bpp image using convertDepth(). + + 8-bpp images are much easier to work with than 1-bpp images + because they have a single byte per pixel: + + \code + TQImage image; + // set entry 19 in the color table to yellow + image.setColor( 19, tqRgb(255,255,0) ); + // set 8 bit pixel at (x,y) to value yellow (in color table) + *(image.scanLine(y) + x) = 19; + \endcode + + 32-bpp images ignore the color table; instead, each pixel contains + the RGB triplet. 24 bits contain the RGB value; the most + significant byte is reserved for the alpha buffer. + + \code + TQImage image; + // sets 32 bit pixel at (x,y) to yellow. + uint *p = (uint *)image.scanLine(y) + x; + *p = tqRgb(255,255,0); + \endcode + + On TQt/Embedded, scanlines are aligned to the pixel depth and may + be padded to any degree, while on all other platforms, the + scanlines are 32-bit aligned for all depths. The constructor + taking a \c{uchar*} argument always expects 32-bit aligned data. + On TQt/Embedded, an additional constructor allows the number of + bytes-per-line to be specified. + + TQImage supports a variety of methods for getting information about + the image, for example, colorTable(), allGray(), isGrayscale(), + bitOrder(), bytesPerLine(), depth(), dotsPerMeterX() and + dotsPerMeterY(), hasAlphaBuffer(), numBytes(), numColors(), and + width() and height(). + + Pixel colors are retrieved with pixel() and set with setPixel(). + + TQImage also supports a number of functions for creating a new + image that is a transformed version of the original. For example, + copy(), convertBitOrder(), convertDepth(), createAlphaMask(), + createHeuristicMask(), mirror(), scale(), smoothScale(), swapRGB() + and xForm(). There are also functions for changing attributes of + an image in-place, for example, setAlphaBuffer(), setColor(), + setDotsPerMeterX() and setDotsPerMeterY() and setNumColors(). + + Images can be loaded and saved in the supported formats. Images + are saved to a file with save(). Images are loaded from a file + with load() (or in the constructor) or from an array of data with + loadFromData(). The lists of supported formats are available from + inputFormatList() and outputFormatList(). + + Strings of text may be added to images using setText(). + + The TQImage class uses explicit \link shclass.html sharing\endlink, + similar to that used by TQMemArray. + + New image formats can be added as \link plugins-howto.html + plugins\endlink. + + \sa TQImageIO TQPixmap \link shclass.html Shared Classes\endlink +*/ + + +/*! + \enum TQImage::Endian + + This enum type is used to describe the endianness of the CPU and + graphics hardware. + + \value IgnoreEndian Endianness does not matter. Useful for some + operations that are independent of endianness. + \value BigEndian Network byte order, as on SPARC and Motorola CPUs. + \value LittleEndian PC/Alpha byte order. +*/ + +/*! + \enum TQt::ImageConversionFlags + + The conversion flag is a bitwise-OR of the following values. The + options marked "(default)" are set if no other values from the + list are included (since the defaults are zero): + + Color/Mono preference (ignored for TQBitmap) + \value AutoColor (default) - If the image has \link + TQImage::depth() depth\endlink 1 and contains only + black and white pixels, the pixmap becomes monochrome. + \value ColorOnly The pixmap is dithered/converted to the + \link TQPixmap::defaultDepth() native display depth\endlink. + \value MonoOnly The pixmap becomes monochrome. If necessary, + it is dithered using the chosen dithering algorithm. + + Dithering mode preference for RGB channels + \value DiffuseDither (default) - A high-quality dither. + \value OrderedDither A faster, more ordered dither. + \value ThresholdDither No dithering; closest color is used. + + Dithering mode preference for alpha channel + \value ThresholdAlphaDither (default) - No dithering. + \value OrderedAlphaDither A faster, more ordered dither. + \value DiffuseAlphaDither A high-quality dither. + \value NoAlpha Not supported. + + Color matching versus dithering preference + \value PreferDither (default when converting to a pixmap) - Always dither + 32-bit images when the image is converted to 8 bits. + \value AvoidDither (default when converting for the purpose of saving to + file) - Dither 32-bit images only if the image has more than 256 + colors and it is being converted to 8 bits. + \value AutoDither Not supported. + + The following are not values that are used directly, but masks for + the above classes: + \value ColorMode_Mask Mask for the color mode. + \value Dither_Mask Mask for the dithering mode for RGB channels. + \value AlphaDither_Mask Mask for the dithering mode for the alpha channel. + \value DitherMode_Mask Mask for the mode that determines the preference of + color matching versus dithering. + + Using 0 as the conversion flag sets all the default options. +*/ + +#if defined(Q_CC_DEC) && defined(__alpha) && (__DECCXX_VER-0 >= 50190001) +#pragma message disable narrowptr +#endif + +#ifndef TQT_NO_IMAGE_TEXT +class TQImageDataMisc { +public: + TQImageDataMisc() { } + TQImageDataMisc( const TQImageDataMisc& o ) : + text_lang(o.text_lang) { } + + TQImageDataMisc& operator=(const TQImageDataMisc& o) + { + text_lang = o.text_lang; + return *this; + } + TQValueList list() + { + return text_lang.keys(); + } + + TQStringList languages() + { + TQStringList r; + TQMap::Iterator it = text_lang.begin(); + for ( ; it != text_lang.end(); ++it ) { + r.remove( it.key().lang ); + r.append( it.key().lang ); + } + return r; + } + TQStringList keys() + { + TQStringList r; + TQMap::Iterator it = text_lang.begin(); + for ( ; it != text_lang.end(); ++it ) { + r.remove( it.key().key ); + r.append( it.key().key ); + } + return r; + } + + TQMap text_lang; +}; +#endif // TQT_NO_IMAGE_TEXT + + + +/***************************************************************************** + TQImage member functions + *****************************************************************************/ + +// table to flip bits +static const uchar bitflip[256] = { + /* + open OUT, "| fmt"; + for $i (0..255) { + print OUT (($i >> 7) & 0x01) | (($i >> 5) & 0x02) | + (($i >> 3) & 0x04) | (($i >> 1) & 0x08) | + (($i << 7) & 0x80) | (($i << 5) & 0x40) | + (($i << 3) & 0x20) | (($i << 1) & 0x10), ", "; + } + close OUT; + */ + 0, 128, 64, 192, 32, 160, 96, 224, 16, 144, 80, 208, 48, 176, 112, 240, + 8, 136, 72, 200, 40, 168, 104, 232, 24, 152, 88, 216, 56, 184, 120, 248, + 4, 132, 68, 196, 36, 164, 100, 228, 20, 148, 84, 212, 52, 180, 116, 244, + 12, 140, 76, 204, 44, 172, 108, 236, 28, 156, 92, 220, 60, 188, 124, 252, + 2, 130, 66, 194, 34, 162, 98, 226, 18, 146, 82, 210, 50, 178, 114, 242, + 10, 138, 74, 202, 42, 170, 106, 234, 26, 154, 90, 218, 58, 186, 122, 250, + 6, 134, 70, 198, 38, 166, 102, 230, 22, 150, 86, 214, 54, 182, 118, 246, + 14, 142, 78, 206, 46, 174, 110, 238, 30, 158, 94, 222, 62, 190, 126, 254, + 1, 129, 65, 193, 33, 161, 97, 225, 17, 145, 81, 209, 49, 177, 113, 241, + 9, 137, 73, 201, 41, 169, 105, 233, 25, 153, 89, 217, 57, 185, 121, 249, + 5, 133, 69, 197, 37, 165, 101, 229, 21, 149, 85, 213, 53, 181, 117, 245, + 13, 141, 77, 205, 45, 173, 109, 237, 29, 157, 93, 221, 61, 189, 125, 253, + 3, 131, 67, 195, 35, 163, 99, 227, 19, 147, 83, 211, 51, 179, 115, 243, + 11, 139, 75, 203, 43, 171, 107, 235, 27, 155, 91, 219, 59, 187, 123, 251, + 7, 135, 71, 199, 39, 167, 103, 231, 23, 151, 87, 215, 55, 183, 119, 247, + 15, 143, 79, 207, 47, 175, 111, 239, 31, 159, 95, 223, 63, 191, 127, 255 +}; + +const uchar *qt_get_bitflip_array() // called from TQPixmap code +{ + return bitflip; +} + + +/*! + Constructs a null image. + + \sa isNull() +*/ + +TQImage::TQImage() +{ + init(); +} + +/*! + Constructs an image with \a w width, \a h height, \a depth bits + per pixel, \a numColors colors and bit order \a bitOrder. + + Using this constructor is the same as first constructing a null + image and then calling the create() function. + + \sa create() +*/ + +TQImage::TQImage( int w, int h, int depth, int numColors, Endian bitOrder ) +{ + init(); + create( w, h, depth, numColors, bitOrder ); +} + +/*! + Constructs an image with size \a size pixels, depth \a depth bits, + \a numColors and \a bitOrder endianness. + + Using this constructor is the same as first constructing a null + image and then calling the create() function. + + \sa create() +*/ +TQImage::TQImage( const TQSize& size, int depth, int numColors, Endian bitOrder ) +{ + init(); + create( size, depth, numColors, bitOrder ); +} + +#ifndef TQT_NO_IMAGEIO +/*! + Constructs an image and tries to load the image from the file \a + fileName. + + If \a format is specified, the loader attempts to read the image + using the specified format. If \a format is not specified (which + is the default), the loader reads a few bytes from the header to + guess the file format. + + If the loading of the image failed, this object is a \link + isNull() null\endlink image. + + The TQImageIO documentation lists the supported image formats and + explains how to add extra formats. + + \sa load() isNull() TQImageIO +*/ + +TQImage::TQImage( const TQString &fileName, const char* format ) +{ + init(); + load( fileName, format ); +} + +#ifndef TQT_NO_IMAGEIO_XPM +// helper +static void read_xpm_image_or_array( TQImageIO *, const char * const *, TQImage & ); +#endif +/*! + Constructs an image from \a xpm, which must be a valid XPM image. + + Errors are silently ignored. + + Note that it's possible to squeeze the XPM variable a little bit + by using an unusual declaration: + + \code + static const char * const start_xpm[]={ + "16 15 8 1", + "a c #cec6bd", + .... + \endcode + + The extra \c const makes the entire definition read-only, which is + slightly more efficient (e.g. when the code is in a shared + library) and ROMable when the application is to be stored in ROM. +*/ + +TQImage::TQImage( const char * const xpm[] ) +{ + init(); +#ifndef TQT_NO_IMAGEIO_XPM + read_xpm_image_or_array( 0, xpm, *this ); +#else + // We use a tqFatal rather than disabling the whole function, as this + // constructor may be ambiguous. + tqFatal("XPM not supported"); +#endif +} + +/*! + Constructs an image from the binary data \a array. It tries to + guess the file format. + + If the loading of the image failed, this object is a \link + isNull() null\endlink image. + + \sa loadFromData() isNull() imageFormat() +*/ +TQImage::TQImage( const TQByteArray &array ) +{ + init(); + loadFromData(array); +} +#endif //TQT_NO_IMAGEIO + + +/*! + Constructs a \link shclass.html shallow copy\endlink of \a image. +*/ + +TQImage::TQImage( const TQImage &image ) +{ + data = image.data; + data->ref(); +} + +/*! + Constructs an image \a w pixels wide, \a h pixels high with a + color depth of \a depth, that uses an existing memory buffer, \a + yourdata. The buffer must remain valid throughout the life of the + TQImage. The image does not delete the buffer at destruction. + + If \a colortable is 0, a color table sufficient for \a numColors + will be allocated (and destructed later). + + Note that \a yourdata must be 32-bit aligned. + + The endianness is given in \a bitOrder. +*/ +TQImage::TQImage( uchar* yourdata, int w, int h, int depth, + TQRgb* colortable, int numColors, + Endian bitOrder ) +{ + init(); + int bpl = ((w*depth+31)/32)*4; // bytes per scanline + if ( w <= 0 || h <= 0 || depth <= 0 || numColors < 0 + || INT_MAX / sizeof(uchar *) < uint(h) + || INT_MAX / uint(depth) < uint(w) + || bpl <= 0 + || INT_MAX / uint(bpl) < uint(h) ) + return; // invalid parameter(s) + data->w = w; + data->h = h; + data->d = depth; + data->ncols = depth != 32 ? numColors : 0; + if ( !yourdata ) + return; // Image header info can be saved without needing to allocate memory. + data->nbytes = bpl*h; + if ( colortable || !data->ncols ) { + data->ctbl = colortable; + data->ctbl_mine = FALSE; + } else { + // calloc since we realloc, etc. later (ick) + data->ctbl = (TQRgb*)calloc( data->ncols*sizeof(TQRgb), data->ncols ); + TQ_CHECK_PTR(data->ctbl); + data->ctbl_mine = TRUE; + } + uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); + TQ_CHECK_PTR(jt); + for (int j=0; jbits = jt; + data->bitordr = bitOrder; +} + +#ifdef TQ_WS_QWS + +/*! + Constructs an image that uses an existing memory buffer. The + buffer must remain valid for the life of the TQImage. The image + does not delete the buffer at destruction. The buffer is passed as + \a yourdata. The image's width is \a w and its height is \a h. The + color depth is \a depth. \a bpl specifies the number of bytes per + line. + + If \a colortable is 0, a color table sufficient for \a numColors + will be allocated (and destructed later). + + The endianness is specified by \a bitOrder. + + \warning This constructor is only available on TQt/Embedded. +*/ +TQImage::TQImage( uchar* yourdata, int w, int h, int depth, + int bpl, TQRgb* colortable, int numColors, + Endian bitOrder ) +{ + init(); + if ( !yourdata || w <= 0 || h <= 0 || depth <= 0 || numColors < 0 + || INT_MAX / sizeof(uchar *) < uint(h) + || INT_MAX / uint(bpl) < uint(h) + ) + return; // invalid parameter(s) + data->w = w; + data->h = h; + data->d = depth; + data->ncols = numColors; + data->nbytes = bpl * h; + if ( colortable || !numColors ) { + data->ctbl = colortable; + data->ctbl_mine = FALSE; + } else { + // calloc since we realloc, etc. later (ick) + data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), numColors ); + TQ_CHECK_PTR(data->ctbl); + data->ctbl_mine = TRUE; + } + uchar** jt = (uchar**)malloc(h*sizeof(uchar*)); + TQ_CHECK_PTR(jt); + for (int j=0; jbits = jt; + data->bitordr = bitOrder; +} +#endif // TQ_WS_QWS + +/*! + Destroys the image and cleans up. +*/ + +TQImage::~TQImage() +{ + if ( data && data->deref() ) { + reset(); + delete data; + } +} + + + + +/*! Convenience function. Gets the data associated with the absolute + name \a abs_name from the default mime source factory and decodes it + to an image. + + \sa TQMimeSourceFactory, TQImage::fromMimeSource(), TQImageDrag::decode() +*/ +#ifndef TQT_NO_MIME +TQImage TQImage::fromMimeSource( const TQString &abs_name ) +{ + const TQMimeSource *m = TQMimeSourceFactory::defaultFactory()->data( abs_name ); + if ( !m ) { +#if defined(QT_CHECK_STATE) + tqWarning("TQImage::fromMimeSource: Cannot find image \"%s\" in the mime source factory", abs_name.latin1() ); +#endif + return TQImage(); + } + TQImage img; + TQImageDrag::decode( m, img ); + return img; +} +#endif + + +/*! + Assigns a \link shclass.html shallow copy\endlink of \a image to + this image and returns a reference to this image. + + \sa copy() +*/ + +TQImage &TQImage::operator=( const TQImage &image ) +{ + image.data->ref(); // avoid 'x = x' + if ( data->deref() ) { + reset(); + delete data; + } + data = image.data; + return *this; +} + +/*! + \overload + + Sets the image bits to the \a pixmap contents and returns a + reference to the image. + + If the image shares data with other images, it will first + dereference the shared data. + + Makes a call to TQPixmap::convertToImage(). +*/ + +TQImage &TQImage::operator=( const TQPixmap &pixmap ) +{ + *this = pixmap.convertToImage(); + return *this; +} + +/*! + Detaches from shared image data and makes sure that this image is + the only one referring to the data. + + If multiple images share common data, this image makes a copy of + the data and detaches itself from the sharing mechanism. + Nothing is done if there is just a single reference. + + \sa copy() +*/ + +void TQImage::detach() +{ + if ( data->count != 1 ) + *this = copy(); +} + +/*! + Returns a \link shclass.html deep copy\endlink of the image. + + \sa detach() +*/ + +TQImage TQImage::copy() const +{ + if ( isNull() ) { + // maintain the fields of invalid TQImages when copied + return TQImage( 0, width(), height(), depth(), colorTable(), numColors(), bitOrder() ); + } else { + TQImage image; + image.create( width(), height(), depth(), numColors(), bitOrder() ); +#ifdef TQ_WS_QWS + // TQt/Embedded can create images with non-default bpl + // make sure we don't crash. + if ( image.numBytes() != numBytes() ) + for ( int i = 0; i < height(); i++ ) + memcpy( image.scanLine(i), scanLine(i), image.bytesPerLine() ); + else +#endif + memcpy( image.bits(), bits(), numBytes() ); + memcpy( image.colorTable(), colorTable(), numColors() * sizeof(TQRgb) ); + image.setAlphaBuffer( hasAlphaBuffer() ); + image.data->dpmx = dotsPerMeterX(); + image.data->dpmy = dotsPerMeterY(); + image.data->offset = offset(); +#ifndef TQT_NO_IMAGE_TEXT + if ( data->misc ) { + image.data->misc = new TQImageDataMisc; + *image.data->misc = misc(); + } +#endif + return image; + } +} + +/*! + \overload + + Returns a \link shclass.html deep copy\endlink of a sub-area of + the image. + + The returned image is always \a w by \a h pixels in size, and is + copied from position \a x, \a y in this image. In areas beyond + this image pixels are filled with pixel 0. + + If the image needs to be modified to fit in a lower-resolution + result (e.g. converting from 32-bit to 8-bit), use the \a + conversion_flags to specify how you'd prefer this to happen. + + \sa bitBlt() TQt::ImageConversionFlags +*/ + +TQImage TQImage::copy(int x, int y, int w, int h, int conversion_flags) const +{ + int dx = 0; + int dy = 0; + if ( w <= 0 || h <= 0 ) return TQImage(); // Nothing to copy + + TQImage image( w, h, depth(), numColors(), bitOrder() ); + + if ( x < 0 || y < 0 || x + w > width() || y + h > height() ) { + // bitBlt will not cover entire image - clear it. + // ### should deal with each side separately for efficiency + image.fill(0); + if ( x < 0 ) { + dx = -x; + x = 0; + } + if ( y < 0 ) { + dy = -y; + y = 0; + } + } + + bool has_alpha = hasAlphaBuffer(); + if ( has_alpha ) { + // alpha channel should be only copied, not used by bitBlt(), and + // this is mutable, we will restore the image state before returning + TQImage *that = (TQImage *) this; + that->setAlphaBuffer( FALSE ); + } + memcpy( image.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); + bitBlt( &image, dx, dy, this, x, y, -1, -1, conversion_flags ); + if ( has_alpha ) { + // restore image state + TQImage *that = (TQImage *) this; + that->setAlphaBuffer( TRUE ); + } + image.setAlphaBuffer(hasAlphaBuffer()); + image.data->dpmx = dotsPerMeterX(); + image.data->dpmy = dotsPerMeterY(); + image.data->offset = offset(); +#ifndef TQT_NO_IMAGE_TEXT + if ( data->misc ) { + image.data->misc = new TQImageDataMisc; + *image.data->misc = misc(); + } +#endif + return image; +} + +/*! + \overload TQImage TQImage::copy(const TQRect& r) const + + Returns a \link shclass.html deep copy\endlink of a sub-area of + the image. + + The returned image always has the size of the rectangle \a r. In + areas beyond this image pixels are filled with pixel 0. +*/ + +/*! + \fn bool TQImage::isNull() const + + Returns TRUE if it is a null image; otherwise returns FALSE. + + A null image has all parameters set to zero and no allocated data. +*/ + + +/*! + \fn int TQImage::width() const + + Returns the width of the image. + + \sa height() size() rect() +*/ + +/*! + \fn int TQImage::height() const + + Returns the height of the image. + + \sa width() size() rect() +*/ + +/*! + \fn TQSize TQImage::size() const + + Returns the size of the image, i.e. its width and height. + + \sa width() height() rect() +*/ + +/*! + \fn TQRect TQImage::rect() const + + Returns the enclosing rectangle (0, 0, width(), height()) of the + image. + + \sa width() height() size() +*/ + +/*! + \fn int TQImage::depth() const + + Returns the depth of the image. + + The image depth is the number of bits used to encode a single + pixel, also called bits per pixel (bpp) or bit planes of an image. + + The supported depths are 1, 8, 16 (TQt/Embedded only) and 32. + + \sa convertDepth() +*/ + +/*! + \fn int TQImage::numColors() const + + Returns the size of the color table for the image. + + Notice that numColors() returns 0 for 16-bpp (TQt/Embedded only) + and 32-bpp images because these images do not use color tables, + but instead encode pixel values as RGB triplets. + + \sa setNumColors() colorTable() +*/ + +/*! + \fn TQImage::Endian TQImage::bitOrder() const + + Returns the bit order for the image. + + If it is a 1-bpp image, this function returns either + TQImage::BigEndian or TQImage::LittleEndian. + + If it is not a 1-bpp image, this function returns + TQImage::IgnoreEndian. + + \sa depth() +*/ + +/*! + \fn uchar **TQImage::jumpTable() const + + Returns a pointer to the scanline pointer table. + + This is the beginning of the data block for the image. + + \sa bits() scanLine() +*/ + +/*! + \fn TQRgb *TQImage::colorTable() const + + Returns a pointer to the color table. + + \sa numColors() +*/ + +/*! + \fn int TQImage::numBytes() const + + Returns the number of bytes occupied by the image data. + + \sa bytesPerLine() bits() +*/ + +/*! + \fn int TQImage::bytesPerLine() const + + Returns the number of bytes per image scanline. This is equivalent + to numBytes()/height(). + + \sa numBytes() scanLine() +*/ + +/*! + \fn TQRgb TQImage::color( int i ) const + + Returns the color in the color table at index \a i. The first + color is at index 0. + + A color value is an RGB triplet. Use the \link ::tqRed() + tqRed()\endlink, \link ::tqGreen() tqGreen()\endlink and \link + ::tqBlue() tqBlue()\endlink functions (defined in \c ntqcolor.h) to + get the color value components. + + \sa setColor() numColors() TQColor +*/ + +/*! + \fn void TQImage::setColor( int i, TQRgb c ) + + Sets a color in the color table at index \a i to \a c. + + A color value is an RGB triplet. Use the \link ::tqRgb() + tqRgb()\endlink function (defined in \c ntqcolor.h) to make RGB + triplets. + + \sa color() setNumColors() numColors() +*/ + +/*! + \fn uchar *TQImage::scanLine( int i ) const + + Returns a pointer to the pixel data at the scanline with index \a + i. The first scanline is at index 0. + + The scanline data is aligned on a 32-bit boundary. + + \warning If you are accessing 32-bpp image data, cast the returned + pointer to \c{TQRgb*} (TQRgb has a 32-bit size) and use it to + read/write the pixel value. You cannot use the \c{uchar*} pointer + directly, because the pixel format depends on the byte order on + the underlying platform. Hint: use \link ::tqRed() tqRed()\endlink, + \link ::tqGreen() tqGreen()\endlink and \link ::tqBlue() + tqBlue()\endlink, etc. (ntqcolor.h) to access the pixels. + + \warning If you are accessing 16-bpp image data, you must handle + endianness yourself. (TQt/Embedded only) + + \sa bytesPerLine() bits() jumpTable() +*/ + +/*! + \fn uchar *TQImage::bits() const + + Returns a pointer to the first pixel data. This is equivalent to + scanLine(0). + + \sa numBytes() scanLine() jumpTable() +*/ + + + +void TQImage::warningIndexRange( const char *func, int i ) +{ +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::%s: Index %d out of range", func, i ); +#else + Q_UNUSED( func ) + Q_UNUSED( i ) +#endif +} + + +/*! + Resets all image parameters and deallocates the image data. +*/ + +void TQImage::reset() +{ + freeBits(); + setNumColors( 0 ); +#ifndef TQT_NO_IMAGE_TEXT + delete data->misc; +#endif + reinit(); +} + + +/*! + Fills the entire image with the pixel value \a pixel. + + If the \link depth() depth\endlink of this image is 1, only the + lowest bit is used. If you say fill(0), fill(2), etc., the image + is filled with 0s. If you say fill(1), fill(3), etc., the image is + filled with 1s. If the depth is 8, the lowest 8 bits are used. + + If the depth is 32 and the image has no alpha buffer, the \a pixel + value is written to each pixel in the image. If the image has an + alpha buffer, only the 24 RGB bits are set and the upper 8 bits + (alpha value) are left unchanged. + + Note: TQImage::pixel() returns the color of the pixel at the given + coordinates; TQColor::pixel() returns the pixel value of the + underlying window system (essentially an index value), so normally + you will want to use TQImage::pixel() to use a color from an + existing image or TQColor::rgb() to use a specific color. + + \sa invertPixels() depth() hasAlphaBuffer() create() +*/ + +void TQImage::fill( uint pixel ) +{ + if ( depth() == 1 || depth() == 8 ) { + if ( depth() == 1 ) { + if ( pixel & 1 ) + pixel = 0xffffffff; + else + pixel = 0; + } else { + uint c = pixel & 0xff; + pixel = c | ((c << 8) & 0xff00) | ((c << 16) & 0xff0000) | + ((c << 24) & 0xff000000); + } + int bpl = bytesPerLine(); + for ( int i=0; i // needed for systemBitOrder +#include +#include +#if defined(Q_OS_WIN32) +#undef open +#undef close +#undef read +#undef write +#endif +#endif + +// POSIX Large File Support redefines open -> open64 +#if defined(open) +# undef open +#endif + +// POSIX Large File Support redefines truncate -> truncate64 +#if defined(truncate) +# undef truncate +#endif + +/*! + Determines the bit order of the display hardware. Returns + TQImage::LittleEndian (LSB first) or TQImage::BigEndian (MSB first). + + \sa systemByteOrder() +*/ + +TQImage::Endian TQImage::systemBitOrder() +{ +#if defined(TQ_WS_X11) + return BitmapBitOrder(tqt_xdisplay()) == MSBFirst ? BigEndian :LittleEndian; +#else + return BigEndian; +#endif +} + + +/*! + Resizes the color table to \a numColors colors. + + If the color table is expanded all the extra colors will be set to + black (RGB 0,0,0). + + \sa numColors() color() setColor() colorTable() +*/ + +void TQImage::setNumColors( int numColors ) +{ + if ( numColors == data->ncols ) + return; + if ( numColors == 0 ) { // use no color table + if ( data->ctbl ) { + if ( data->ctbl_mine ) + free( data->ctbl ); + else + data->ctbl_mine = TRUE; + data->ctbl = 0; + } + data->ncols = 0; + return; + } + if ( data->ctbl && data->ctbl_mine ) { // already has color table + data->ctbl = (TQRgb*)realloc( data->ctbl, numColors*sizeof(TQRgb) ); + if ( data->ctbl && numColors > data->ncols ) + memset( (char *)&data->ctbl[data->ncols], 0, + (numColors-data->ncols)*sizeof(TQRgb) ); + } else { // create new color table + data->ctbl = (TQRgb*)calloc( numColors*sizeof(TQRgb), 1 ); + TQ_CHECK_PTR(data->ctbl); + data->ctbl_mine = TRUE; + } + data->ncols = data->ctbl == 0 ? 0 : numColors; +} + + +/*! + \fn bool TQImage::hasAlphaBuffer() const + + Returns TRUE if alpha buffer mode is enabled; otherwise returns + FALSE. + + \sa setAlphaBuffer() +*/ + +/*! + Enables alpha buffer mode if \a enable is TRUE, otherwise disables + it. The default setting is disabled. + + An 8-bpp image has 8-bit pixels. A pixel is an index into the + \link color() color table\endlink, which contains 32-bit color + values. In a 32-bpp image, the 32-bit pixels are the color values. + + This 32-bit value is encoded as follows: The lower 24 bits are + used for the red, green, and blue components. The upper 8 bits + contain the alpha component. + + The alpha component specifies the transparency of a pixel. 0 means + completely transparent and 255 means opaque. The alpha component + is ignored if you do not enable alpha buffer mode. + + The alpha buffer is used to set a mask when a TQImage is translated + to a TQPixmap. + + \sa hasAlphaBuffer() createAlphaMask() +*/ + +void TQImage::setAlphaBuffer( bool enable ) +{ + data->alpha = enable; +} + + +/*! + Sets the image \a width, \a height, \a depth, its number of colors + (in \a numColors), and bit order. Returns TRUE if successful, or + FALSE if the parameters are incorrect or if memory cannot be + allocated. + + The \a width and \a height is limited to 32767. \a depth must be + 1, 8, or 32. If \a depth is 1, \a bitOrder must be set to + either TQImage::LittleEndian or TQImage::BigEndian. For other depths + \a bitOrder must be TQImage::IgnoreEndian. + + This function allocates a color table and a buffer for the image + data. The image data is not initialized. + + The image buffer is allocated as a single block that consists of a + table of \link scanLine() scanline\endlink pointers (jumpTable()) + and the image data (bits()). + + \sa fill() width() height() depth() numColors() bitOrder() + jumpTable() scanLine() bits() bytesPerLine() numBytes() +*/ + +bool TQImage::create( int width, int height, int depth, int numColors, + Endian bitOrder ) +{ + reset(); // reset old data + if ( width <= 0 || height <= 0 || depth <= 0 || numColors < 0 ) + return FALSE; // invalid parameter(s) + if ( depth == 1 && bitOrder == IgnoreEndian ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::create: Bit order is required for 1 bpp images" ); +#endif + return FALSE; + } + if ( depth != 1 ) + bitOrder = IgnoreEndian; + +#if defined(QT_CHECK_RANGE) + if ( depth == 24 ) + tqWarning( "TQImage::create: 24-bpp images no longer supported, " + "use 32-bpp instead" ); +#endif + switch ( depth ) { + case 1: + case 8: +#ifndef TQT_NO_IMAGE_16_BIT + case 16: +#endif +#ifndef TQT_NO_IMAGE_TRUECOLOR + case 32: +#endif + break; + default: // invalid depth + return FALSE; + } + + if ( depth == 32 ) + numColors = 0; + setNumColors( numColors ); + if ( data->ncols != numColors ) // could not alloc color table + return FALSE; + + if ( INT_MAX / uint(depth) < uint(width) ) { // sanity check for potential overflow + setNumColors( 0 ); + return FALSE; + } +// TQt/Embedded doesn't waste memory on unnecessary padding. +#ifdef TQ_WS_QWS + const int bpl = (width*depth+7)/8; // bytes per scanline + const int pad = 0; +#else + const int bpl = ((width*depth+31)/32)*4; // bytes per scanline + // #### WWA: shouldn't this be (width*depth+7)/8: + const int pad = bpl - (width*depth)/8; // pad with zeros +#endif + if ( INT_MAX / uint(bpl) < uint(height) + || bpl < 0 + || INT_MAX / sizeof(uchar *) < uint(height) ) { // sanity check for potential overflow + setNumColors( 0 ); + return FALSE; + } + int nbytes = bpl*height; // image size + int ptbl = height*sizeof(uchar*); // pointer table size + int size = nbytes + ptbl; // total size of data block + uchar **p = (uchar **)malloc( size ); // alloc image bits + TQ_CHECK_PTR(p); + if ( !p ) { // no memory + setNumColors( 0 ); + return FALSE; + } + data->w = width; + data->h = height; + data->d = depth; + data->nbytes = nbytes; + data->bitordr = bitOrder; + data->bits = p; // set image pointer + //uchar *d = (uchar*)p + ptbl; // setup scanline pointers + uchar *d = (uchar*)(p + height); // setup scanline pointers + while ( height-- ) { + *p++ = d; + if ( pad ) + memset( d+bpl-pad, 0, pad ); + d += bpl; + } + return TRUE; +} + +/*! + \overload bool TQImage::create( const TQSize&, int depth, int numColors, Endian bitOrder ) +*/ +bool TQImage::create( const TQSize& size, int depth, int numColors, + TQImage::Endian bitOrder ) +{ + return create(size.width(), size.height(), depth, numColors, bitOrder); +} + +/*! + \internal + Initializes the image data structure. +*/ + +void TQImage::init() +{ + data = new TQImageData; + TQ_CHECK_PTR( data ); + reinit(); +} + +void TQImage::reinit() +{ + data->w = data->h = data->d = data->ncols = 0; + data->nbytes = 0; + data->ctbl = 0; + data->bits = 0; + data->bitordr = TQImage::IgnoreEndian; + data->alpha = FALSE; +#ifndef TQT_NO_IMAGE_TEXT + data->misc = 0; +#endif + data->dpmx = 0; + data->dpmy = 0; + data->offset = TQPoint(0,0); +} + +/*! + \internal + Deallocates the image data and sets the bits pointer to 0. +*/ + +void TQImage::freeBits() +{ + if ( data->bits ) { // dealloc image bits + free( data->bits ); + data->bits = 0; + } +} + + +/***************************************************************************** + Internal routines for converting image depth. + *****************************************************************************/ + +// +// convert_32_to_8: Converts a 32 bits depth (true color) to an 8 bit +// image with a colormap. If the 32 bit image has more than 256 colors, +// we convert the red,green and blue bytes into a single byte encoded +// as 6 shades of each of red, green and blue. +// +// if dithering is needed, only 1 color at most is available for alpha. +// +#ifndef TQT_NO_IMAGE_TRUECOLOR +struct TQRgbMap { + TQRgbMap() : rgb(0xffffffff) { } + bool used() const { return rgb!=0xffffffff; } + uchar pix; + TQRgb rgb; +}; + +static bool convert_32_to_8( const TQImage *src, TQImage *dst, int conversion_flags, TQRgb* palette=0, int palette_count=0 ) +{ + TQRgb *p; + uchar *b; + bool do_quant = FALSE; + int y, x; + + if ( !dst->create(src->width(), src->height(), 8, 256) ) + return FALSE; + + const int tablesize = 997; // prime + TQRgbMap table[tablesize]; + int pix=0; + TQRgb amask = src->hasAlphaBuffer() ? 0xffffffff : 0x00ffffff; + if ( src->hasAlphaBuffer() ) + dst->setAlphaBuffer(TRUE); + + if ( palette ) { + // Preload palette into table. + + p = palette; + // Almost same code as pixel insertion below + while ( palette_count-- > 0 ) { + // Find in table... + int hash = (*p & amask) % tablesize; + for (;;) { + if ( table[hash].used() ) { + if ( table[hash].rgb == (*p & amask) ) { + // Found previous insertion - use it + break; + } else { + // Keep searching... + if (++hash == tablesize) hash = 0; + } + } else { + // Cannot be in table + Q_ASSERT ( pix != 256 ); // too many colors + // Insert into table at this unused position + dst->setColor( pix, (*p & amask) ); + table[hash].pix = pix++; + table[hash].rgb = *p & amask; + break; + } + } + p++; + } + } + + if ( (conversion_flags & TQt::DitherMode_Mask) == TQt::PreferDither ) { + do_quant = TRUE; + } else { + for ( y=0; yheight(); y++ ) { // check if <= 256 colors + p = (TQRgb *)src->scanLine(y); + b = dst->scanLine(y); + x = src->width(); + while ( x-- ) { + // Find in table... + int hash = (*p & amask) % tablesize; + for (;;) { + if ( table[hash].used() ) { + if ( table[hash].rgb == (*p & amask) ) { + // Found previous insertion - use it + break; + } else { + // Keep searching... + if (++hash == tablesize) hash = 0; + } + } else { + // Cannot be in table + if ( pix == 256 ) { // too many colors + do_quant = TRUE; + // Break right out + x = 0; + y = src->height(); + } else { + // Insert into table at this unused position + dst->setColor( pix, (*p & amask) ); + table[hash].pix = pix++; + table[hash].rgb = (*p & amask); + } + break; + } + } + *b++ = table[hash].pix; // May occur once incorrectly + p++; + } + } + } + int ncols = do_quant ? 256 : pix; + + static uint bm[16][16]; + static int init=0; + if (!init) { + // Build a Bayer Matrix for dithering + + init = 1; + int n, i, j; + + bm[0][0]=0; + + for (n=1; n<16; n*=2) { + for (i=0; isetNumColors( ncols ); + + if ( do_quant ) { // quantization needed + +#define MAX_R 5 +#define MAX_G 5 +#define MAX_B 5 +#define INDEXOF(r,g,b) (((r)*(MAX_G+1)+(g))*(MAX_B+1)+(b)) + + int rc, gc, bc; + + for ( rc=0; rc<=MAX_R; rc++ ) // build 6x6x6 color cube + for ( gc=0; gc<=MAX_G; gc++ ) + for ( bc=0; bc<=MAX_B; bc++ ) { + dst->setColor( INDEXOF(rc,gc,bc), + (amask&0xff000000) + | tqRgb( rc*255/MAX_R, gc*255/MAX_G, bc*255/MAX_B ) ); + } + + int sw = src->width(); + + int* line1[3]; + int* line2[3]; + int* pv[3]; + if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::DiffuseDither ) { + line1[0] = new int[sw]; + line2[0] = new int[sw]; + line1[1] = new int[sw]; + line2[1] = new int[sw]; + line1[2] = new int[sw]; + line2[2] = new int[sw]; + pv[0] = new int[sw]; + pv[1] = new int[sw]; + pv[2] = new int[sw]; + } + + for ( y=0; y < src->height(); y++ ) { + p = (TQRgb *)src->scanLine(y); + b = dst->scanLine(y); + TQRgb *end = p + sw; + + // perform quantization + if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::ThresholdDither ) { +#define DITHER(p,m) ((uchar) ((p * (m) + 127) / 255)) + while ( p < end ) { + rc = tqRed( *p ); + gc = tqGreen( *p ); + bc = tqBlue( *p ); + + *b++ = + INDEXOF( + DITHER(rc, MAX_R), + DITHER(gc, MAX_G), + DITHER(bc, MAX_B) + ); + + p++; + } +#undef DITHER + } else if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::OrderedDither ) { +#define DITHER(p,d,m) ((uchar) ((((256 * (m) + (m) + 1)) * (p) + (d)) / 65536 )) + + int x = 0; + while ( p < end ) { + uint d = bm[y&15][x&15]; + + rc = tqRed( *p ); + gc = tqGreen( *p ); + bc = tqBlue( *p ); + + *b++ = + INDEXOF( + DITHER(rc, d, MAX_R), + DITHER(gc, d, MAX_G), + DITHER(bc, d, MAX_B) + ); + + p++; + x++; + } +#undef DITHER + } else { // Diffuse + int endian = (TQImage::systemByteOrder() == TQImage::BigEndian); + int x; + uchar* q = src->scanLine(y); + uchar* q2 = src->scanLine(y+1 < src->height() ? y + 1 : 0); + for (int chan = 0; chan < 3; chan++) { + b = dst->scanLine(y); + int *l1 = (y&1) ? line2[chan] : line1[chan]; + int *l2 = (y&1) ? line1[chan] : line2[chan]; + if ( y == 0 ) { + for (int i=0; iheight() ) { + for (int i=0; i>4; + l2[x+1] += err>>4; + } + l2[x]+=(err*5)>>4; + if (x>1) + l2[x-1]+=(err*3)>>4; + } + } else { + for (x=sw; x-->0; ) { + int pix = TQMAX(TQMIN(5, (l1[x] * 5 + 128)/ 255), 0); + int err = l1[x] - pix * 255 / 5; + pv[chan][x] = pix; + + // Spread the error around... + if ( x > 0 ) { + l1[x-1] += (err*7)>>4; + l2[x-1] += err>>4; + } + l2[x]+=(err*5)>>4; + if (x+1 < sw) + l2[x+1]+=(err*3)>>4; + } + } + } + if (endian) { + for (x=0; xhasAlphaBuffer() ) { + const int trans = 216; + dst->setColor(trans, 0x00000000); // transparent + TQImage mask = src->createAlphaMask(conversion_flags); + uchar* m; + for ( y=0; y < src->height(); y++ ) { + uchar bit = 0x80; + m = mask.scanLine(y); + b = dst->scanLine(y); + int w = src->width(); + for ( x = 0; x>= 1)) { + bit = 0x80; + while ( xcreate(src->width(), src->height(), 32) ) + return FALSE; // create failed + dst->setAlphaBuffer( src->hasAlphaBuffer() ); + for ( int y=0; yheight(); y++ ) { // for each scan line... + uint *p = (uint *)dst->scanLine(y); + uchar *b = src->scanLine(y); + uint *end = p + dst->width(); + while ( p < end ) + *p++ = src->color(*b++); + } + return TRUE; +} + + +static bool convert_1_to_32( const TQImage *src, TQImage *dst ) +{ + if ( !dst->create(src->width(), src->height(), 32) ) + return FALSE; // could not create + dst->setAlphaBuffer( src->hasAlphaBuffer() ); + for ( int y=0; yheight(); y++ ) { // for each scan line... + uint *p = (uint *)dst->scanLine(y); + uchar *b = src->scanLine(y); + int x; + if ( src->bitOrder() == TQImage::BigEndian ) { + for ( x=0; xwidth(); x++ ) { + *p++ = src->color( (*b >> (7 - (x & 7))) & 1 ); + if ( (x & 7) == 7 ) + b++; + } + } else { + for ( x=0; xwidth(); x++ ) { + *p++ = src->color( (*b >> (x & 7)) & 1 ); + if ( (x & 7) == 7 ) + b++; + } + } + } + return TRUE; +} +#endif // TQT_NO_IMAGE_TRUECOLOR + +static bool convert_1_to_8( const TQImage *src, TQImage *dst ) +{ + if ( !dst->create(src->width(), src->height(), 8, 2) ) + return FALSE; // something failed + dst->setAlphaBuffer( src->hasAlphaBuffer() ); + if (src->numColors() >= 2) { + dst->setColor( 0, src->color(0) ); // copy color table + dst->setColor( 1, src->color(1) ); + } else { + // Unlikely, but they do exist + if (src->numColors() >= 1) + dst->setColor( 0, src->color(0) ); + else + dst->setColor( 0, 0xffffffff ); + dst->setColor( 1, 0xff000000 ); + } + for ( int y=0; yheight(); y++ ) { // for each scan line... + uchar *p = dst->scanLine(y); + uchar *b = src->scanLine(y); + int x; + if ( src->bitOrder() == TQImage::BigEndian ) { + for ( x=0; xwidth(); x++ ) { + *p++ = (*b >> (7 - (x & 7))) & 1; + if ( (x & 7) == 7 ) + b++; + } + } else { + for ( x=0; xwidth(); x++ ) { + *p++ = (*b >> (x & 7)) & 1; + if ( (x & 7) == 7 ) + b++; + } + } + } + return TRUE; +} + +#ifndef TQT_NO_IMAGE_DITHER_TO_1 +// +// dither_to_1: Uses selected dithering algorithm. +// + +static bool dither_to_1( const TQImage *src, TQImage *dst, + int conversion_flags, bool fromalpha ) +{ + if ( !dst->create(src->width(), src->height(), 1, 2, TQImage::BigEndian) ) + return FALSE; // something failed + + enum { Threshold, Ordered, Diffuse } dithermode; + + if ( fromalpha ) { + if ( ( conversion_flags & TQt::AlphaDither_Mask ) == TQt::DiffuseAlphaDither ) + dithermode = Diffuse; + else if ( ( conversion_flags & TQt::AlphaDither_Mask ) == TQt::OrderedAlphaDither ) + dithermode = Ordered; + else + dithermode = Threshold; + } else { + if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::ThresholdDither ) + dithermode = Threshold; + else if ( ( conversion_flags & TQt::Dither_Mask ) == TQt::OrderedDither ) + dithermode = Ordered; + else + dithermode = Diffuse; + } + + dst->setColor( 0, tqRgb(255, 255, 255) ); + dst->setColor( 1, tqRgb( 0, 0, 0) ); + int w = src->width(); + int h = src->height(); + int d = src->depth(); + uchar gray[256]; // gray map for 8 bit images + bool use_gray = d == 8; + if ( use_gray ) { // make gray map + if ( fromalpha ) { + // Alpha 0x00 -> 0 pixels (white) + // Alpha 0xFF -> 1 pixels (black) + for ( int i=0; inumColors(); i++ ) + gray[i] = (255 - (src->color(i) >> 24)); + } else { + // Pixel 0x00 -> 1 pixels (black) + // Pixel 0xFF -> 0 pixels (white) + for ( int i=0; inumColors(); i++ ) + gray[i] = tqGray( src->color(i) & 0x00ffffff ); + } + } + + switch ( dithermode ) { + case Diffuse: { + int *line1 = new int[w]; + int *line2 = new int[w]; + int bmwidth = (w+7)/8; + if ( !(line1 && line2) ) + return FALSE; + uchar *p; + uchar *end; + int *b1, *b2; + int wbytes = w * (d/8); + p = src->bits(); + end = p + wbytes; + b2 = line2; + if ( use_gray ) { // 8 bit image + while ( p < end ) + *b2++ = gray[*p++]; +#ifndef TQT_NO_IMAGE_TRUECOLOR + } else { // 32 bit image + if ( fromalpha ) { + while ( p < end ) { + *b2++ = 255 - (*(uint*)p >> 24); + p += 4; + } + } else { + while ( p < end ) { + *b2++ = tqGray(*(uint*)p); + p += 4; + } + } +#endif + } + int x, y; + for ( y=0; yscanLine(y+1); + end = p + wbytes; + b2 = line2; + if ( use_gray ) { // 8 bit image + while ( p < end ) + *b2++ = gray[*p++]; +#ifndef TQT_NO_IMAGE_TRUECOLOR + } else { // 24 bit image + if ( fromalpha ) { + while ( p < end ) { + *b2++ = 255 - (*(uint*)p >> 24); + p += 4; + } + } else { + while ( p < end ) { + *b2++ = tqGray(*(uint*)p); + p += 4; + } + } +#endif + } + } + + int err; + p = dst->scanLine( y ); + memset( p, 0, bmwidth ); + b1 = line1; + b2 = line2; + int bit = 7; + for ( x=1; x<=w; x++ ) { + if ( *b1 < 128 ) { // black pixel + err = *b1++; + *p |= 1 << bit; + } else { // white pixel + err = *b1++ - 255; + } + if ( bit == 0 ) { + p++; + bit = 7; + } else { + bit--; + } + if ( x < w ) + *b1 += (err*7)>>4; // spread error to right pixel + if ( not_last_line ) { + b2[0] += (err*5)>>4; // pixel below + if ( x > 1 ) + b2[-1] += (err*3)>>4; // pixel below left + if ( x < w ) + b2[1] += err>>4; // pixel below right + } + b2++; + } + } + delete [] line1; + delete [] line2; + } break; + case Ordered: { + static uint bm[16][16]; + static int init=0; + if (!init) { + // Build a Bayer Matrix for dithering + + init = 1; + int n, i, j; + + bm[0][0]=0; + + for (n=1; n<16; n*=2) { + for (i=0; ifill( 0 ); + uchar** mline = dst->jumpTable(); +#ifndef TQT_NO_IMAGE_TRUECOLOR + if ( d == 32 ) { + uint** line = (uint**)src->jumpTable(); + for ( int i=0; i> 24) >= bm[j++&15][i&15] ) + *m |= 1 << bit; + if ( bit == 0 ) { + m++; + bit = 7; + } else { + bit--; + } + } + } else { + while ( p < end ) { + if ( (uint)tqGray(*p++) < bm[j++&15][i&15] ) + *m |= 1 << bit; + if ( bit == 0 ) { + m++; + bit = 7; + } else { + bit--; + } + } + } + } + } else +#endif // TQT_NO_IMAGE_TRUECOLOR + /* ( d == 8 ) */ { + uchar** line = src->jumpTable(); + for ( int i=0; ifill( 0 ); + uchar** mline = dst->jumpTable(); +#ifndef TQT_NO_IMAGE_TRUECOLOR + if ( d == 32 ) { + uint** line = (uint**)src->jumpTable(); + for ( int i=0; i> 24) >= 128 ) + *m |= 1 << bit; // Set mask "on" + if ( bit == 0 ) { + m++; + bit = 7; + } else { + bit--; + } + } + } else { + while ( p < end ) { + if ( tqGray(*p++) < 128 ) + *m |= 1 << bit; // Set pixel "black" + if ( bit == 0 ) { + m++; + bit = 7; + } else { + bit--; + } + } + } + } + } else +#endif //TQT_NO_IMAGE_TRUECOLOR + if ( d == 8 ) { + uchar** line = src->jumpTable(); + for ( int i=0; i> 11; + int g=(c & 0x07e0) >> 6; //green/2 + int b=(c & 0x001f); + return r == g && g == b; +} + + +static bool convert_16_to_32( const TQImage *src, TQImage *dst ) +{ + if ( !dst->create(src->width(), src->height(), 32) ) + return FALSE; // create failed + dst->setAlphaBuffer( src->hasAlphaBuffer() ); + for ( int y=0; yheight(); y++ ) { // for each scan line... + uint *p = (uint *)dst->scanLine(y); + ushort *s = (ushort*)src->scanLine(y); + uint *end = p + dst->width(); + while ( p < end ) + *p++ = qt_conv16ToRgb( *s++ ); + } + return TRUE; +} + + +static bool convert_32_to_16( const TQImage *src, TQImage *dst ) +{ + if ( !dst->create(src->width(), src->height(), 16) ) + return FALSE; // create failed + dst->setAlphaBuffer( src->hasAlphaBuffer() ); + for ( int y=0; yheight(); y++ ) { // for each scan line... + ushort *p = (ushort *)dst->scanLine(y); + uint *s = (uint*)src->scanLine(y); + ushort *end = p + dst->width(); + while ( p < end ) + *p++ = qt_convRgbTo16( *s++ ); + } + return TRUE; +} + + +#endif + +/*! + Converts the depth (bpp) of the image to \a depth and returns the + converted image. The original image is not changed. + + The \a depth argument must be 1, 8, 16 (TQt/Embedded only) or 32. + + Returns \c *this if \a depth is equal to the image depth, or a + \link isNull() null\endlink image if this image cannot be + converted. + + If the image needs to be modified to fit in a lower-resolution + result (e.g. converting from 32-bit to 8-bit), use the \a + conversion_flags to specify how you'd prefer this to happen. + + \sa TQt::ImageConversionFlags depth() isNull() +*/ + +TQImage TQImage::convertDepth( int depth, int conversion_flags ) const +{ + TQImage image; + if ( data->d == depth ) + image = *this; // no conversion +#ifndef TQT_NO_IMAGE_DITHER_TO_1 + else if ( (data->d == 8 || data->d == 32) && depth == 1 ) // dither + dither_to_1( this, &image, conversion_flags, FALSE ); +#endif +#ifndef TQT_NO_IMAGE_TRUECOLOR + else if ( data->d == 32 && depth == 8 ) // 32 -> 8 + convert_32_to_8( this, &image, conversion_flags ); + else if ( data->d == 8 && depth == 32 ) // 8 -> 32 + convert_8_to_32( this, &image ); +#endif + else if ( data->d == 1 && depth == 8 ) // 1 -> 8 + convert_1_to_8( this, &image ); +#ifndef TQT_NO_IMAGE_TRUECOLOR + else if ( data->d == 1 && depth == 32 ) // 1 -> 32 + convert_1_to_32( this, &image ); +#endif +#ifndef TQT_NO_IMAGE_16_BIT + else if ( data->d == 16 && depth != 16 ) { + TQImage tmp; + convert_16_to_32( this, &tmp ); + image = tmp.convertDepth( depth, conversion_flags ); + } else if ( data->d != 16 && depth == 16 ) { + TQImage tmp = convertDepth( 32, conversion_flags ); + convert_32_to_16( &tmp, &image ); + } +#endif + else { +#if defined(QT_CHECK_RANGE) + if ( isNull() ) + tqWarning( "TQImage::convertDepth: Image is a null image" ); + else + tqWarning( "TQImage::convertDepth: Depth %d not supported", depth ); +#endif + } + return image; +} + +/*! + \overload +*/ + +TQImage TQImage::convertDepth( int depth ) const +{ + return convertDepth( depth, 0 ); +} + +/*! + Returns TRUE if ( \a x, \a y ) is a valid coordinate in the image; + otherwise returns FALSE. + + \sa width() height() pixelIndex() +*/ + +bool TQImage::valid( int x, int y ) const +{ + return x >= 0 && x < width() + && y >= 0 && y < height(); +} + +/*! + Returns the pixel index at the given coordinates. + + If (\a x, \a y) is not \link valid() valid\endlink, or if the + image is not a paletted image (depth() \> 8), the results are + undefined. + + \sa valid() depth() +*/ + +int TQImage::pixelIndex( int x, int y ) const +{ +#if defined(QT_CHECK_RANGE) + if ( x < 0 || x >= width() ) { + tqWarning( "TQImage::pixel: x=%d out of range", x ); + return -12345; + } +#endif + uchar * s = scanLine( y ); + switch( depth() ) { + case 1: + if ( bitOrder() == TQImage::LittleEndian ) + return (*(s + (x >> 3)) >> (x & 7)) & 1; + else + return (*(s + (x >> 3)) >> (7- (x & 7))) & 1; + case 8: + return (int)s[x]; +#ifndef TQT_NO_IMAGE_TRUECOLOR +#ifndef TQT_NO_IMAGE_16_BIT + case 16: +#endif + case 32: +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::pixelIndex: Not applicable for %d-bpp images " + "(no palette)", depth() ); +#endif + return 0; +#endif //TQT_NO_IMAGE_TRUECOLOR + } + return 0; +} + + +/*! + Returns the color of the pixel at the coordinates (\a x, \a y). + + If (\a x, \a y) is not \link valid() on the image\endlink, the + results are undefined. + + \sa setPixel() tqRed() tqGreen() tqBlue() valid() +*/ + +TQRgb TQImage::pixel( int x, int y ) const +{ +#if defined(QT_CHECK_RANGE) + if ( x < 0 || x >= width() ) { + tqWarning( "TQImage::pixel: x=%d out of range", x ); + return 12345; + } +#endif + uchar * s = scanLine( y ); + switch( depth() ) { + case 1: + if ( bitOrder() == TQImage::LittleEndian ) + return color( (*(s + (x >> 3)) >> (x & 7)) & 1 ); + else + return color( (*(s + (x >> 3)) >> (7- (x & 7))) & 1 ); + case 8: + return color( (int)s[x] ); +#ifndef TQT_NO_IMAGE_16_BIT + case 16: + return qt_conv16ToRgb(((ushort*)s)[x]); +#endif +#ifndef TQT_NO_IMAGE_TRUECOLOR + case 32: + return ((TQRgb*)s)[x]; +#endif + default: + return 100367; + } +} + + +/*! + Sets the pixel index or color at the coordinates (\a x, \a y) to + \a index_or_rgb. + + If (\a x, \a y) is not \link valid() valid\endlink, the result is + undefined. + + If the image is a paletted image (depth() \<= 8) and \a + index_or_rgb \>= numColors(), the result is undefined. + + \sa pixelIndex() pixel() tqRgb() tqRgba() valid() +*/ + +void TQImage::setPixel( int x, int y, uint index_or_rgb ) +{ + if ( x < 0 || x >= width() ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::setPixel: x=%d out of range", x ); +#endif + return; + } + if ( depth() == 1 ) { + uchar * s = scanLine( y ); + if ( index_or_rgb > 1) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::setPixel: index=%d out of range", + index_or_rgb ); +#endif + } else if ( bitOrder() == TQImage::LittleEndian ) { + if (index_or_rgb==0) + *(s + (x >> 3)) &= ~(1 << (x & 7)); + else + *(s + (x >> 3)) |= (1 << (x & 7)); + } else { + if (index_or_rgb==0) + *(s + (x >> 3)) &= ~(1 << (7-(x & 7))); + else + *(s + (x >> 3)) |= (1 << (7-(x & 7))); + } + } else if ( depth() == 8 ) { + if (index_or_rgb > (uint)numColors()) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::setPixel: index=%d out of range", + index_or_rgb ); +#endif + return; + } + uchar * s = scanLine( y ); + s[x] = index_or_rgb; +#ifndef TQT_NO_IMAGE_16_BIT + } else if ( depth() == 16 ) { + ushort * s = (ushort*)scanLine( y ); + s[x] = qt_convRgbTo16(index_or_rgb); +#endif +#ifndef TQT_NO_IMAGE_TRUECOLOR + } else if ( depth() == 32 ) { + TQRgb * s = (TQRgb*)scanLine( y ); + s[x] = index_or_rgb; +#endif + } +} + + +/*! + Converts the bit order of the image to \a bitOrder and returns the + converted image. The original image is not changed. + + Returns \c *this if the \a bitOrder is equal to the image bit + order, or a \link isNull() null\endlink image if this image cannot + be converted. + + \sa bitOrder() systemBitOrder() isNull() +*/ + +TQImage TQImage::convertBitOrder( Endian bitOrder ) const +{ + if ( isNull() || data->d != 1 || // invalid argument(s) + !(bitOrder == BigEndian || bitOrder == LittleEndian) ) { + TQImage nullImage; + return nullImage; + } + if ( data->bitordr == bitOrder ) // nothing to do + return copy(); + + TQImage image( data->w, data->h, 1, data->ncols, bitOrder ); + + int bpl = (width() + 7) / 8; + for ( int y = 0; y < data->h; y++ ) { + uchar *p = jumpTable()[y]; + uchar *end = p + bpl; + uchar *b = image.jumpTable()[y]; + while ( p < end ) + *b++ = bitflip[*p++]; + } + memcpy( image.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); + return image; +} + +// ### Candidate (renamed) for ntqcolor.h +static +bool isGray(TQRgb c) +{ + return tqRed(c) == tqGreen(c) + && tqRed(c) == tqBlue(c); +} + +/*! + Returns TRUE if all the colors in the image are shades of gray + (i.e. their red, green and blue components are equal); otherwise + returns FALSE. + + This function is slow for large 16-bit (TQt/Embedded only) and 32-bit images. + + \sa isGrayscale() +*/ +bool TQImage::allGray() const +{ +#ifndef TQT_NO_IMAGE_TRUECOLOR + if (depth()==32) { + int p = width()*height(); + TQRgb* b = (TQRgb*)bits(); + while (p--) + if (!isGray(*b++)) + return FALSE; +#ifndef TQT_NO_IMAGE_16_BIT + } else if (depth()==16) { + int p = width()*height(); + ushort* b = (ushort*)bits(); + while (p--) + if (!is16BitGray(*b++)) + return FALSE; +#endif + } else +#endif //TQT_NO_IMAGE_TRUECOLOR + { + if (!data->ctbl) return TRUE; + for (int i=0; ictbl[i])) + return FALSE; + } + return TRUE; +} + +/*! + For 16-bit (TQt/Embedded only) and 32-bit images, this function is + equivalent to allGray(). + + For 8-bpp images, this function returns TRUE if color(i) is + TQRgb(i,i,i) for all indices of the color table; otherwise returns + FALSE. + + \sa allGray() depth() +*/ +bool TQImage::isGrayscale() const +{ + switch (depth()) { +#ifndef TQT_NO_IMAGE_TRUECOLOR + case 32: +#ifndef TQT_NO_IMAGE_16_BIT + case 16: +#endif + return allGray(); +#endif //TQT_NO_IMAGE_TRUECOLOR + case 8: { + for (int i=0; ictbl[i] != tqRgb(i,i,i)) + return FALSE; + return TRUE; + } + } + return FALSE; +} + +#ifndef TQT_NO_IMAGE_SMOOTHSCALE +static +void pnmscale(const TQImage& src, TQImage& dst) +{ + TQRgb* xelrow = 0; + TQRgb* tempxelrow = 0; + TQRgb* xP; + TQRgb* nxP; + int rows, cols, rowsread, newrows, newcols; + int row, col, needtoreadrow; + const uchar maxval = 255; + double xscale, yscale; + long sxscale, syscale; + long fracrowtofill, fracrowleft; + long* as; + long* rs; + long* gs; + long* bs; + int rowswritten = 0; + + cols = src.width(); + rows = src.height(); + newcols = dst.width(); + newrows = dst.height(); + + long SCALE; + long HALFSCALE; + + if (cols > 4096) + { + SCALE = 4096; + HALFSCALE = 2048; + } + else + { + int fac = 4096; + + while (cols * fac > 4096) + { + fac /= 2; + } + + SCALE = fac * cols; + HALFSCALE = fac * cols / 2; + } + + xscale = (double) newcols / (double) cols; + yscale = (double) newrows / (double) rows; + + sxscale = (long)(xscale * SCALE); + syscale = (long)(yscale * SCALE); + + if ( newrows != rows ) /* shortcut Y scaling if possible */ + tempxelrow = new TQRgb[cols]; + + if ( src.hasAlphaBuffer() ) { + dst.setAlphaBuffer(TRUE); + as = new long[cols]; + for ( col = 0; col < cols; ++col ) + as[col] = HALFSCALE; + } else { + as = 0; + } + rs = new long[cols]; + gs = new long[cols]; + bs = new long[cols]; + rowsread = 0; + fracrowleft = syscale; + needtoreadrow = 1; + for ( col = 0; col < cols; ++col ) + rs[col] = gs[col] = bs[col] = HALFSCALE; + fracrowtofill = SCALE; + + for ( row = 0; row < newrows; ++row ) { + /* First scale Y from xelrow into tempxelrow. */ + if ( newrows == rows ) { + /* shortcut Y scaling if possible */ + tempxelrow = xelrow = (TQRgb*)src.scanLine(rowsread++); + } else { + while ( fracrowleft < fracrowtofill ) { + if ( needtoreadrow && rowsread < rows ) + xelrow = (TQRgb*)src.scanLine(rowsread++); + for ( col = 0, xP = xelrow; col < cols; ++col, ++xP ) { + if (as) { + as[col] += fracrowleft * tqAlpha( *xP ); + rs[col] += fracrowleft * tqRed( *xP ) * tqAlpha( *xP ) / 255; + gs[col] += fracrowleft * tqGreen( *xP ) * tqAlpha( *xP ) / 255; + bs[col] += fracrowleft * tqBlue( *xP ) * tqAlpha( *xP ) / 255; + } else { + rs[col] += fracrowleft * tqRed( *xP ); + gs[col] += fracrowleft * tqGreen( *xP ); + bs[col] += fracrowleft * tqBlue( *xP ); + } + } + fracrowtofill -= fracrowleft; + fracrowleft = syscale; + needtoreadrow = 1; + } + /* Now fracrowleft is >= fracrowtofill, so we can produce a row. */ + if ( needtoreadrow && rowsread < rows ) { + xelrow = (TQRgb*)src.scanLine(rowsread++); + needtoreadrow = 0; + } + long a=0; + for ( col = 0, xP = xelrow, nxP = tempxelrow; + col < cols; ++col, ++xP, ++nxP ) + { + long r, g, b; + + if ( as ) { + r = rs[col] + fracrowtofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; + g = gs[col] + fracrowtofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; + b = bs[col] + fracrowtofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; + a = as[col] + fracrowtofill * tqAlpha( *xP ); + if ( a ) { + r = r * 255 / a * SCALE; + g = g * 255 / a * SCALE; + b = b * 255 / a * SCALE; + } + } else { + r = rs[col] + fracrowtofill * tqRed( *xP ); + g = gs[col] + fracrowtofill * tqGreen( *xP ); + b = bs[col] + fracrowtofill * tqBlue( *xP ); + } + r /= SCALE; + if ( r > maxval ) r = maxval; + g /= SCALE; + if ( g > maxval ) g = maxval; + b /= SCALE; + if ( b > maxval ) b = maxval; + if ( as ) { + a /= SCALE; + if ( a > maxval ) a = maxval; + *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); + as[col] = HALFSCALE; + } else { + *nxP = tqRgb( (int)r, (int)g, (int)b ); + } + rs[col] = gs[col] = bs[col] = HALFSCALE; + } + fracrowleft -= fracrowtofill; + if ( fracrowleft == 0 ) { + fracrowleft = syscale; + needtoreadrow = 1; + } + fracrowtofill = SCALE; + } + + /* Now scale X from tempxelrow into dst and write it out. */ + if ( newcols == cols ) { + /* shortcut X scaling if possible */ + memcpy(dst.scanLine(rowswritten++), tempxelrow, newcols*4); + } else { + long a, r, g, b; + long fraccoltofill, fraccolleft = 0; + int needcol; + + nxP = (TQRgb*)dst.scanLine(rowswritten++); + fraccoltofill = SCALE; + a = r = g = b = HALFSCALE; + needcol = 0; + for ( col = 0, xP = tempxelrow; col < cols; ++col, ++xP ) { + fraccolleft = sxscale; + while ( fraccolleft >= fraccoltofill ) { + if ( needcol ) { + ++nxP; + a = r = g = b = HALFSCALE; + } + if ( as ) { + r += fraccoltofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; + g += fraccoltofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; + b += fraccoltofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; + a += fraccoltofill * tqAlpha( *xP ); + if ( a ) { + r = r * 255 / a * SCALE; + g = g * 255 / a * SCALE; + b = b * 255 / a * SCALE; + } + } else { + r += fraccoltofill * tqRed( *xP ); + g += fraccoltofill * tqGreen( *xP ); + b += fraccoltofill * tqBlue( *xP ); + } + r /= SCALE; + if ( r > maxval ) r = maxval; + g /= SCALE; + if ( g > maxval ) g = maxval; + b /= SCALE; + if ( b > maxval ) b = maxval; + if (as) { + a /= SCALE; + if ( a > maxval ) a = maxval; + *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); + } else { + *nxP = tqRgb( (int)r, (int)g, (int)b ); + } + fraccolleft -= fraccoltofill; + fraccoltofill = SCALE; + needcol = 1; + } + if ( fraccolleft > 0 ) { + if ( needcol ) { + ++nxP; + a = r = g = b = HALFSCALE; + needcol = 0; + } + if (as) { + a += fraccolleft * tqAlpha( *xP ); + r += fraccolleft * tqRed( *xP ) * tqAlpha( *xP ) / 255; + g += fraccolleft * tqGreen( *xP ) * tqAlpha( *xP ) / 255; + b += fraccolleft * tqBlue( *xP ) * tqAlpha( *xP ) / 255; + } else { + r += fraccolleft * tqRed( *xP ); + g += fraccolleft * tqGreen( *xP ); + b += fraccolleft * tqBlue( *xP ); + } + fraccoltofill -= fraccolleft; + } + } + if ( fraccoltofill > 0 ) { + --xP; + if (as) { + a += fraccolleft * tqAlpha( *xP ); + r += fraccoltofill * tqRed( *xP ) * tqAlpha( *xP ) / 255; + g += fraccoltofill * tqGreen( *xP ) * tqAlpha( *xP ) / 255; + b += fraccoltofill * tqBlue( *xP ) * tqAlpha( *xP ) / 255; + if ( a ) { + r = r * 255 / a * SCALE; + g = g * 255 / a * SCALE; + b = b * 255 / a * SCALE; + } + } else { + r += fraccoltofill * tqRed( *xP ); + g += fraccoltofill * tqGreen( *xP ); + b += fraccoltofill * tqBlue( *xP ); + } + } + if ( ! needcol ) { + r /= SCALE; + if ( r > maxval ) r = maxval; + g /= SCALE; + if ( g > maxval ) g = maxval; + b /= SCALE; + if ( b > maxval ) b = maxval; + if (as) { + a /= SCALE; + if ( a > maxval ) a = maxval; + *nxP = tqRgba( (int)r, (int)g, (int)b, (int)a ); + } else { + *nxP = tqRgb( (int)r, (int)g, (int)b ); + } + } + } + } + + if ( newrows != rows && tempxelrow )// Robust, tempxelrow might be 0 1 day + delete [] tempxelrow; + if ( as ) // Avoid purify complaint + delete [] as; + if ( rs ) // Robust, rs might be 0 one day + delete [] rs; + if ( gs ) // Robust, gs might be 0 one day + delete [] gs; + if ( bs ) // Robust, bs might be 0 one day + delete [] bs; +} +#endif + +/*! + \enum TQImage::ScaleMode + + The functions scale() and smoothScale() use different modes for + scaling the image. The purpose of these modes is to retain the + ratio of the image if this is required. + + \img scaling.png + + \value ScaleFree The image is scaled freely: the resulting image + fits exactly into the specified size; the ratio will not + necessarily be preserved. + \value ScaleMin The ratio of the image is preserved and the + resulting image is guaranteed to fit into the specified size + (it is as large as possible within these constraints) - the + image might be smaller than the requested size. + \value ScaleMax The ratio of the image is preserved and the + resulting image fills the whole specified rectangle (it is as + small as possible within these constraints) - the image might + be larger than the requested size. +*/ + +#ifndef TQT_NO_IMAGE_SMOOTHSCALE +/*! + Returns a smoothly scaled copy of the image. The returned image + has a size of width \a w by height \a h pixels if \a mode is \c + ScaleFree. The modes \c ScaleMin and \c ScaleMax may be used to + preserve the ratio of the image: if \a mode is \c ScaleMin, the + returned image is guaranteed to fit into the rectangle specified + by \a w and \a h (it is as large as possible within the + constraints); if \a mode is \c ScaleMax, the returned image fits + at least into the specified rectangle (it is a small as possible + within the constraints). + + For 32-bpp images and 1-bpp/8-bpp color images the result will be + 32-bpp, whereas \link allGray() all-gray \endlink images + (including black-and-white 1-bpp) will produce 8-bit \link + isGrayscale() grayscale \endlink images with the palette spanning + 256 grays from black to white. + + This function uses code based on pnmscale.c by Jef Poskanzer. + + pnmscale.c - read a portable anymap and scale it + + \legalese + + Copyright (C) 1989, 1991 by Jef Poskanzer. + + Permission to use, copy, modify, and distribute this software and + its documentation for any purpose and without fee is hereby + granted, provided that the above copyright notice appear in all + copies and that both that copyright notice and this permission + notice appear in supporting documentation. This software is + provided "as is" without express or implied warranty. + + \sa scale() mirror() +*/ +TQImage TQImage::smoothScale( int w, int h, ScaleMode mode ) const +{ + return smoothScale( TQSize( w, h ), mode ); +} +#endif + +#ifndef TQT_NO_IMAGE_SMOOTHSCALE +/*! + \overload + + The requested size of the image is \a s. +*/ +TQImage TQImage::smoothScale( const TQSize& s, ScaleMode mode ) const +{ + if ( isNull() ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::smoothScale: Image is a null image" ); +#endif + return copy(); + } + + TQSize newSize = size(); + newSize.scale( s, (TQSize::ScaleMode)mode ); // ### remove cast in TQt 4.0 + if ( newSize == size() ) + return copy(); + + if ( depth() == 32 ) { + TQImage img( newSize, 32 ); + // 32-bpp to 32-bpp + pnmscale( *this, img ); + return img; + } else if ( depth() != 16 && allGray() && !hasAlphaBuffer() ) { + // Inefficient + return convertDepth(32).smoothScale(newSize, mode).convertDepth(8); + } else { + // Inefficient + return convertDepth(32).smoothScale(newSize, mode); + } +} +#endif + +/*! + Returns a copy of the image scaled to a rectangle of width \a w + and height \a h according to the ScaleMode \a mode. + + \list + \i If \a mode is \c ScaleFree, the image is scaled to (\a w, + \a h). + \i If \a mode is \c ScaleMin, the image is scaled to a rectangle + as large as possible inside (\a w, \a h), preserving the aspect + ratio. + \i If \a mode is \c ScaleMax, the image is scaled to a rectangle + as small as possible outside (\a w, \a h), preserving the aspect + ratio. + \endlist + + If either the width \a w or the height \a h is 0 or negative, this + function returns a \link isNull() null\endlink image. + + This function uses a simple, fast algorithm. If you need better + quality, use smoothScale() instead. + + \sa scaleWidth() scaleHeight() smoothScale() xForm() +*/ +#ifndef TQT_NO_IMAGE_TRANSFORMATION +TQImage TQImage::scale( int w, int h, ScaleMode mode ) const +{ + return scale( TQSize( w, h ), mode ); +} +#endif + +/*! + \overload + + The requested size of the image is \a s. +*/ +#ifndef TQT_NO_IMAGE_TRANSFORMATION +TQImage TQImage::scale( const TQSize& s, ScaleMode mode ) const +{ + if ( isNull() ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::scale: Image is a null image" ); +#endif + return copy(); + } + if ( s.isEmpty() ) + return TQImage(); + + TQSize newSize = size(); + newSize.scale( s, (TQSize::ScaleMode)mode ); // ### remove cast in TQt 4.0 + if ( newSize == size() ) + return copy(); + + TQImage img; + TQWMatrix wm; + wm.scale( (double)newSize.width() / width(), (double)newSize.height() / height() ); + img = xForm( wm ); + // ### I should test and resize the image if it has not the right size +// if ( img.width() != newSize.width() || img.height() != newSize.height() ) +// img.resize( newSize.width(), newSize.height() ); + return img; +} +#endif + +/*! + Returns a scaled copy of the image. The returned image has a width + of \a w pixels. This function automatically calculates the height + of the image so that the ratio of the image is preserved. + + If \a w is 0 or negative a \link isNull() null\endlink image is + returned. + + \sa scale() scaleHeight() smoothScale() xForm() +*/ +#ifndef TQT_NO_IMAGE_TRANSFORMATION +TQImage TQImage::scaleWidth( int w ) const +{ + if ( isNull() ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::scaleWidth: Image is a null image" ); +#endif + return copy(); + } + if ( w <= 0 ) + return TQImage(); + + TQWMatrix wm; + double factor = (double) w / width(); + wm.scale( factor, factor ); + return xForm( wm ); +} +#endif + +/*! + Returns a scaled copy of the image. The returned image has a + height of \a h pixels. This function automatically calculates the + width of the image so that the ratio of the image is preserved. + + If \a h is 0 or negative a \link isNull() null\endlink image is + returned. + + \sa scale() scaleWidth() smoothScale() xForm() +*/ +#ifndef TQT_NO_IMAGE_TRANSFORMATION +TQImage TQImage::scaleHeight( int h ) const +{ + if ( isNull() ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage::scaleHeight: Image is a null image" ); +#endif + return copy(); + } + if ( h <= 0 ) + return TQImage(); + + TQWMatrix wm; + double factor = (double) h / height(); + wm.scale( factor, factor ); + return xForm( wm ); +} +#endif + + +/*! + Returns a copy of the image that is transformed using the + transformation matrix, \a matrix. + + The transformation \a matrix is internally adjusted to compensate + for unwanted translation, i.e. xForm() returns the smallest image + that contains all the transformed points of the original image. + + \sa scale() TQPixmap::xForm() TQPixmap::trueMatrix() TQWMatrix +*/ +#ifndef TQT_NO_IMAGE_TRANSFORMATION +TQImage TQImage::xForm( const TQWMatrix &matrix ) const +{ + // This function uses the same algorithm as (and steals quite some + // code from) TQPixmap::xForm(). + + if ( isNull() ) + return copy(); + + if ( depth() == 16 ) { + // inefficient + return convertDepth( 32 ).xForm( matrix ); + } + + // source image data + int ws = width(); + int hs = height(); + int sbpl = bytesPerLine(); + uchar *sptr = bits(); + + // target image data + int wd; + int hd; + + int bpp = depth(); + + // compute size of target image + TQWMatrix mat = TQPixmap::trueMatrix( matrix, ws, hs ); + if ( mat.m12() == 0.0F && mat.m21() == 0.0F ) { + if ( mat.m11() == 1.0F && mat.m22() == 1.0F ) // identity matrix + return copy(); + hd = tqRound( mat.m22() * hs ); + wd = tqRound( mat.m11() * ws ); + hd = TQABS( hd ); + wd = TQABS( wd ); + } else { // rotation or shearing + TQPointArray a( TQRect(0, 0, ws, hs) ); + a = mat.map( a ); + TQRect r = a.boundingRect().normalize(); + wd = r.width(); + hd = r.height(); + } + + bool invertible; + mat = mat.invert( &invertible ); // invert matrix + if ( hd == 0 || wd == 0 || !invertible ) // error, return null image + return TQImage(); + + // create target image (some of the code is from TQImage::copy()) + TQImage dImage( wd, hd, depth(), numColors(), bitOrder() ); + + // If the image allocation failed, we need to gracefully abort. + if (dImage.isNull()) + return dImage; + + memcpy( dImage.colorTable(), colorTable(), numColors()*sizeof(TQRgb) ); + dImage.setAlphaBuffer( hasAlphaBuffer() ); + dImage.data->dpmx = dotsPerMeterX(); + dImage.data->dpmy = dotsPerMeterY(); + + switch ( bpp ) { + // initizialize the data + case 1: + memset( dImage.bits(), 0, dImage.numBytes() ); + break; + case 8: + if ( dImage.data->ncols < 256 ) { + // colors are left in the color table, so pick that one as transparent + dImage.setNumColors( dImage.data->ncols+1 ); + dImage.setColor( dImage.data->ncols-1, 0x00 ); + memset( dImage.bits(), dImage.data->ncols-1, dImage.numBytes() ); + } else { + memset( dImage.bits(), 0, dImage.numBytes() ); + } + break; + case 16: + memset( dImage.bits(), 0xff, dImage.numBytes() ); + break; + case 32: + memset( dImage.bits(), 0x00, dImage.numBytes() ); + break; + } + + int type; + if ( bitOrder() == BigEndian ) + type = QT_XFORM_TYPE_MSBFIRST; + else + type = QT_XFORM_TYPE_LSBFIRST; + int dbpl = dImage.bytesPerLine(); + qt_xForm_helper( mat, 0, type, bpp, dImage.bits(), dbpl, 0, hd, sptr, sbpl, + ws, hs ); + return dImage; +} +#endif + +/*! + Builds and returns a 1-bpp mask from the alpha buffer in this + image. Returns a \link isNull() null\endlink image if \link + setAlphaBuffer() alpha buffer mode\endlink is disabled. + + See TQPixmap::convertFromImage() for a description of the \a + conversion_flags argument. + + The returned image has little-endian bit order, which you can + convert to big-endianness using convertBitOrder(). + + \sa createHeuristicMask() hasAlphaBuffer() setAlphaBuffer() +*/ +#ifndef TQT_NO_IMAGE_DITHER_TO_1 +TQImage TQImage::createAlphaMask( int conversion_flags ) const +{ + if ( conversion_flags == 1 ) { + // Old code is passing "TRUE". + conversion_flags = TQt::DiffuseAlphaDither; + } + + if ( isNull() || !hasAlphaBuffer() ) + return TQImage(); + + if ( depth() == 1 ) { + // A monochrome pixmap, with alpha channels on those two colors. + // Pretty unlikely, so use less efficient solution. + return convertDepth(8, conversion_flags) + .createAlphaMask( conversion_flags ); + } + + TQImage mask1; + dither_to_1( this, &mask1, conversion_flags, TRUE ); + return mask1; +} +#endif + +#ifndef TQT_NO_IMAGE_HEURISTIC_MASK +/*! + Creates and returns a 1-bpp heuristic mask for this image. It + works by selecting a color from one of the corners, then chipping + away pixels of that color starting at all the edges. + + The four corners vote for which color is to be masked away. In + case of a draw (this generally means that this function is not + applicable to the image), the result is arbitrary. + + The returned image has little-endian bit order, which you can + convert to big-endianness using convertBitOrder(). + + If \a clipTight is TRUE the mask is just large enough to cover the + pixels; otherwise, the mask is larger than the data pixels. + + This function disregards the \link hasAlphaBuffer() alpha buffer + \endlink. + + \sa createAlphaMask() +*/ + +TQImage TQImage::createHeuristicMask( bool clipTight ) const +{ + if ( isNull() ) { + TQImage nullImage; + return nullImage; + } + if ( depth() != 32 ) { + TQImage img32 = convertDepth(32); + return img32.createHeuristicMask(clipTight); + } + +#define PIX(x,y) (*((TQRgb*)scanLine(y)+x) & 0x00ffffff) + + int w = width(); + int h = height(); + TQImage m(w, h, 1, 2, TQImage::LittleEndian); + m.setColor( 0, 0xffffff ); + m.setColor( 1, 0 ); + m.fill( 0xff ); + + TQRgb background = PIX(0,0); + if ( background != PIX(w-1,0) && + background != PIX(0,h-1) && + background != PIX(w-1,h-1) ) { + background = PIX(w-1,0); + if ( background != PIX(w-1,h-1) && + background != PIX(0,h-1) && + PIX(0,h-1) == PIX(w-1,h-1) ) { + background = PIX(w-1,h-1); + } + } + + int x,y; + bool done = FALSE; + uchar *ypp, *ypc, *ypn; + while( !done ) { + done = TRUE; + ypn = m.scanLine(0); + ypc = 0; + for ( y = 0; y < h; y++ ) { + ypp = ypc; + ypc = ypn; + ypn = (y == h-1) ? 0 : m.scanLine(y+1); + TQRgb *p = (TQRgb *)scanLine(y); + for ( x = 0; x < w; x++ ) { + // slowness here - it's possible to do six of these tests + // together in one go. oh well. + if ( ( x == 0 || y == 0 || x == w-1 || y == h-1 || + !(*(ypc + ((x-1) >> 3)) & (1 << ((x-1) & 7))) || + !(*(ypc + ((x+1) >> 3)) & (1 << ((x+1) & 7))) || + !(*(ypp + (x >> 3)) & (1 << (x & 7))) || + !(*(ypn + (x >> 3)) & (1 << (x & 7))) ) && + ( (*(ypc + (x >> 3)) & (1 << (x & 7))) ) && + ( (*p & 0x00ffffff) == background ) ) { + done = FALSE; + *(ypc + (x >> 3)) &= ~(1 << (x & 7)); + } + p++; + } + } + } + + if ( !clipTight ) { + ypn = m.scanLine(0); + ypc = 0; + for ( y = 0; y < h; y++ ) { + ypp = ypc; + ypc = ypn; + ypn = (y == h-1) ? 0 : m.scanLine(y+1); + TQRgb *p = (TQRgb *)scanLine(y); + for ( x = 0; x < w; x++ ) { + if ( (*p & 0x00ffffff) != background ) { + if ( x > 0 ) + *(ypc + ((x-1) >> 3)) |= (1 << ((x-1) & 7)); + if ( x < w-1 ) + *(ypc + ((x+1) >> 3)) |= (1 << ((x+1) & 7)); + if ( y > 0 ) + *(ypp + (x >> 3)) |= (1 << (x & 7)); + if ( y < h-1 ) + *(ypn + (x >> 3)) |= (1 << (x & 7)); + } + p++; + } + } + } + +#undef PIX + + return m; +} +#endif //TQT_NO_IMAGE_HEURISTIC_MASK + +#ifndef TQT_NO_IMAGE_MIRROR +/* + This code is contributed by Philipp Lang, + GeneriCom Software Germany (www.generi.com) + under the terms of the TQPL, Version 1.0 +*/ + +/*! + \overload + + Returns a mirror of the image, mirrored in the horizontal and/or + the vertical direction depending on whether \a horizontal and \a + vertical are set to TRUE or FALSE. The original image is not + changed. + + \sa smoothScale() +*/ +TQImage TQImage::mirror(bool horizontal, bool vertical) const +{ + int w = width(); + int h = height(); + if ( (w <= 1 && h <= 1) || (!horizontal && !vertical) ) + return copy(); + + // Create result image, copy colormap + TQImage result(w, h, depth(), numColors(), bitOrder()); + memcpy(result.colorTable(), colorTable(), numColors()*sizeof(TQRgb)); + result.setAlphaBuffer(hasAlphaBuffer()); + + if (depth() == 1) + w = (w+7)/8; + int dxi = horizontal ? -1 : 1; + int dxs = horizontal ? w-1 : 0; + int dyi = vertical ? -1 : 1; + int dy = vertical ? h-1: 0; + + // 1 bit, 8 bit + if (depth() == 1 || depth() == 8) { + for (int sy = 0; sy < h; sy++, dy += dyi) { + TQ_UINT8* ssl = (TQ_UINT8*)(data->bits[sy]); + TQ_UINT8* dsl = (TQ_UINT8*)(result.data->bits[dy]); + int dx = dxs; + for (int sx = 0; sx < w; sx++, dx += dxi) + dsl[dx] = ssl[sx]; + } + } +#ifndef TQT_NO_IMAGE_TRUECOLOR +#ifndef TQT_NO_IMAGE_16_BIT + // 16 bit + else if (depth() == 16) { + for (int sy = 0; sy < h; sy++, dy += dyi) { + TQ_UINT16* ssl = (TQ_UINT16*)(data->bits[sy]); + TQ_UINT16* dsl = (TQ_UINT16*)(result.data->bits[dy]); + int dx = dxs; + for (int sx = 0; sx < w; sx++, dx += dxi) + dsl[dx] = ssl[sx]; + } + } +#endif + // 32 bit + else if (depth() == 32) { + for (int sy = 0; sy < h; sy++, dy += dyi) { + TQ_UINT32* ssl = (TQ_UINT32*)(data->bits[sy]); + TQ_UINT32* dsl = (TQ_UINT32*)(result.data->bits[dy]); + int dx = dxs; + for (int sx = 0; sx < w; sx++, dx += dxi) + dsl[dx] = ssl[sx]; + } + } +#endif + + // special handling of 1 bit images for horizontal mirroring + if (horizontal && depth() == 1) { + int shift = width() % 8; + for (int y = h-1; y >= 0; y--) { + TQ_UINT8* a0 = (TQ_UINT8*)(result.data->bits[y]); + // Swap bytes + TQ_UINT8* a = a0+dxs; + while (a >= a0) { + *a = bitflip[*a]; + a--; + } + // Shift bits if unaligned + if (shift != 0) { + a = a0+dxs; + TQ_UINT8 c = 0; + if (bitOrder() == TQImage::LittleEndian) { + while (a >= a0) { + TQ_UINT8 nc = *a << shift; + *a = (*a >> (8-shift)) | c; + --a; + c = nc; + } + } else { + while (a >= a0) { + TQ_UINT8 nc = *a >> shift; + *a = (*a << (8-shift)) | c; + --a; + c = nc; + } + } + } + } + } + + return result; +} + +/*! + Returns a TQImage which is a vertically mirrored copy of this + image. The original TQImage is not changed. +*/ + +TQImage TQImage::mirror() const +{ + return mirror(FALSE,TRUE); +} +#endif //TQT_NO_IMAGE_MIRROR + +/*! + Returns a TQImage in which the values of the red and blue + components of all pixels have been swapped, effectively converting + an RGB image to a BGR image. The original TQImage is not changed. +*/ + +TQImage TQImage::swapRGB() const +{ + TQImage res = copy(); + if ( !isNull() ) { +#ifndef TQT_NO_IMAGE_TRUECOLOR + if ( depth() == 32 ) { + for ( int i=0; i < height(); i++ ) { + uint *p = (uint*)scanLine( i ); + uint *q = (uint*)res.scanLine( i ); + uint *end = p + width(); + while ( p < end ) { + *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | + (*p & 0xff00ff00); + p++; + q++; + } + } +#ifndef TQT_NO_IMAGE_16_BIT + } else if ( depth() == 16 ) { + tqWarning( "TQImage::swapRGB not implemented for 16bpp" ); +#endif + } else +#endif //TQT_NO_IMAGE_TRUECOLOR + { + uint* p = (uint*)colorTable(); + uint* q = (uint*)res.colorTable(); + if ( p && q ) { + for ( int i=0; i < numColors(); i++ ) { + *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | + (*p & 0xff00ff00); + p++; + q++; + } + } + } + } + return res; +} + +#ifndef TQT_NO_IMAGEIO +/*! + Returns a string that specifies the image format of the file \a + fileName, or 0 if the file cannot be read or if the format is not + recognized. + + The TQImageIO documentation lists the guaranteed supported image + formats, or use TQImage::inputFormats() and TQImage::outputFormats() + to get lists that include the installed formats. + + \sa load() save() +*/ + +const char* TQImage::imageFormat( const TQString &fileName ) +{ + return TQImageIO::imageFormat( fileName ); +} + +/*! + Returns a list of image formats that are supported for image + input. + + \sa outputFormats() inputFormatList() TQImageIO +*/ +TQStrList TQImage::inputFormats() +{ + return TQImageIO::inputFormats(); +} +#ifndef TQT_NO_STRINGLIST +/*! + Returns a list of image formats that are supported for image + input. + + Note that if you want to iterate over the list, you should iterate + over a copy, e.g. + \code + TQStringList list = myImage.inputFormatList(); + TQStringList::Iterator it = list.begin(); + while( it != list.end() ) { + myProcessing( *it ); + ++it; + } + \endcode + + \sa outputFormatList() inputFormats() TQImageIO +*/ +TQStringList TQImage::inputFormatList() +{ + return TQStringList::fromStrList(TQImageIO::inputFormats()); +} + + +/*! + Returns a list of image formats that are supported for image + output. + + Note that if you want to iterate over the list, you should iterate + over a copy, e.g. + \code + TQStringList list = myImage.outputFormatList(); + TQStringList::Iterator it = list.begin(); + while( it != list.end() ) { + myProcessing( *it ); + ++it; + } + \endcode + + \sa inputFormatList() outputFormats() TQImageIO +*/ +TQStringList TQImage::outputFormatList() +{ + return TQStringList::fromStrList(TQImageIO::outputFormats()); +} +#endif //TQT_NO_STRINGLIST + +/*! + Returns a list of image formats that are supported for image + output. + + \sa inputFormats() outputFormatList() TQImageIO +*/ +TQStrList TQImage::outputFormats() +{ + return TQImageIO::outputFormats(); +} + + +/*! + Loads an image from the file \a fileName. Returns TRUE if the + image was successfully loaded; otherwise returns FALSE. + + If \a format is specified, the loader attempts to read the image + using the specified format. If \a format is not specified (which + is the default), the loader reads a few bytes from the header to + guess the file format. + + The TQImageIO documentation lists the supported image formats and + explains how to add extra formats. + + \sa loadFromData() save() imageFormat() TQPixmap::load() TQImageIO +*/ + +bool TQImage::load( const TQString &fileName, const char* format ) +{ + TQImageIO io( fileName, format ); + bool result = io.read(); + if ( result ) + operator=( io.image() ); + return result; +} + +/*! + Loads an image from the first \a len bytes of binary data in \a + buf. Returns TRUE if the image was successfully loaded; otherwise + returns FALSE. + + If \a format is specified, the loader attempts to read the image + using the specified format. If \a format is not specified (which + is the default), the loader reads a few bytes from the header to + guess the file format. + + The TQImageIO documentation lists the supported image formats and + explains how to add extra formats. + + \sa load() save() imageFormat() TQPixmap::loadFromData() TQImageIO +*/ + +bool TQImage::loadFromData( const uchar *buf, uint len, const char *format ) +{ + TQByteArray a; + a.setRawData( (char *)buf, len ); + TQBuffer b( a ); + b.open( IO_ReadOnly ); + TQImageIO io( &b, format ); + bool result = io.read(); + b.close(); + a.resetRawData( (char *)buf, len ); + if ( result ) + operator=( io.image() ); + return result; +} + +/*! + \overload + + Loads an image from the TQByteArray \a buf. +*/ +bool TQImage::loadFromData( TQByteArray buf, const char *format ) +{ + return loadFromData( (const uchar *)(buf.data()), buf.size(), format ); +} + +/*! + Saves the image to the file \a fileName, using the image file + format \a format and a quality factor of \a quality. \a quality + must be in the range 0..100 or -1. Specify 0 to obtain small + compressed files, 100 for large uncompressed files, and -1 (the + default) to use the default settings. + + Returns TRUE if the image was successfully saved; otherwise + returns FALSE. + + \sa load() loadFromData() imageFormat() TQPixmap::save() TQImageIO +*/ + +bool TQImage::save( const TQString &fileName, const char* format, int quality ) const +{ + if ( isNull() ) + return FALSE; // nothing to save + TQImageIO io( fileName, format ); + return doImageIO( &io, quality ); +} + +/*! + \overload + + This function writes a TQImage to the TQIODevice, \a device. This + can be used, for example, to save an image directly into a + TQByteArray: + \code + TQImage image; + TQByteArray ba; + TQBuffer buffer( ba ); + buffer.open( IO_WriteOnly ); + image.save( &buffer, "PNG" ); // writes image into ba in PNG format + \endcode +*/ + +bool TQImage::save( TQIODevice* device, const char* format, int quality ) const +{ + if ( isNull() ) + return FALSE; // nothing to save + TQImageIO io( device, format ); + return doImageIO( &io, quality ); +} + +/* \internal +*/ + +bool TQImage::doImageIO( TQImageIO* io, int quality ) const +{ + if ( !io ) + return FALSE; + io->setImage( *this ); +#if defined(QT_CHECK_RANGE) + if ( quality > 100 || quality < -1 ) + tqWarning( "TQPixmap::save: quality out of range [-1,100]" ); +#endif + if ( quality >= 0 ) + io->setQuality( TQMIN(quality,100) ); + return io->write(); +} +#endif //TQT_NO_IMAGEIO + +/***************************************************************************** + TQImage stream functions + *****************************************************************************/ +#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO) +/*! + \relates TQImage + + Writes the image \a image to the stream \a s as a PNG image, or as a + BMP image if the stream's version is 1. + + Note that writing the stream to a file will not produce a valid image file. + + \sa TQImage::save() + \link datastreamformat.html Format of the TQDataStream operators \endlink +*/ + +TQDataStream &operator<<( TQDataStream &s, const TQImage &image ) +{ + if ( s.version() >= 5 ) { + if ( image.isNull() ) { + s << (TQ_INT32) 0; // null image marker + return s; + } else { + s << (TQ_INT32) 1; + // continue ... + } + } + TQImageIO io; + io.setIODevice( s.device() ); + if ( s.version() == 1 ) + io.setFormat( "BMP" ); + else + io.setFormat( "PNG" ); + + io.setImage( image ); + io.write(); + return s; +} + +/*! + \relates TQImage + + Reads an image from the stream \a s and stores it in \a image. + + \sa TQImage::load() + \link datastreamformat.html Format of the TQDataStream operators \endlink +*/ + +TQDataStream &operator>>( TQDataStream &s, TQImage &image ) +{ + if ( s.version() >= 5 ) { + TQ_INT32 nullMarker; + s >> nullMarker; + if ( !nullMarker ) { + image = TQImage(); // null image + return s; + } + } + TQImageIO io( s.device(), 0 ); + if ( io.read() ) + image = io.image(); + return s; +} +#endif + +/***************************************************************************** + Standard image io handlers (defined below) + *****************************************************************************/ + +// standard image io handlers (defined below) +#ifndef TQT_NO_IMAGEIO_BMP +static void read_bmp_image( TQImageIO * ); +static void write_bmp_image( TQImageIO * ); +#endif +#ifndef TQT_NO_IMAGEIO_PPM +static void read_pbm_image( TQImageIO * ); +static void write_pbm_image( TQImageIO * ); +#endif +#ifndef TQT_NO_IMAGEIO_XBM +static void read_xbm_image( TQImageIO * ); +static void write_xbm_image( TQImageIO * ); +#endif +#ifndef TQT_NO_IMAGEIO_XPM +static void read_xpm_image( TQImageIO * ); +static void write_xpm_image( TQImageIO * ); +#endif + +#ifndef TQT_NO_ASYNC_IMAGE_IO +static void read_async_image( TQImageIO * ); // Not in table of handlers +#endif + +/***************************************************************************** + Misc. utility functions + *****************************************************************************/ +#if !defined(TQT_NO_IMAGEIO_XPM) || !defined(TQT_NO_IMAGEIO_XBM) +static TQString fbname( const TQString &fileName ) // get file basename (sort of) +{ + TQString s = fileName; + if ( !s.isEmpty() ) { + int i; + if ( (i = s.findRev('/')) >= 0 ) + s = s.mid( i ); + if ( (i = s.findRev('\\')) >= 0 ) + s = s.mid( i ); + TQRegExp r( TQString::fromLatin1("[a-zA-Z][a-zA-Z0-9_]*") ); + int p = r.search( s ); + if ( p == -1 ) + s.truncate( 0 ); + else + s = s.mid( p, r.matchedLength() ); + } + if ( s.isEmpty() ) + s = TQString::fromLatin1( "dummy" ); + return s; +} +#endif + +#ifndef TQT_NO_IMAGEIO_BMP +static void swapPixel01( TQImage *image ) // 1-bpp: swap 0 and 1 pixels +{ + int i; + if ( image->depth() == 1 && image->numColors() == 2 ) { + uint *p = (uint *)image->bits(); + int nbytes = image->numBytes(); + for ( i=0; icolor(0); // swap color 0 and 1 + image->setColor( 0, image->color(1) ); + image->setColor( 1, t ); + } +} +#endif + + +/***************************************************************************** + TQImageIO member functions + *****************************************************************************/ + +/*! + \class TQImageIO tqimage.h + + \brief The TQImageIO class contains parameters for loading and + saving images. + + \ingroup images + \ingroup graphics + \ingroup io + + TQImageIO contains a TQIODevice object that is used for image data + I/O. The programmer can install new image file formats in addition + to those that TQt provides. + + TQt currently supports the following image file formats: PNG, BMP, + XBM, XPM and PNM. It may also support JPEG, MNG and GIF, if + specially configured during compilation. The different PNM formats + are: PBM (P1 or P4), PGM (P2 or P5), and PPM (P3 or P6). + + You don't normally need to use this class; TQPixmap::load(), + TQPixmap::save(), and TQImage contain sufficient functionality. + + For image files that contain sequences of images, only the first + is read. See TQMovie for loading multiple images. + + PBM, PGM, and PPM format \e output is always in the more condensed + raw format. PPM and PGM files with more than 256 levels of + intensity are scaled down when reading. + + \warning If you are in a country which recognizes software patents + and in which Unisys holds a patent on LZW compression and/or + decompression and you want to use GIF, Unisys may require you to + license the technology. Such countries include Canada, Japan, the + USA, France, Germany, Italy and the UK. + + GIF support may be removed completely in a future version of TQt. + We recommend using the PNG format. + + \sa TQImage TQPixmap TQFile TQMovie +*/ + +#ifndef TQT_NO_IMAGEIO +struct TQImageIOData +{ + const char *parameters; + int quality; + float gamma; +}; + +/*! + Constructs a TQImageIO object with all parameters set to zero. +*/ + +TQImageIO::TQImageIO() +{ + init(); +} + +/*! + Constructs a TQImageIO object with the I/O device \a ioDevice and a + \a format tag. +*/ + +TQImageIO::TQImageIO( TQIODevice *ioDevice, const char *format ) + : frmt(format) +{ + init(); + iodev = ioDevice; +} + +/*! + Constructs a TQImageIO object with the file name \a fileName and a + \a format tag. +*/ + +TQImageIO::TQImageIO( const TQString &fileName, const char* format ) + : frmt(format), fname(fileName) +{ + init(); +} + +/*! + Contains initialization common to all TQImageIO constructors. +*/ + +void TQImageIO::init() +{ + d = new TQImageIOData(); + d->parameters = 0; + d->quality = -1; // default quality of the current format + d->gamma=0.0f; + iostat = 0; + iodev = 0; +} + +/*! + Destroys the object and all related data. +*/ + +TQImageIO::~TQImageIO() +{ + if ( d->parameters ) + delete [] (char*)d->parameters; + delete d; +} + + +/***************************************************************************** + TQImageIO image handler functions + *****************************************************************************/ + +class TQImageHandler +{ +public: + TQImageHandler( const char *f, const char *h, const TQCString& fl, + image_io_handler r, image_io_handler w ); + TQCString format; // image format + TQRegExp header; // image header pattern + enum TMode { Untranslated=0, TranslateIn, TranslateInOut } text_mode; + image_io_handler read_image; // image read function + image_io_handler write_image; // image write function + bool obsolete; // support not "published" +}; + +TQImageHandler::TQImageHandler( const char *f, const char *h, const TQCString& fl, + image_io_handler r, image_io_handler w ) + : format(f), header(TQString::fromLatin1(h)) +{ + text_mode = Untranslated; + if ( fl.contains('t') ) + text_mode = TranslateIn; + else if ( fl.contains('T') ) + text_mode = TranslateInOut; + obsolete = fl.contains('O'); + read_image = r; + write_image = w; +} + +typedef TQPtrList TQIHList;// list of image handlers +static TQIHList *imageHandlers = 0; +#ifndef TQT_NO_COMPONENT +static TQPluginManager *plugin_manager = 0; +#else +static void *plugin_manager = 0; +#endif + +void tqt_init_image_plugins() +{ +#ifndef TQT_NO_COMPONENT + if ( plugin_manager ) + return; + + plugin_manager = new TQPluginManager( IID_QImageFormat, TQApplication::libraryPaths(), "/imageformats" ); + + TQStringList features = plugin_manager->featureList(); + TQStringList::Iterator it = features.begin(); + while ( it != features.end() ) { + TQString str = *it; + ++it; + TQInterfacePtr iface; + plugin_manager->queryInterface( str, &iface ); + if ( iface ) + iface->installIOHandler( str ); + } +#endif +} + +static void cleanup() +{ + // make sure that image handlers are delete before plugin manager + delete imageHandlers; + imageHandlers = 0; +#ifndef TQT_NO_COMPONENT + delete plugin_manager; + plugin_manager = 0; +#endif +} + +void tqt_init_image_handlers() // initialize image handlers +{ + if ( !imageHandlers ) { + imageHandlers = new TQIHList; + TQ_CHECK_PTR( imageHandlers ); + imageHandlers->setAutoDelete( TRUE ); + tqAddPostRoutine( cleanup ); +#ifndef TQT_NO_IMAGEIO_BMP + TQImageIO::defineIOHandler( "BMP", "^BM", 0, + read_bmp_image, write_bmp_image ); +#endif +#ifndef TQT_NO_IMAGEIO_PPM + TQImageIO::defineIOHandler( "PBM", "^P1", "t", + read_pbm_image, write_pbm_image ); + TQImageIO::defineIOHandler( "PBMRAW", "^P4", "O", + read_pbm_image, write_pbm_image ); + TQImageIO::defineIOHandler( "PGM", "^P2", "t", + read_pbm_image, write_pbm_image ); + TQImageIO::defineIOHandler( "PGMRAW", "^P5", "O", + read_pbm_image, write_pbm_image ); + TQImageIO::defineIOHandler( "PPM", "^P3", "t", + read_pbm_image, write_pbm_image ); + TQImageIO::defineIOHandler( "PPMRAW", "^P6", "O", + read_pbm_image, write_pbm_image ); +#endif +#ifndef TQT_NO_IMAGEIO_XBM + TQImageIO::defineIOHandler( "XBM", "^((/\\*(?!.XPM.\\*/))|#define)", "T", + read_xbm_image, write_xbm_image ); +#endif +#ifndef TQT_NO_IMAGEIO_XPM + TQImageIO::defineIOHandler( "XPM", "/\\*.XPM.\\*/", "T", + read_xpm_image, write_xpm_image ); +#endif +#ifndef TQT_NO_IMAGEIO_MNG + qInitMngIO(); +#endif +#ifndef TQT_NO_IMAGEIO_PNG + qInitPngIO(); +#endif +#ifndef TQT_NO_IMAGEIO_JPEG + qInitJpegIO(); +#endif + } +} + +static TQImageHandler *get_image_handler( const char *format ) +{ // get pointer to handler + tqt_init_image_handlers(); + tqt_init_image_plugins(); + TQImageHandler *p = imageHandlers->first(); + while ( p ) { // traverse list + if ( p->format == format ) + return p; + p = imageHandlers->next(); + } + return 0; // no such handler +} + + +/*! + Defines an image I/O handler for the image format called \a + format, which is recognized using the \link ntqregexp.html#details + regular expression\endlink \a header, read using \a readImage and + written using \a writeImage. + + \a flags is a string of single-character flags for this format. + The only flag defined currently is T (upper case), so the only + legal value for \a flags are "T" and the empty string. The "T" + flag means that the image file is a text file, and TQt should treat + all newline conventions as equivalent. (XPM files and some PPM + files are text files for example.) + + \a format is used to select a handler to write a TQImage; \a header + is used to select a handler to read an image file. + + If \a readImage is a null pointer, the TQImageIO will not be able + to read images in \a format. If \a writeImage is a null pointer, + the TQImageIO will not be able to write images in \a format. If + both are null, the TQImageIO object is valid but useless. + + Example: + \code + void readGIF( TQImageIO *image ) + { + // read the image using the image->ioDevice() + } + + void writeGIF( TQImageIO *image ) + { + // write the image using the image->ioDevice() + } + + // add the GIF image handler + + TQImageIO::defineIOHandler( "GIF", + "^GIF[0-9][0-9][a-z]", + 0, + readGIF, + writeGIF ); + \endcode + + Before the regex test, all the 0 bytes in the file header are + converted to 1 bytes. This is done because when TQt was + ASCII-based, TQRegExp could not handle 0 bytes in strings. + + The regexp is only applied on the first 14 bytes of the file. + + Note that TQt assumes that there is only one handler per format; if + two handlers support the same format, TQt will choose one + arbitrarily. It is not possible to have one handler support + reading, and another support writing. +*/ + +void TQImageIO::defineIOHandler( const char *format, + const char *header, + const char *flags, + image_io_handler readImage, + image_io_handler writeImage ) +{ + tqt_init_image_handlers(); + TQImageHandler *p; + p = new TQImageHandler( format, header, flags, + readImage, writeImage ); + TQ_CHECK_PTR( p ); + imageHandlers->insert( 0, p ); +} + + +/***************************************************************************** + TQImageIO normal member functions + *****************************************************************************/ + +/*! + \fn const TQImage &TQImageIO::image() const + + Returns the image currently set. + + \sa setImage() +*/ + +/*! + \fn int TQImageIO::status() const + + Returns the image's IO status. A non-zero value indicates an + error, whereas 0 means that the IO operation was successful. + + \sa setStatus() +*/ + +/*! + \fn const char *TQImageIO::format() const + + Returns the image format string or 0 if no format has been + explicitly set. +*/ + +/*! + \fn TQIODevice *TQImageIO::ioDevice() const + + Returns the IO device currently set. + + \sa setIODevice() +*/ + +/*! + \fn TQString TQImageIO::fileName() const + + Returns the file name currently set. + + \sa setFileName() +*/ + +/*! + \fn TQString TQImageIO::description() const + + Returns the image description string. + + \sa setDescription() +*/ + + +/*! + Sets the image to \a image. + + \sa image() +*/ + +void TQImageIO::setImage( const TQImage &image ) +{ + im = image; +} + +/*! + Sets the image IO status to \a status. A non-zero value indicates + an error, whereas 0 means that the IO operation was successful. + + \sa status() +*/ + +void TQImageIO::setStatus( int status ) +{ + iostat = status; +} + +/*! + Sets the image format to \a format for the image to be read or + written. + + It is necessary to specify a format before writing an image, but + it is not necessary to specify a format before reading an image. + + If no format has been set, TQt guesses the image format before + reading it. If a format is set the image will only be read if it + has that format. + + \sa read() write() format() +*/ + +void TQImageIO::setFormat( const char *format ) +{ + frmt = format; +} + +/*! + Sets the IO device to be used for reading or writing an image. + + Setting the IO device allows images to be read/written to any + block-oriented TQIODevice. + + If \a ioDevice is not null, this IO device will override file name + settings. + + \sa setFileName() +*/ + +void TQImageIO::setIODevice( TQIODevice *ioDevice ) +{ + iodev = ioDevice; +} + +/*! + Sets the name of the file to read or write an image from to \a + fileName. + + \sa setIODevice() +*/ + +void TQImageIO::setFileName( const TQString &fileName ) +{ + fname = fileName; +} + +/*! + Returns the quality of the written image, related to the + compression ratio. + + \sa setQuality() TQImage::save() +*/ + +int TQImageIO::quality() const +{ + return d->quality; +} + +/*! + Sets the quality of the written image to \a q, related to the + compression ratio. + + \a q must be in the range -1..100. Specify 0 to obtain small + compressed files, 100 for large uncompressed files. (-1 signifies + the default compression.) + + \sa quality() TQImage::save() +*/ + +void TQImageIO::setQuality( int q ) +{ + d->quality = q; +} + +/*! + Returns the image's parameters string. + + \sa setParameters() +*/ + +const char *TQImageIO::parameters() const +{ + return d->parameters; +} + +/*! + Sets the image's parameter string to \a parameters. This is for + image handlers that require special parameters. + + Although the current image formats supported by TQt ignore the + parameters string, it may be used in future extensions or by + contributions (for example, JPEG). + + \sa parameters() +*/ + +void TQImageIO::setParameters( const char *parameters ) +{ + if ( d && d->parameters ) + delete [] (char*)d->parameters; + d->parameters = tqstrdup( parameters ); +} + +/*! + Sets the gamma value at which the image will be viewed to \a + gamma. If the image format stores a gamma value for which the + image is intended to be used, then this setting will be used to + modify the image. Setting to 0.0 will disable gamma correction + (i.e. any specification in the file will be ignored). + + The default value is 0.0. + + \sa gamma() +*/ +void TQImageIO::setGamma( float gamma ) +{ + d->gamma=gamma; +} + +/*! + Returns the gamma value at which the image will be viewed. + + \sa setGamma() +*/ +float TQImageIO::gamma() const +{ + return d->gamma; +} + +/*! + Sets the image description string for image handlers that support + image descriptions to \a description. + + Currently, no image format supported by TQt uses the description + string. +*/ + +void TQImageIO::setDescription( const TQString &description ) +{ + descr = description; +} + + +/*! + Returns a string that specifies the image format of the file \a + fileName, or null if the file cannot be read or if the format is + not recognized. +*/ + +const char* TQImageIO::imageFormat( const TQString &fileName ) +{ + TQFile file( fileName ); + if ( !file.open(IO_ReadOnly) ) + return 0; + const char* format = imageFormat( &file ); + file.close(); + return format; +} + +/*! + \overload + + Returns a string that specifies the image format of the image read + from IO device \a d, or 0 if the device cannot be read or if the + format is not recognized. + + Make sure that \a d is at the right position in the device (for + example, at the beginning of the file). + + \sa TQIODevice::at() +*/ + +const char *TQImageIO::imageFormat( TQIODevice *d ) +{ + // if you change this change the documentation for defineIOHandler() + const int buflen = 14; + + char buf[buflen]; + char buf2[buflen]; + tqt_init_image_handlers(); + tqt_init_image_plugins(); + int pos = d->at(); // save position + int rdlen = d->readBlock( buf, buflen ); // read a few bytes + + if ( rdlen != buflen ) + return 0; + + memcpy( buf2, buf, buflen ); + + const char* format = 0; + for ( int n = 0; n < rdlen; n++ ) + if ( buf[n] == '\0' ) + buf[n] = '\001'; + if ( d->status() == IO_Ok && rdlen > 0 ) { + buf[rdlen - 1] = '\0'; + TQString bufStr = TQString::fromLatin1(buf); + TQImageHandler *p = imageHandlers->first(); + int bestMatch = -1; + while ( p ) { + if ( p->read_image && p->header.search(bufStr) != -1 ) { + // try match with header if a read function is available + if (p->header.matchedLength() > bestMatch) { + // keep looking for best match + format = p->format; + bestMatch = p->header.matchedLength(); + } + } + p = imageHandlers->next(); + } + } + d->at( pos ); // restore position +#ifndef TQT_NO_ASYNC_IMAGE_IO + if ( !format ) + format = TQImageDecoder::formatName( (uchar*)buf2, rdlen ); +#endif + + return format; +} + +/*! + Returns a sorted list of image formats that are supported for + image input. +*/ +TQStrList TQImageIO::inputFormats() +{ + TQStrList result; + + tqt_init_image_handlers(); + tqt_init_image_plugins(); + +#ifndef TQT_NO_ASYNC_IMAGE_IO + // Include asynchronous loaders first. + result = TQImageDecoder::inputFormats(); +#endif + + TQImageHandler *p = imageHandlers->first(); + while ( p ) { + if ( p->read_image + && !p->obsolete + && !result.contains(p->format) ) + { + result.inSort(p->format); + } + p = imageHandlers->next(); + } + + return result; +} + +/*! + Returns a sorted list of image formats that are supported for + image output. +*/ +TQStrList TQImageIO::outputFormats() +{ + TQStrList result; + + tqt_init_image_handlers(); + tqt_init_image_plugins(); + + // Include asynchronous writers (!) first. + // (None) + + TQImageHandler *p = imageHandlers->first(); + while ( p ) { + if ( p->write_image + && !p->obsolete + && !result.contains(p->format) ) + { + result.inSort(p->format); + } + p = imageHandlers->next(); + } + + return result; +} + + + +/*! + Reads an image into memory and returns TRUE if the image was + successfully read; otherwise returns FALSE. + + Before reading an image you must set an IO device or a file name. + If both an IO device and a file name have been set, the IO device + will be used. + + Setting the image file format string is optional. + + Note that this function does \e not set the \link format() + format\endlink used to read the image. If you need that + information, use the imageFormat() static functions. + + Example: + + \code + TQImageIO iio; + TQPixmap pixmap; + iio.setFileName( "vegeburger.bmp" ); + if ( image.read() ) // ok + pixmap = iio.image(); // convert to pixmap + \endcode + + \sa setIODevice() setFileName() setFormat() write() TQPixmap::load() +*/ + +bool TQImageIO::read() +{ + TQFile file; + const char *image_format; + TQImageHandler *h; + + if ( iodev ) { // read from io device + // ok, already open + } else if ( !fname.isEmpty() ) { // read from file + file.setName( fname ); + if ( !file.open(IO_ReadOnly) ) + return FALSE; // cannot open file + iodev = &file; + } else { // no file name or io device + return FALSE; + } + if (frmt.isEmpty()) { + // Try to guess format + image_format = imageFormat( iodev ); // get image format + if ( !image_format ) { + if ( file.isOpen() ) { // unknown format + file.close(); + iodev = 0; + } + return FALSE; + } + } else { + image_format = frmt; + } + + h = get_image_handler( image_format ); + if ( file.isOpen() ) { +#if !defined(Q_OS_UNIX) + if ( h && h->text_mode ) { // reopen in translated mode + file.close(); + file.open( IO_ReadOnly | IO_Translate ); + } + else +#endif + file.at( 0 ); // position to start + } + iostat = 1; // assume error + + if ( h && h->read_image ) { + (*h->read_image)( this ); + } +#ifndef TQT_NO_ASYNC_IMAGE_IO + else { + // Format name, but no handler - must be an asychronous reader + read_async_image( this ); + } +#endif + + if ( file.isOpen() ) { // image was read using file + file.close(); + iodev = 0; + } + return iostat == 0; // image successfully read? +} + + +/*! + Writes an image to an IO device and returns TRUE if the image was + successfully written; otherwise returns FALSE. + + Before writing an image you must set an IO device or a file name. + If both an IO device and a file name have been set, the IO device + will be used. + + The image will be written using the specified image format. + + Example: + \code + TQImageIO iio; + TQImage im; + im = pixmap; // convert to image + iio.setImage( im ); + iio.setFileName( "vegeburger.bmp" ); + iio.setFormat( "BMP" ); + if ( iio.write() ) + // returned TRUE if written successfully + \endcode + + \sa setIODevice() setFileName() setFormat() read() TQPixmap::save() +*/ + +bool TQImageIO::write() +{ + if ( frmt.isEmpty() ) + return FALSE; + TQImageHandler *h = get_image_handler( frmt ); + if ( !h && !plugin_manager) { + tqt_init_image_plugins(); + h = get_image_handler( frmt ); + } + if ( !h || !h->write_image ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImageIO::write: No such image format handler: %s", + format() ); +#endif + return FALSE; + } + TQFile file; + if ( !iodev && !fname.isEmpty() ) { + file.setName( fname ); + bool translate = h->text_mode==TQImageHandler::TranslateInOut; + int fmode = translate ? IO_WriteOnly|IO_Translate : IO_WriteOnly; + if ( !file.open(fmode) ) // couldn't create file + return FALSE; + iodev = &file; + } + iostat = 1; + (*h->write_image)( this ); + if ( file.isOpen() ) { // image was written using file + file.close(); + iodev = 0; + } + return iostat == 0; // image successfully written? +} +#endif //TQT_NO_IMAGEIO + +#ifndef TQT_NO_IMAGEIO_BMP + +/***************************************************************************** + BMP (DIB) image read/write functions + *****************************************************************************/ + +const int BMP_FILEHDR_SIZE = 14; // size of BMP_FILEHDR data + +struct BMP_FILEHDR { // BMP file header + char bfType[2]; // "BM" + TQ_INT32 bfSize; // size of file + TQ_INT16 bfReserved1; + TQ_INT16 bfReserved2; + TQ_INT32 bfOffBits; // pointer to the pixmap bits +}; + +TQDataStream &operator>>( TQDataStream &s, BMP_FILEHDR &bf ) +{ // read file header + s.readRawBytes( bf.bfType, 2 ); + s >> bf.bfSize >> bf.bfReserved1 >> bf.bfReserved2 >> bf.bfOffBits; + return s; +} + +TQDataStream &operator<<( TQDataStream &s, const BMP_FILEHDR &bf ) +{ // write file header + s.writeRawBytes( bf.bfType, 2 ); + s << bf.bfSize << bf.bfReserved1 << bf.bfReserved2 << bf.bfOffBits; + return s; +} + + +const int BMP_OLD = 12; // old Windows/OS2 BMP size +const int BMP_WIN = 40; // new Windows BMP size +const int BMP_OS2 = 64; // new OS/2 BMP size + +const int BMP_RGB = 0; // no compression +const int BMP_RLE8 = 1; // run-length encoded, 8 bits +const int BMP_RLE4 = 2; // run-length encoded, 4 bits +const int BMP_BITFIELDS = 3; // RGB values encoded in data as bit-fields + +struct BMP_INFOHDR { // BMP information header + TQ_INT32 biSize; // size of this struct + TQ_INT32 biWidth; // pixmap width + TQ_INT32 biHeight; // pixmap height + TQ_INT16 biPlanes; // should be 1 + TQ_INT16 biBitCount; // number of bits per pixel + TQ_INT32 biCompression; // compression method + TQ_INT32 biSizeImage; // size of image + TQ_INT32 biXPelsPerMeter; // horizontal resolution + TQ_INT32 biYPelsPerMeter; // vertical resolution + TQ_INT32 biClrUsed; // number of colors used + TQ_INT32 biClrImportant; // number of important colors +}; + + +TQDataStream &operator>>( TQDataStream &s, BMP_INFOHDR &bi ) +{ + s >> bi.biSize; + if ( bi.biSize == BMP_WIN || bi.biSize == BMP_OS2 ) { + s >> bi.biWidth >> bi.biHeight >> bi.biPlanes >> bi.biBitCount; + s >> bi.biCompression >> bi.biSizeImage; + s >> bi.biXPelsPerMeter >> bi.biYPelsPerMeter; + s >> bi.biClrUsed >> bi.biClrImportant; + } + else { // probably old Windows format + TQ_INT16 w, h; + s >> w >> h >> bi.biPlanes >> bi.biBitCount; + bi.biWidth = w; + bi.biHeight = h; + bi.biCompression = BMP_RGB; // no compression + bi.biSizeImage = 0; + bi.biXPelsPerMeter = bi.biYPelsPerMeter = 0; + bi.biClrUsed = bi.biClrImportant = 0; + } + return s; +} + +TQDataStream &operator<<( TQDataStream &s, const BMP_INFOHDR &bi ) +{ + s << bi.biSize; + s << bi.biWidth << bi.biHeight; + s << bi.biPlanes; + s << bi.biBitCount; + s << bi.biCompression; + s << bi.biSizeImage; + s << bi.biXPelsPerMeter << bi.biYPelsPerMeter; + s << bi.biClrUsed << bi.biClrImportant; + return s; +} + +static +int calc_shift(int mask) +{ + int result = 0; + while (!(mask & 1)) { + result++; + mask >>= 1; + } + return result; +} + +static +bool read_dib( TQDataStream& s, int offset, int startpos, TQImage& image ) +{ + BMP_INFOHDR bi; + TQIODevice* d = s.device(); + + s >> bi; // read BMP info header + if ( d->atEnd() ) // end of stream/file + return FALSE; +#if 0 + tqDebug( "offset...........%d", offset ); + tqDebug( "startpos.........%d", startpos ); + tqDebug( "biSize...........%d", bi.biSize ); + tqDebug( "biWidth..........%d", bi.biWidth ); + tqDebug( "biHeight.........%d", bi.biHeight ); + tqDebug( "biPlanes.........%d", bi.biPlanes ); + tqDebug( "biBitCount.......%d", bi.biBitCount ); + tqDebug( "biCompression....%d", bi.biCompression ); + tqDebug( "biSizeImage......%d", bi.biSizeImage ); + tqDebug( "biXPelsPerMeter..%d", bi.biXPelsPerMeter ); + tqDebug( "biYPelsPerMeter..%d", bi.biYPelsPerMeter ); + tqDebug( "biClrUsed........%d", bi.biClrUsed ); + tqDebug( "biClrImportant...%d", bi.biClrImportant ); +#endif + int w = bi.biWidth, h = bi.biHeight, nbits = bi.biBitCount; + int t = bi.biSize, comp = bi.biCompression; + int red_mask, green_mask, blue_mask; + int red_shift = 0; + int green_shift = 0; + int blue_shift = 0; + int red_scale = 0; + int green_scale = 0; + int blue_scale = 0; + + if ( !(nbits == 1 || nbits == 4 || nbits == 8 || nbits == 16 || nbits == 24 || nbits == 32) || + bi.biPlanes != 1 || comp > BMP_BITFIELDS ) + return FALSE; // weird BMP image + if ( !(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || + (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS)) ) + return FALSE; // weird compression type + if ((w < 0) || ((w * abs(h)) > (16384 * 16384))) + return FALSE; + + int ncols; + int depth; + switch ( nbits ) { + case 32: + case 24: + case 16: + depth = 32; + break; + case 8: + case 4: + depth = 8; + break; + default: + depth = 1; + } + if ( depth == 32 ) // there's no colormap + ncols = 0; + else // # colors used + ncols = bi.biClrUsed ? bi.biClrUsed : 1 << nbits; + + image.create( w, h, depth, ncols, nbits == 1 ? + TQImage::BigEndian : TQImage::IgnoreEndian ); + if ( image.isNull() ) // could not create image + return FALSE; + + image.setDotsPerMeterX( bi.biXPelsPerMeter ); + image.setDotsPerMeterY( bi.biYPelsPerMeter ); + + d->at( startpos + BMP_FILEHDR_SIZE + bi.biSize ); // goto start of colormap + + if ( ncols > 0 ) { // read color table + uchar rgb[4]; + int rgb_len = t == BMP_OLD ? 3 : 4; + for ( int i=0; ireadBlock( (char *)rgb, rgb_len ) != rgb_len ) + return FALSE; + image.setColor( i, tqRgb(rgb[2],rgb[1],rgb[0]) ); + if ( d->atEnd() ) // truncated file + return FALSE; + } + } else if (comp == BMP_BITFIELDS && (nbits == 16 || nbits == 32)) { + if ( (TQ_ULONG)d->readBlock( (char *)&red_mask, sizeof(red_mask) ) != sizeof(red_mask) ) + return FALSE; + if ( (TQ_ULONG)d->readBlock( (char *)&green_mask, sizeof(green_mask) ) != sizeof(green_mask) ) + return FALSE; + if ( (TQ_ULONG)d->readBlock( (char *)&blue_mask, sizeof(blue_mask) ) != sizeof(blue_mask) ) + return FALSE; + red_shift = calc_shift(red_mask); + if (((red_mask >> red_shift) + 1) == 0) + return FALSE; + red_scale = 256 / ((red_mask >> red_shift) + 1); + green_shift = calc_shift(green_mask); + if (((green_mask >> green_shift) + 1) == 0) + return FALSE; + green_scale = 256 / ((green_mask >> green_shift) + 1); + blue_shift = calc_shift(blue_mask); + if (((blue_mask >> blue_shift) + 1) == 0) + return FALSE; + blue_scale = 256 / ((blue_mask >> blue_shift) + 1); + } else if (comp == BMP_RGB && (nbits == 24 || nbits == 32)) { + blue_mask = 0x000000ff; + green_mask = 0x0000ff00; + red_mask = 0x00ff0000; + blue_shift = 0; + green_shift = 8; + red_shift = 16; + blue_scale = green_scale = red_scale = 1; + } else if (comp == BMP_RGB && nbits == 16) // don't support RGB values for 15/16 bpp + return FALSE; + + // offset can be bogus, be careful + if (offset>=0 && startpos + offset > (TQ_LONG)d->at() ) + d->at( startpos + offset ); // start of image data + + int bpl = image.bytesPerLine(); +#ifdef TQ_WS_QWS + // + // Guess the number of bytes-per-line if we don't know how much + // image data is in the file (bogus image ?). + // + int bmpbpl = bi.biSizeImage > 0 ? + bi.biSizeImage / bi.biHeight : + (d->size() - offset) / bi.biHeight; + int pad = bmpbpl-bpl; +#endif + uchar **line = image.jumpTable(); + + if ( nbits == 1 ) { // 1 bit BMP image + while ( --h >= 0 ) { + if ( d->readBlock((char*)line[h],bpl) != bpl ) + break; +#ifdef TQ_WS_QWS + if ( pad > 0 ) + d->at(d->at()+pad); +#endif + } + if ( ncols == 2 && tqGray(image.color(0)) < tqGray(image.color(1)) ) + swapPixel01( &image ); // pixel 0 is white! + } + + else if ( nbits == 4 ) { // 4 bit BMP image + int buflen = ((w+7)/8)*4; + uchar *buf = new uchar[buflen]; + TQ_CHECK_PTR( buf ); + if ( comp == BMP_RLE4 ) { // run length compression + int x=0, y=0, b, c, i; + uchar *p = line[h-1]; + uchar *endp = line[h-1]+w; + while ( y < h ) { + if ( (b=d->getch()) == EOF ) + break; + if ( b == 0 ) { // escape code + switch ( (b=d->getch()) ) { + case 0: // end of line + x = 0; + y++; + p = line[h-y-1]; + break; + case 1: // end of image + case EOF: // end of file + y = h; // exit loop + break; + case 2: // delta (jump) + x += d->getch(); + y += d->getch(); + + // Protection + if ( (uint)x >= (uint)w ) + x = w-1; + if ( (uint)y >= (uint)h ) + y = h-1; + + p = line[h-y-1] + x; + break; + default: // absolute mode + // Protection + if ( p + b > endp ) + b = endp-p; + + i = (c = b)/2; + while ( i-- ) { + b = d->getch(); + *p++ = b >> 4; + *p++ = b & 0x0f; + } + if ( c & 1 ) + *p++ = d->getch() >> 4; + if ( (((c & 3) + 1) & 2) == 2 ) + d->getch(); // align on word boundary + x += c; + } + } else { // encoded mode + // Protection + if ( p + b > endp ) + b = endp-p; + + i = (c = b)/2; + b = d->getch(); // 2 pixels to be repeated + while ( i-- ) { + *p++ = b >> 4; + *p++ = b & 0x0f; + } + if ( c & 1 ) + *p++ = b >> 4; + x += c; + } + } + } else if ( comp == BMP_RGB ) { // no compression + while ( --h >= 0 ) { + if ( d->readBlock((char*)buf,buflen) != buflen ) + break; + uchar *p = line[h]; + uchar *b = buf; + for ( int i=0; i> 4; + *p++ = *b++ & 0x0f; + } + if ( w & 1 ) // the last nibble + *p = *b >> 4; + } + } + delete [] buf; + } + + else if ( nbits == 8 ) { // 8 bit BMP image + if ( comp == BMP_RLE8 ) { // run length compression + int x=0, y=0, b; + uchar *p = line[h-1]; + const uchar *endp = line[h-1]+w; + while ( y < h ) { + if ( (b=d->getch()) == EOF ) + break; + if ( b == 0 ) { // escape code + switch ( (b=d->getch()) ) { + case 0: // end of line + x = 0; + y++; + p = line[h-y-1]; + break; + case 1: // end of image + case EOF: // end of file + y = h; // exit loop + break; + case 2: // delta (jump) + x += d->getch(); + y += d->getch(); + + // Protection + if ( (uint)x >= (uint)w ) + x = w-1; + if ( (uint)y >= (uint)h ) + y = h-1; + + p = line[h-y-1] + x; + break; + default: // absolute mode + // Protection + if ( p + b > endp ) + b = endp-p; + + if ( d->readBlock( (char *)p, b ) != b ) + return FALSE; + if ( (b & 1) == 1 ) + d->getch(); // align on word boundary + x += b; + p += b; + } + } else { // encoded mode + // Protection + if ( p + b > endp ) + b = endp-p; + + memset( p, d->getch(), b ); // repeat pixel + x += b; + p += b; + } + } + } else if ( comp == BMP_RGB ) { // uncompressed + while ( --h >= 0 ) { + if ( d->readBlock((char *)line[h],bpl) != bpl ) + break; +#ifdef TQ_WS_QWS + if ( pad > 0 ) + d->at(d->at()+pad); +#endif + } + } + } + + else if ( nbits == 16 || nbits == 24 || nbits == 32 ) { // 16,24,32 bit BMP image + TQRgb *p; + TQRgb *end; + uchar *buf24 = new uchar[bpl]; + int bpl24 = ((w*nbits+31)/32)*4; + uchar *b; + int c; + + while ( --h >= 0 ) { + p = (TQRgb *)line[h]; + end = p + w; + if ( d->readBlock( (char *)buf24,bpl24) != bpl24 ) + break; + b = buf24; + while ( p < end ) { + c = *(uchar*)b | (*(uchar*)(b+1)<<8); + if (nbits != 16) + c |= *(uchar*)(b+2)<<16; + *p++ = tqRgb(((c & red_mask) >> red_shift) * red_scale, + ((c & green_mask) >> green_shift) * green_scale, + ((c & blue_mask) >> blue_shift) * blue_scale); + b += nbits/8; + } + } + delete[] buf24; + } + + return TRUE; +} + +bool qt_read_dib( TQDataStream& s, TQImage& image ) +{ + return read_dib(s,-1,-BMP_FILEHDR_SIZE,image); +} + + +static void read_bmp_image( TQImageIO *iio ) +{ + TQIODevice *d = iio->ioDevice(); + TQDataStream s( d ); + BMP_FILEHDR bf; + int startpos = d->at(); + + s.setByteOrder( TQDataStream::LittleEndian );// Intel byte order + s >> bf; // read BMP file header + + if ( tqstrncmp(bf.bfType,"BM",2) != 0 ) // not a BMP image + return; + + TQImage image; + if (read_dib( s, bf.bfOffBits, startpos, image )) { + iio->setImage( image ); + iio->setStatus( 0 ); // image ok + } +} + +bool qt_write_dib( TQDataStream& s, TQImage image ) +{ + int nbits; + int bpl_bmp; + int bpl = image.bytesPerLine(); + + TQIODevice* d = s.device(); + + if ( image.depth() == 8 && image.numColors() <= 16 ) { + bpl_bmp = (((bpl+1)/2+3)/4)*4; + nbits = 4; + } else if ( image.depth() == 32 ) { + bpl_bmp = ((image.width()*24+31)/32)*4; + nbits = 24; +#ifdef TQ_WS_QWS + } else if ( image.depth() == 1 || image.depth() == 8 ) { + // TQt/E doesn't word align. + bpl_bmp = ((image.width()*image.depth()+31)/32)*4; + nbits = image.depth(); +#endif + } else { + bpl_bmp = bpl; + nbits = image.depth(); + } + + BMP_INFOHDR bi; + bi.biSize = BMP_WIN; // build info header + bi.biWidth = image.width(); + bi.biHeight = image.height(); + bi.biPlanes = 1; + bi.biBitCount = nbits; + bi.biCompression = BMP_RGB; + bi.biSizeImage = bpl_bmp*image.height(); + bi.biXPelsPerMeter = image.dotsPerMeterX() ? image.dotsPerMeterX() + : 2834; // 72 dpi default + bi.biYPelsPerMeter = image.dotsPerMeterY() ? image.dotsPerMeterY() : 2834; + bi.biClrUsed = image.numColors(); + bi.biClrImportant = image.numColors(); + s << bi; // write info header + + if ( image.depth() != 32 ) { // write color table + uchar *color_table = new uchar[4*image.numColors()]; + uchar *rgb = color_table; + TQRgb *c = image.colorTable(); + for ( int i=0; iwriteBlock( (char *)color_table, 4*image.numColors() ); + delete [] color_table; + } + + if ( image.depth() == 1 && image.bitOrder() != TQImage::BigEndian ) + image = image.convertBitOrder( TQImage::BigEndian ); + + int y; + + if ( nbits == 1 || nbits == 8 ) { // direct output +#ifdef TQ_WS_QWS + // TQt/E doesn't word align. + int pad = bpl_bmp - bpl; + char padding[4]; +#endif + for ( y=image.height()-1; y>=0; y-- ) { + d->writeBlock( (char*)image.scanLine(y), bpl ); +#ifdef TQ_WS_QWS + d->writeBlock( padding, pad ); +#endif + } + return TRUE; + } + + uchar *buf = new uchar[bpl_bmp]; + uchar *b, *end; + uchar *p; + + memset( buf, 0, bpl_bmp ); + for ( y=image.height()-1; y>=0; y-- ) { // write the image bits + if ( nbits == 4 ) { // convert 8 -> 4 bits + p = image.scanLine(y); + b = buf; + end = b + image.width()/2; + while ( b < end ) { + *b++ = (*p << 4) | (*(p+1) & 0x0f); + p += 2; + } + if ( image.width() & 1 ) + *b = *p << 4; + } else { // 32 bits + TQRgb *p = (TQRgb *)image.scanLine( y ); + TQRgb *end = p + image.width(); + b = buf; + while ( p < end ) { + *b++ = tqBlue(*p); + *b++ = tqGreen(*p); + *b++ = tqRed(*p); + p++; + } + } + if ( bpl_bmp != d->writeBlock( (char*)buf, bpl_bmp ) ) { + delete[] buf; + return FALSE; + } + } + delete[] buf; + return TRUE; +} + + +static void write_bmp_image( TQImageIO *iio ) +{ + TQIODevice *d = iio->ioDevice(); + TQImage image = iio->image(); + TQDataStream s( d ); + BMP_FILEHDR bf; + int bpl_bmp; + int bpl = image.bytesPerLine(); + + // Code partially repeated in qt_write_dib + if ( image.depth() == 8 && image.numColors() <= 16 ) { + bpl_bmp = (((bpl+1)/2+3)/4)*4; + } else if ( image.depth() == 32 ) { + bpl_bmp = ((image.width()*24+31)/32)*4; + } else { + bpl_bmp = bpl; + } + + iio->setStatus( 0 ); + s.setByteOrder( TQDataStream::LittleEndian );// Intel byte order + strncpy( bf.bfType, "BM", 2 ); // build file header + bf.bfReserved1 = bf.bfReserved2 = 0; // reserved, should be zero + bf.bfOffBits = BMP_FILEHDR_SIZE + BMP_WIN + image.numColors()*4; + bf.bfSize = bf.bfOffBits + bpl_bmp*image.height(); + s << bf; // write file header + + if ( !qt_write_dib( s, image ) ) + iio->setStatus( 1 ); + +} + +#endif // TQT_NO_IMAGEIO_BMP + +#ifndef TQT_NO_IMAGEIO_PPM + +/***************************************************************************** + PBM/PGM/PPM (ASCII and RAW) image read/write functions + *****************************************************************************/ + +static int read_pbm_int( TQIODevice *d ) +{ + int c; + int val = -1; + bool digit; + const int buflen = 100; + char buf[buflen]; + for ( ;; ) { + if ( (c=d->getch()) == EOF ) // end of file + break; + digit = isdigit( (uchar) c ); + if ( val != -1 ) { + if ( digit ) { + val = 10*val + c - '0'; + continue; + } else { + if ( c == '#' ) // comment + d->readLine( buf, buflen ); + break; + } + } + if ( digit ) // first digit + val = c - '0'; + else if ( isspace((uchar) c) ) + continue; + else if ( c == '#' ) + d->readLine( buf, buflen ); + else + break; + } + return val; +} + +static void read_pbm_image( TQImageIO *iio ) // read PBM image data +{ + const int buflen = 300; + char buf[buflen]; + TQIODevice *d = iio->ioDevice(); + int w, h, nbits, mcc, y; + int pbm_bpl; + char type; + bool raw; + TQImage image; + + if ( d->readBlock( buf, 3 ) != 3 ) // read P[1-6] + return; + if ( !(buf[0] == 'P' && isdigit((uchar) buf[1]) && isspace((uchar) buf[2])) ) + return; + switch ( (type=buf[1]) ) { + case '1': // ascii PBM + case '4': // raw PBM + nbits = 1; + break; + case '2': // ascii PGM + case '5': // raw PGM + nbits = 8; + break; + case '3': // ascii PPM + case '6': // raw PPM + nbits = 32; + break; + default: + return; + } + raw = type >= '4'; + w = read_pbm_int( d ); // get image width + h = read_pbm_int( d ); // get image height + if ( nbits == 1 ) + mcc = 1; // ignore max color component + else + mcc = read_pbm_int( d ); // get max color component + if ( w <= 0 || w > 32767 || h <= 0 || h > 32767 || mcc <= 0 || mcc > 0xffff ) + return; // weird P.M image + + int maxc = mcc; + if ( maxc > 255 ) + maxc = 255; + image.create( w, h, nbits, 0, + nbits == 1 ? TQImage::BigEndian : TQImage::IgnoreEndian ); + if ( image.isNull() ) + return; + + pbm_bpl = (nbits*w+7)/8; // bytes per scanline in PBM + + if ( raw ) { // read raw data + if ( nbits == 32 ) { // type 6 + pbm_bpl = 3*w; + uchar *buf24 = new uchar[pbm_bpl], *b; + TQRgb *p; + TQRgb *end; + for ( y=0; yreadBlock( (char *)buf24, pbm_bpl ) != pbm_bpl ) { + delete[] buf24; + return; + } + p = (TQRgb *)image.scanLine( y ); + end = p + w; + b = buf24; + while ( p < end ) { + *p++ = tqRgb(b[0],b[1],b[2]); + b += 3; + } + } + delete[] buf24; + } else { // type 4,5 + for ( y=0; yreadBlock( (char *)image.scanLine(y), pbm_bpl ) + != pbm_bpl ) + return; + } + } + } else { // read ascii data + uchar *p; + int n; + for ( y=0; ysetImage( image ); + iio->setStatus( 0 ); // image ok +} + + +static void write_pbm_image( TQImageIO *iio ) +{ + TQIODevice* out = iio->ioDevice(); + TQCString str; + + TQImage image = iio->image(); + TQCString format = iio->format(); + format = format.left(3); // ignore RAW part + bool gray = format == "PGM"; + + if ( format == "PBM" ) { + image = image.convertDepth(1); + } else if ( image.depth() == 1 ) { + image = image.convertDepth(8); + } + + if ( image.depth() == 1 && image.numColors() == 2 ) { + if ( tqGray(image.color(0)) < tqGray(image.color(1)) ) { + // 0=dark/black, 1=light/white - invert + image.detach(); + for ( int y=0; ywriteBlock(str, str.length()) != str.length()) { + iio->setStatus(1); + return; + } + w = (w+7)/8; + for (uint y=0; ywriteBlock((char*)line, w) ) { + iio->setStatus(1); + return; + } + } + } + break; + + case 8: { + str.insert(1, gray ? '5' : '6'); + str.append("255\n"); + if ((uint)out->writeBlock(str, str.length()) != str.length()) { + iio->setStatus(1); + return; + } + TQRgb *color = image.colorTable(); + uint bpl = w*(gray ? 1 : 3); + uchar *buf = new uchar[bpl]; + for (uint y=0; ywriteBlock((char*)buf, bpl) ) { + iio->setStatus(1); + return; + } + } + delete [] buf; + } + break; + + case 32: { + str.insert(1, gray ? '5' : '6'); + str.append("255\n"); + if ((uint)out->writeBlock(str, str.length()) != str.length()) { + iio->setStatus(1); + return; + } + uint bpl = w*(gray ? 1 : 3); + uchar *buf = new uchar[bpl]; + for (uint y=0; ywriteBlock((char*)buf, bpl) ) { + iio->setStatus(1); + return; + } + } + delete [] buf; + } + } + + iio->setStatus(0); +} + +#endif // TQT_NO_IMAGEIO_PPM + +#ifndef TQT_NO_ASYNC_IMAGE_IO + +class TQImageIOFrameGrabber : public TQImageConsumer { +public: + TQImageIOFrameGrabber() : framecount(0) { } + virtual ~TQImageIOFrameGrabber() { } + + TQImageDecoder *decoder; + int framecount; + + void changed(const TQRect&) { } + void end() { } + void frameDone(const TQPoint&, const TQRect&) { framecount++; } + void frameDone() { framecount++; } + void setLooping(int) { } + void setFramePeriod(int) { } + void setSize(int, int) { } +}; + +static void read_async_image( TQImageIO *iio ) +{ + const int buf_len = 2048; + uchar buffer[buf_len]; + TQIODevice *d = iio->ioDevice(); + TQImageIOFrameGrabber* consumer = new TQImageIOFrameGrabber(); + TQImageDecoder *decoder = new TQImageDecoder(consumer); + consumer->decoder = decoder; + int startAt = d->at(); + int totLen = 0; + + for (;;) { + int length = d->readBlock((char*)buffer, buf_len); + if ( length <= 0 ) { + iio->setStatus(length); + break; + } + uchar* b = buffer; + int r = -1; + while (length > 0 && consumer->framecount==0) { + r = decoder->decode(b, length); + if ( r <= 0 ) break; + b += r; + totLen += r; + length -= r; + } + if ( consumer->framecount ) { + // Stopped after first frame + if ( d->isDirectAccess() ) + d->at( startAt + totLen ); + else { + // ### We have (probably) read too much from the stream into + // the buffer, and there is no way to put it back! + } + iio->setImage(decoder->image()); + iio->setStatus(0); + break; + } + if ( r <= 0 ) { + iio->setStatus(r); + break; + } + } + + consumer->decoder = 0; + delete decoder; + delete consumer; +} + +#endif // TQT_NO_ASYNC_IMAGE_IO + +#ifndef TQT_NO_IMAGEIO_XBM + +/***************************************************************************** + X bitmap image read/write functions + *****************************************************************************/ + +static inline int hex2byte( char *p ) +{ + return ( (isdigit((uchar) *p) ? *p - '0' : toupper((uchar) *p) - 'A' + 10) << 4 ) | + ( isdigit((uchar) *(p+1)) ? *(p+1) - '0' : toupper((uchar) *(p+1)) - 'A' + 10 ); +} + +static void read_xbm_image( TQImageIO *iio ) +{ + const int buflen = 300; + const int maxlen = 4096; + char buf[buflen]; + TQRegExp r1, r2; + TQIODevice *d = iio->ioDevice(); + int w=-1, h=-1; + TQImage image; + TQ_INT64 readBytes = 0; + TQ_INT64 totalReadBytes = 0; + + r1 = TQString::fromLatin1("^#define[ \t]+[a-zA-Z0-9._]+[ \t]+"); + r2 = TQString::fromLatin1("[0-9]+"); + + buf[0] = '\0'; + while (buf[0] != '#') { //skip leading comment, if any + readBytes = d->readLine(buf, buflen); + + // if readBytes >= buflen, it's very probably not a C file + if ((readBytes <= 0) || (readBytes >= (buflen-1))) + return; + + // limit xbm headers to the first 4k in the file to prevent + // excessive reads on non-xbm files + totalReadBytes += readBytes; + if (totalReadBytes >= maxlen) + return; + } + + TQString sbuf; + sbuf = TQString::fromLatin1(buf); + + if ( r1.search(sbuf) == 0 && + r2.search(sbuf, r1.matchedLength()) == r1.matchedLength() ) + w = atoi( &buf[r1.matchedLength()] ); + + readBytes = d->readLine(buf, buflen ); // "#define .._height " + if (readBytes <= 0) { + return; + } + sbuf = TQString::fromLatin1(buf); + + if ( r1.search(sbuf) == 0 && + r2.search(sbuf, r1.matchedLength()) == r1.matchedLength() ) + h = atoi( &buf[r1.matchedLength()] ); + + if ( w <= 0 || w > 32767 || h <= 0 || h > 32767 ) + return; // format error + + for ( ;; ) { // scan for data + readBytes = d->readLine(buf, buflen); + if (readBytes <= 0) { // end of file + return; + } + buf[readBytes] = '\0'; + if ( strstr(buf,"0x") != 0 ) // does line contain data? + break; + } + + image.create( w, h, 1, 2, TQImage::LittleEndian ); + if ( image.isNull() ) + return; + + image.setColor( 0, tqRgb(255,255,255) ); // white + image.setColor( 1, tqRgb(0,0,0) ); // black + + int x = 0, y = 0; + uchar *b = image.scanLine(0); + char *p = strstr( buf, "0x" ); + w = (w+7)/8; // byte width + + while ( y < h ) { // for all encoded bytes... + if (p && (p < (buf + readBytes - 3))) { // p = "0x.." + if (!isxdigit(p[2]) || !isxdigit(p[3])) { + return; + } + *b++ = hex2byte(p+2); + p += 2; + if ( ++x == w && ++y < h ) { + b = image.scanLine(y); + x = 0; + } + p = strstr( p, "0x" ); + } else { // read another line + readBytes = d->readLine(buf, buflen); + if (readBytes <= 0) // EOF ==> truncated image + break; + buf[readBytes] = '\0'; + p = strstr( buf, "0x" ); + } + } + + iio->setImage( image ); + iio->setStatus( 0 ); // image ok +} + + +static void write_xbm_image( TQImageIO *iio ) +{ + TQIODevice *d = iio->ioDevice(); + TQImage image = iio->image(); + int w = image.width(); + int h = image.height(); + int i; + TQString s = fbname(iio->fileName()); // get file base name + char *buf = new char[s.length() + 100]; + + sprintf( buf, "#define %s_width %d\n", s.ascii(), w ); + d->writeBlock( buf, tqstrlen(buf) ); + sprintf( buf, "#define %s_height %d\n", s.ascii(), h ); + d->writeBlock( buf, tqstrlen(buf) ); + sprintf( buf, "static char %s_bits[] = {\n ", s.ascii() ); + d->writeBlock( buf, tqstrlen(buf) ); + + iio->setStatus( 0 ); + + if ( image.depth() != 1 ) + image = image.convertDepth( 1 ); // dither + if ( image.bitOrder() != TQImage::LittleEndian ) + image = image.convertBitOrder( TQImage::LittleEndian ); + + bool invert = tqGray(image.color(0)) < tqGray(image.color(1)); + char hexrep[16]; + for ( i=0; i<10; i++ ) + hexrep[i] = '0' + i; + for ( i=10; i<16; i++ ) + hexrep[i] = 'a' -10 + i; + if ( invert ) { + char t; + for ( i=0; i<8; i++ ) { + t = hexrep[15-i]; + hexrep[15-i] = hexrep[i]; + hexrep[i] = t; + } + } + int bcnt = 0; + char *p = buf; + int bpl = (w+7)/8; + for (int y = 0; y < h; ++y) { + uchar *b = image.scanLine(y); + for (i = 0; i < bpl; ++i) { + *p++ = '0'; *p++ = 'x'; + *p++ = hexrep[*b >> 4]; + *p++ = hexrep[*b++ & 0xf]; + + if ( i < bpl - 1 || y < h - 1 ) { + *p++ = ','; + if ( ++bcnt > 14 ) { + *p++ = '\n'; + *p++ = ' '; + *p = '\0'; + if ( (int)tqstrlen(buf) != d->writeBlock( buf, tqstrlen(buf) ) ) { + iio->setStatus( 1 ); + delete [] buf; + return; + } + p = buf; + bcnt = 0; + } + } + } + } + strcpy( p, " };\n" ); + if ( (int)tqstrlen(buf) != d->writeBlock( buf, tqstrlen(buf) ) ) + iio->setStatus( 1 ); + delete [] buf; +} + +#endif // TQT_NO_IMAGEIO_XBM + + +#ifndef TQT_NO_IMAGEIO_XPM + +/***************************************************************************** + XPM image read/write functions + *****************************************************************************/ + + +// Skip until ", read until the next ", return the rest in *buf +// Returns FALSE on error, TRUE on success + +static bool read_xpm_string( TQCString &buf, TQIODevice *d, + const char * const *source, int &index ) +{ + if ( source ) { + buf = source[index++]; + return TRUE; + } + + if ( buf.size() < 69 ) //# just an approximation + buf.resize( 123 ); + + buf[0] = '\0'; + int c; + int i; + while ( (c=d->getch()) != EOF && c != '"' ) { } + if ( c == EOF ) { + return FALSE; + } + i = 0; + while ( (c=d->getch()) != EOF && c != '"' ) { + if ( i == (int)buf.size() ) + buf.resize( i*2+42 ); + buf[i++] = c; + } + if ( c == EOF ) { + return FALSE; + } + + if ( i == (int)buf.size() ) // always use a 0 terminator + buf.resize( i+1 ); + buf[i] = '\0'; + return TRUE; +} + + + +static int nextColorSpec(const TQCString & buf) +{ + int i = buf.find(" c "); + if (i < 0) + i = buf.find(" g "); + if (i < 0) + i = buf.find(" g4 "); + if (i < 0) + i = buf.find(" m "); + if (i < 0) + i = buf.find(" s "); + return i; +} + +// +// INTERNAL +// +// Reads an .xpm from either the TQImageIO or from the TQString *. +// One of the two HAS to be 0, the other one is used. +// + +static void read_xpm_image_or_array( TQImageIO * iio, const char * const * source, + TQImage & image) +{ + TQCString buf; + TQIODevice *d = 0; + buf.resize( 200 ); + + int i, cpp, ncols, w, h, index = 0; + + if ( iio ) { + iio->setStatus( 1 ); + d = iio ? iio->ioDevice() : 0; + d->readLine( buf.data(), buf.size() ); // "/* XPM */" + TQRegExp r( TQString::fromLatin1("/\\*.XPM.\\*/") ); + if ( buf.find(r) == -1 ) + return; // bad magic + } else if ( !source ) { + return; + } + + if ( !read_xpm_string( buf, d, source, index ) ) + return; + + if ( sscanf( buf, "%d %d %d %d", &w, &h, &ncols, &cpp ) < 4 ) + return; // < 4 numbers parsed + + if ( cpp > 15 ) + return; + + if ( ncols > 256 ) { + image.create( w, h, 32 ); + } else { + image.create( w, h, 8, ncols ); + } + + if (image.isNull()) + return; + + TQMap colorMap; + int currentColor; + + for( currentColor=0; currentColor < ncols; ++currentColor ) { + if ( !read_xpm_string( buf, d, source, index ) ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage: XPM color specification missing"); +#endif + return; + } + TQString index; + index = buf.left( cpp ); + buf = buf.mid( cpp ).simplifyWhiteSpace().lower(); + buf.prepend( " " ); + i = nextColorSpec(buf); + if ( i < 0 ) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQImage: XPM color specification is missing: %s", buf.data()); +#endif + return; // no c/g/g4/m/s specification at all + } + buf = buf.mid( i+3 ); + // Strip any other colorspec + int end = nextColorSpec(buf); + if (end != -1) + buf.truncate(end); + buf = buf.stripWhiteSpace(); + if ( buf == "none" ) { + image.setAlphaBuffer( TRUE ); + int transparentColor = currentColor; + if ( image.depth() == 8 ) { + image.setColor( transparentColor, + TQT_RGB_MASK & tqRgb(198,198,198) ); + colorMap.insert( index, transparentColor ); + } else { + TQRgb rgb = TQT_RGB_MASK & tqRgb(198,198,198); + colorMap.insert( index, rgb ); + } + } else { + if ( ((buf.length()-1) % 3) && (buf[0] == '#') ) { + buf.truncate (((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick + } + TQColor c( buf.data() ); + if ( image.depth() == 8 ) { + image.setColor( currentColor, 0xff000000 | c.rgb() ); + colorMap.insert( index, currentColor ); + } else { + TQRgb rgb = 0xff000000 | c.rgb(); + colorMap.insert( index, rgb ); + } + } + } + + // Read pixels + for( int y=0; ysetImage( image ); + iio->setStatus( 0 ); // image ok + } +} + + +static void read_xpm_image( TQImageIO * iio ) +{ + TQImage i; + (void)read_xpm_image_or_array( iio, 0, i ); + return; +} + + +static const char* xpm_color_name( int cpp, int index ) +{ + static char returnable[5]; + static const char code[] = ".#abcdefghijklmnopqrstuvwxyzABCD" + "EFGHIJKLMNOPQRSTUVWXYZ0123456789"; + // cpp is limited to 4 and index is limited to 64^cpp + if ( cpp > 1 ) { + if ( cpp > 2 ) { + if ( cpp > 3 ) { + returnable[3] = code[index % 64]; + index /= 64; + } else + returnable[3] = '\0'; + returnable[2] = code[index % 64]; + index /= 64; + } else + returnable[2] = '\0'; + // the following 4 lines are a joke! + if ( index == 0 ) + index = 64*44+21; + else if ( index == 64*44+21 ) + index = 0; + returnable[1] = code[index % 64]; + index /= 64; + } else + returnable[1] = '\0'; + returnable[0] = code[index]; + + return returnable; +} + + +// write XPM image data +static void write_xpm_image( TQImageIO * iio ) +{ + if ( iio ) + iio->setStatus( 1 ); + else + return; + + // ### 8-bit case could be made faster + TQImage image; + if ( iio->image().depth() != 32 ) + image = iio->image().convertDepth( 32 ); + else + image = iio->image(); + + TQMap colorMap; + + int w = image.width(), h = image.height(), ncolors = 0; + int x, y; + + // build color table + for( y=0; y k; k *= 64 ) { + ++cpp; + // limit to 4 characters per pixel + // 64^4 colors is enough for a 4096x4096 image + if ( cpp > 4) + break; + } + + TQString line; + + // write header + TQTextStream s( iio->ioDevice() ); + s << "/* XPM */" << endl + << "static char *" << fbname(iio->fileName()) << "[]={" << endl + << "\"" << w << " " << h << " " << ncolors << " " << cpp << "\""; + + // write palette + TQMap::Iterator c = colorMap.begin(); + while ( c != colorMap.end() ) { + TQRgb color = c.key(); + if ( image.hasAlphaBuffer() && color == (color & TQT_RGB_MASK) ) + line.sprintf( "\"%s c None\"", + xpm_color_name(cpp, *c) ); + else + line.sprintf( "\"%s c #%02x%02x%02x\"", + xpm_color_name(cpp, *c), + tqRed(color), + tqGreen(color), + tqBlue(color) ); + ++c; + s << "," << endl << line; + } + + // write pixels, limit to 4 characters per pixel + line.truncate( cpp*w ); + for( y=0; y 1 ) { + line[cc++] = chars[1]; + if ( cpp > 2 ) { + line[cc++] = chars[2]; + if ( cpp > 3 ) { + line[cc++] = chars[3]; + } + } + } + } + s << "," << endl << "\"" << line << "\""; + } + s << "};" << endl; + + iio->setStatus( 0 ); +} + +#endif // TQT_NO_IMAGEIO_XPM + +/*! + Returns an image with depth \a d, using the \a palette_count + colors pointed to by \a palette. If \a d is 1 or 8, the returned + image will have its color table ordered the same as \a palette. + + If the image needs to be modified to fit in a lower-resolution + result (e.g. converting from 32-bit to 8-bit), use the \a + conversion_flags to specify how you'd prefer this to happen. + + Note: currently no closest-color search is made. If colors are + found that are not in the palette, the palette may not be used at + all. This result should not be considered valid because it may + change in future implementations. + + Currently inefficient for non-32-bit images. + + \sa TQt::ImageConversionFlags +*/ +#ifndef TQT_NO_IMAGE_TRUECOLOR +TQImage TQImage::convertDepthWithPalette( int d, TQRgb* palette, int palette_count, int conversion_flags ) const +{ + if ( depth() == 1 ) { + return convertDepth( 8, conversion_flags ) + .convertDepthWithPalette( d, palette, palette_count, conversion_flags ); + } else if ( depth() == 8 ) { + // ### this could be easily made more efficient + return convertDepth( 32, conversion_flags ) + .convertDepthWithPalette( d, palette, palette_count, conversion_flags ); + } else { + TQImage result; + convert_32_to_8( this, &result, + (conversion_flags&~TQt::DitherMode_Mask) | TQt::AvoidDither, + palette, palette_count ); + return result.convertDepth( d ); + } +} +#endif +static +bool +haveSamePalette(const TQImage& a, const TQImage& b) +{ + if (a.depth() != b.depth()) return FALSE; + if (a.numColors() != b.numColors()) return FALSE; + TQRgb* ca = a.colorTable(); + TQRgb* cb = b.colorTable(); + for (int i=a.numColors(); i--; ) { + if (*ca++ != *cb++) return FALSE; + } + return TRUE; +} + +/*! + \relates TQImage + + Copies a block of pixels from \a src to \a dst. The pixels + copied from source (src) are converted according to + \a conversion_flags if it is incompatible with the destination + (\a dst). + + \a sx, \a sy is the top-left pixel in \a src, \a dx, \a dy + is the top-left position in \a dst and \a sw, \a sh is the + size of the copied block. + + The copying is clipped if areas outside \a src or \a dst are + specified. + + If \a sw is -1, it is adjusted to src->width(). Similarly, if \a + sh is -1, it is adjusted to src->height(). + + Currently inefficient for non 32-bit images. +*/ +void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src, + int sx, int sy, int sw, int sh, int conversion_flags ) +{ + // Parameter correction + if ( sw < 0 ) sw = src->width(); + if ( sh < 0 ) sh = src->height(); + if ( sx < 0 ) { dx -= sx; sw += sx; sx = 0; } + if ( sy < 0 ) { dy -= sy; sh += sy; sy = 0; } + if ( dx < 0 ) { sx -= dx; sw += dx; dx = 0; } + if ( dy < 0 ) { sy -= dy; sh += dy; dy = 0; } + if ( sx + sw > src->width() ) sw = src->width() - sx; + if ( sy + sh > src->height() ) sh = src->height() - sy; + if ( dx + sw > dst->width() ) sw = dst->width() - dx; + if ( dy + sh > dst->height() ) sh = dst->height() - dy; + if ( sw <= 0 || sh <= 0 ) return; // Nothing left to copy + if ( (dst->data == src->data) && dx==sx && dy==sy ) return; // Same pixels + + // "Easy" to copy if both same depth and one of: + // - 32 bit + // - 8 bit, identical palette + // - 1 bit, identical palette and byte-aligned area + // + if ( haveSamePalette(*dst,*src) + && ( (dst->depth() != 1) || + (!( (dx&7) || (sx&7) || + (((sw&7) && (sx+sw < src->width())) || + (dx+sw < dst->width()) ) )) ) ) + { + // easy to copy + } else if ( dst->depth() != 32 ) { +#ifndef TQT_NO_IMAGE_TRUECOLOR + + TQImage dstconv = dst->convertDepth( 32 ); + bitBlt( &dstconv, dx, dy, src, sx, sy, sw, sh, + (conversion_flags&~TQt::DitherMode_Mask) | TQt::AvoidDither ); + *dst = dstconv.convertDepthWithPalette( dst->depth(), + dst->colorTable(), dst->numColors() ); +#endif + return; + } + + // Now assume palette can be ignored + + if ( dst->depth() != src->depth() ) { + if ( ((sw == src->width()) && (sh == src->height())) || (dst->depth()==32) ) { + TQImage srcconv = src->convertDepth( dst->depth(), conversion_flags ); + bitBlt( dst, dx, dy, &srcconv, sx, sy, sw, sh, conversion_flags ); + } else { + TQImage srcconv = src->copy( sx, sy, sw, sh ); // ie. bitBlt + bitBlt( dst, dx, dy, &srcconv, 0, 0, sw, sh, conversion_flags ); + } + return; + } + + // Now assume both are the same depth. + + // Now assume both are 32-bit or 8-bit with compatible palettes. + + // "Easy" + + switch ( dst->depth() ) { + case 1: + { + uchar* d = dst->scanLine(dy) + dx/8; + uchar* s = src->scanLine(sy) + sx/8; + const int bw = (sw+7)/8; + if ( bw < 64 ) { + // Trust ourselves + const int dd = dst->bytesPerLine() - bw; + const int ds = src->bytesPerLine() - bw; + while ( sh-- ) { + for ( int t=bw; t--; ) + *d++ = *s++; + d += dd; + s += ds; + } + } else { + // Trust libc + const int dd = dst->bytesPerLine(); + const int ds = src->bytesPerLine(); + while ( sh-- ) { + memcpy( d, s, bw ); + d += dd; + s += ds; + } + } + } + break; + case 8: + { + uchar* d = dst->scanLine(dy) + dx; + uchar* s = src->scanLine(sy) + sx; + if ( sw < 64 ) { + // Trust ourselves + const int dd = dst->bytesPerLine() - sw; + const int ds = src->bytesPerLine() - sw; + while ( sh-- ) { + for ( int t=sw; t--; ) + *d++ = *s++; + d += dd; + s += ds; + } + } else { + // Trust libc + const int dd = dst->bytesPerLine(); + const int ds = src->bytesPerLine(); + while ( sh-- ) { + memcpy( d, s, sw ); + d += dd; + s += ds; + } + } + } + break; +#ifndef TQT_NO_IMAGE_TRUECOLOR + case 32: + if ( src->hasAlphaBuffer() ) { + TQRgb* d = (TQRgb*)dst->scanLine(dy) + dx; + TQRgb* s = (TQRgb*)src->scanLine(sy) + sx; + const int dd = dst->width() - sw; + const int ds = src->width() - sw; + while ( sh-- ) { + for ( int t=sw; t--; ) { + unsigned char a = tqAlpha(*s); + if ( a == 255 ) + *d++ = *s++; + else if ( a == 0 ) + ++d,++s; // nothing + else { + unsigned char r = ((tqRed(*s)-tqRed(*d)) * a) / 256 + tqRed(*d); + unsigned char g = ((tqGreen(*s)-tqGreen(*d)) * a) / 256 + tqGreen(*d); + unsigned char b = ((tqBlue(*s)-tqBlue(*d)) * a) / 256 + tqBlue(*d); + a = TQMAX(tqAlpha(*d),a); // alternatives... + *d++ = tqRgba(r,g,b,a); + ++s; + } + } + d += dd; + s += ds; + } + } else { + TQRgb* d = (TQRgb*)dst->scanLine(dy) + dx; + TQRgb* s = (TQRgb*)src->scanLine(sy) + sx; + if ( sw < 64 ) { + // Trust ourselves + const int dd = dst->width() - sw; + const int ds = src->width() - sw; + while ( sh-- ) { + for ( int t=sw; t--; ) + *d++ = *s++; + d += dd; + s += ds; + } + } else { + // Trust libc + const int dd = dst->width(); + const int ds = src->width(); + const int b = sw*sizeof(TQRgb); + while ( sh-- ) { + memcpy( d, s, b ); + d += dd; + s += ds; + } + } + } + break; +#endif // TQT_NO_IMAGE_TRUECOLOR + } +} + + +/*! + Returns TRUE if this image and image \a i have the same contents; + otherwise returns FALSE. The comparison can be slow, unless there + is some obvious difference, such as different widths, in which + case the function will return quickly. + + \sa operator=() +*/ + +bool TQImage::operator==( const TQImage & i ) const +{ + // same object, or shared? + if ( i.data == data ) + return TRUE; + // obviously different stuff? + if ( i.data->h != data->h || + i.data->w != data->w ) + return FALSE; + // not equal if one has alphabuffer and the other does not + if ( i.hasAlphaBuffer() != hasAlphaBuffer() ) + return FALSE; + // that was the fast bit... + TQImage i1 = convertDepth( 32 ); + TQImage i2 = i.convertDepth( 32 ); + int l; + // if no alpha buffer used, there might still be junk in the + // alpha bits; thus, we can't do memcmp-style comparison of scanlines + if ( !hasAlphaBuffer() ) { + int m; + TQRgb *i1line; + TQRgb *i2line; + for( l=0; l < data->h; l++ ) { + i1line = (uint *)i1.scanLine( l ); + i2line = (uint *)i2.scanLine( l ); + // compare pixels of scanline individually + for ( m=0; m < data->w; m++ ) + if ( (i1line[m] ^ i2line[m]) & 0x00FFFFFF ) + return FALSE; + } + } else { + // yay, we can do fast binary comparison on entire scanlines + for( l=0; l < data->h; l++ ) + if ( memcmp( i1.scanLine( l ), i2.scanLine( l ), 4*data->w ) ) + return FALSE; + } + return TRUE; +} + + +/*! + Returns TRUE if this image and image \a i have different contents; + otherwise returns FALSE. The comparison can be slow, unless there + is some obvious difference, such as different widths, in which + case the function will return quickly. + + \sa operator=() +*/ + +bool TQImage::operator!=( const TQImage & i ) const +{ + return !(*this == i); +} + + + + +/*! + \fn int TQImage::dotsPerMeterX() const + + Returns the number of pixels that fit horizontally in a physical + meter. This and dotsPerMeterY() define the intended scale and + aspect ratio of the image. + + \sa setDotsPerMeterX() +*/ + +/*! + \fn int TQImage::dotsPerMeterY() const + + Returns the number of pixels that fit vertically in a physical + meter. This and dotsPerMeterX() define the intended scale and + aspect ratio of the image. + + \sa setDotsPerMeterY() +*/ + +/*! + Sets the value returned by dotsPerMeterX() to \a x. +*/ +void TQImage::setDotsPerMeterX(int x) +{ + data->dpmx = x; +} + +/*! + Sets the value returned by dotsPerMeterY() to \a y. +*/ +void TQImage::setDotsPerMeterY(int y) +{ + data->dpmy = y; +} + +/*! + \fn TQPoint TQImage::offset() const + + Returns the number of pixels by which the image is intended to be + offset by when positioning relative to other images. +*/ + +/*! + Sets the value returned by offset() to \a p. +*/ +void TQImage::setOffset(const TQPoint& p) +{ + data->offset = p; +} +#ifndef TQT_NO_IMAGE_TEXT +/*! + \internal + + Returns the internal TQImageDataMisc object. This object will be + created if it doesn't already exist. +*/ +TQImageDataMisc& TQImage::misc() const +{ + if ( !data->misc ) + data->misc = new TQImageDataMisc; + return *data->misc; +} + +/*! + Returns the string recorded for the keyword \a key in language \a + lang, or in a default language if \a lang is 0. +*/ +TQString TQImage::text(const char* key, const char* lang) const +{ + TQImageTextKeyLang x(key,lang); + return misc().text_lang[x]; +} + +/*! + \overload + + Returns the string recorded for the keyword and language \a kl. +*/ +TQString TQImage::text(const TQImageTextKeyLang& kl) const +{ + return misc().text_lang[kl]; +} + +/*! + Returns the language identifiers for which some texts are + recorded. + + Note that if you want to iterate over the list, you should iterate + over a copy, e.g. + \code + TQStringList list = myImage.textLanguages(); + TQStringList::Iterator it = list.begin(); + while( it != list.end() ) { + myProcessing( *it ); + ++it; + } + \endcode + + \sa textList() text() setText() textKeys() +*/ +TQStringList TQImage::textLanguages() const +{ + if ( !data->misc ) + return TQStringList(); + return misc().languages(); +} + +/*! + Returns the keywords for which some texts are recorded. + + Note that if you want to iterate over the list, you should iterate + over a copy, e.g. + \code + TQStringList list = myImage.textKeys(); + TQStringList::Iterator it = list.begin(); + while( it != list.end() ) { + myProcessing( *it ); + ++it; + } + \endcode + + \sa textList() text() setText() textLanguages() +*/ +TQStringList TQImage::textKeys() const +{ + if ( !data->misc ) + return TQStringList(); + return misc().keys(); +} + +/*! + Returns a list of TQImageTextKeyLang objects that enumerate all the + texts key/language pairs set by setText() for this image. + + Note that if you want to iterate over the list, you should iterate + over a copy, e.g. + \code + TQValueList list = myImage.textList(); + TQValueList::Iterator it = list.begin(); + while( it != list.end() ) { + myProcessing( *it ); + ++it; + } + \endcode +*/ +TQValueList TQImage::textList() const +{ + if ( !data->misc ) + return TQValueList(); + return misc().list(); +} + +/*! + Records string \a s for the keyword \a key. The \a key should be a + portable keyword recognizable by other software - some suggested + values can be found in \link + http://www.libpng.org/pub/png/spec/1.2/png-1.2-pdg.html#C.Anc-text + the PNG specification \endlink. \a s can be any text. \a lang + should specify the language code (see + \link http://www.rfc-editor.org/rfc/rfc1766.txt RFC 1766 \endlink) or 0. +*/ +void TQImage::setText(const char* key, const char* lang, const TQString& s) +{ + TQImageTextKeyLang x(key,lang); + misc().text_lang.replace(x,s); +} + +#endif // TQT_NO_IMAGE_TEXT + +#ifdef TQ_WS_QWS +/*! + \internal +*/ +TQGfx * TQImage::graphicsContext() +{ + TQGfx * ret=0; + if(depth()) { + int w = qt_screen->mapToDevice( TQSize(width(),height()) ).width(); + int h = qt_screen->mapToDevice( TQSize(width(),height()) ).height(); + ret=TQGfx::createGfx(depth(),bits(),w,h,bytesPerLine()); + } else { + tqDebug("Trying to create image for null depth"); + return 0; + } + if(depth()<=8) { + TQRgb * tmp=colorTable(); + int nc=numColors(); + if(tmp==0) { + static TQRgb table[2] = { tqRgb(255,255,255), tqRgb(0,0,0) }; + tmp=table; + nc=2; + } + ret->setClut(tmp,nc); + } + return ret; +} + +#endif diff --git a/src/kernel/tqimage.h b/src/kernel/tqimage.h new file mode 100644 index 000000000..32f20b23f --- /dev/null +++ b/src/kernel/tqimage.h @@ -0,0 +1,425 @@ +/**************************************************************************** +** +** Definition of TQImage and TQImageIO classes +** +** Created : 950207 +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQIMAGE_H +#define TQIMAGE_H + +#ifndef QT_H +#include "ntqpixmap.h" +#include "ntqstrlist.h" +#include "ntqstringlist.h" +#endif // QT_H + +class TQImageDataMisc; // internal +#ifndef TQT_NO_IMAGE_TEXT +class TQ_EXPORT TQImageTextKeyLang { +public: + TQImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } + TQImageTextKeyLang() { } + + TQCString key; + TQCString lang; + + bool operator< (const TQImageTextKeyLang& other) const + { return (key < other.key) || ((key==other.key) && (lang < other.lang)); } + bool operator== (const TQImageTextKeyLang& other) const + { return (key==other.key) && (lang==other.lang); } +}; +#endif //TQT_NO_IMAGE_TEXT + + +class TQ_EXPORT TQImage +{ +public: + enum Endian { IgnoreEndian, BigEndian, LittleEndian }; + + TQImage(); + TQImage( int width, int height, int depth, int numColors=0, + Endian bitOrder=IgnoreEndian ); + TQImage( const TQSize&, int depth, int numColors=0, + Endian bitOrder=IgnoreEndian ); +#ifndef TQT_NO_IMAGEIO + TQImage( const TQString &fileName, const char* format=0 ); + TQImage( const char * const xpm[] ); + TQImage( const TQByteArray &data ); +#endif + TQImage( uchar* data, int w, int h, int depth, + TQRgb* colortable, int numColors, + Endian bitOrder ); +#ifdef TQ_WS_QWS + TQImage( uchar* data, int w, int h, int depth, int pbl, + TQRgb* colortable, int numColors, + Endian bitOrder ); +#endif + TQImage( const TQImage & ); + ~TQImage(); + + TQImage &operator=( const TQImage & ); + TQImage &operator=( const TQPixmap & ); + bool operator==( const TQImage & ) const; + bool operator!=( const TQImage & ) const; + void detach(); + TQImage copy() const; + TQImage copy(int x, int y, int w, int h, int conversion_flags=0) const; + TQImage copy(const TQRect&) const; +#ifndef TQT_NO_MIME + static TQImage fromMimeSource( const TQString& abs_name ); +#endif + bool isNull() const { return data->bits == 0; } + + int width() const { return data->w; } + int height() const { return data->h; } + TQSize size() const { return TQSize(data->w,data->h); } + TQRect rect() const { return TQRect(0,0,data->w,data->h); } + int depth() const { return data->d; } + int numColors() const { return data->ncols; } + Endian bitOrder() const { return (Endian) data->bitordr; } + + TQRgb color( int i ) const; + void setColor( int i, TQRgb c ); + void setNumColors( int ); + + bool hasAlphaBuffer() const; + void setAlphaBuffer( bool ); + + bool allGray() const; + bool isGrayscale() const; + + uchar *bits() const; + uchar *scanLine( int ) const; + uchar **jumpTable() const; + TQRgb *colorTable() const; + int numBytes() const; + int bytesPerLine() const; + +#ifdef TQ_WS_QWS + TQGfx * graphicsContext(); +#endif + + bool create( int width, int height, int depth, int numColors=0, + Endian bitOrder=IgnoreEndian ); + bool create( const TQSize&, int depth, int numColors=0, + Endian bitOrder=IgnoreEndian ); + void reset(); + + void fill( uint pixel ); + void invertPixels( bool invertAlpha = TRUE ); + + TQImage convertDepth( int ) const; +#ifndef TQT_NO_IMAGE_TRUECOLOR + TQImage convertDepthWithPalette( int, TQRgb* p, int pc, int cf=0 ) const; +#endif + TQImage convertDepth( int, int conversion_flags ) const; + TQImage convertBitOrder( Endian ) const; + + enum ScaleMode { + ScaleFree, + ScaleMin, + ScaleMax + }; +#ifndef TQT_NO_IMAGE_SMOOTHSCALE + TQImage smoothScale( int w, int h, ScaleMode mode=ScaleFree ) const; + TQImage smoothScale( const TQSize& s, ScaleMode mode=ScaleFree ) const; +#endif +#ifndef TQT_NO_IMAGE_TRANSFORMATION + TQImage scale( int w, int h, ScaleMode mode=ScaleFree ) const; + TQImage scale( const TQSize& s, ScaleMode mode=ScaleFree ) const; + TQImage scaleWidth( int w ) const; + TQImage scaleHeight( int h ) const; + TQImage xForm( const TQWMatrix &matrix ) const; +#endif + +#ifndef TQT_NO_IMAGE_DITHER_TO_1 + TQImage createAlphaMask( int conversion_flags=0 ) const; +#endif +#ifndef TQT_NO_IMAGE_HEURISTIC_MASK + TQImage createHeuristicMask( bool clipTight=TRUE ) const; +#endif +#ifndef TQT_NO_IMAGE_MIRROR + TQImage mirror() const; + TQImage mirror(bool horizontally, bool vertically) const; +#endif + TQImage swapRGB() const; + + static Endian systemBitOrder(); + static Endian systemByteOrder(); + +#ifndef TQT_NO_IMAGEIO + static const char* imageFormat( const TQString &fileName ); + static TQStrList inputFormats(); + static TQStrList outputFormats(); +#ifndef TQT_NO_STRINGLIST + static TQStringList inputFormatList(); + static TQStringList outputFormatList(); +#endif + bool load( const TQString &fileName, const char* format=0 ); + bool loadFromData( const uchar *buf, uint len, + const char *format=0 ); + bool loadFromData( TQByteArray data, const char* format=0 ); + bool save( const TQString &fileName, const char* format, + int quality=-1 ) const; + bool save( TQIODevice * device, const char* format, + int quality=-1 ) const; +#endif //TQT_NO_IMAGEIO + + bool valid( int x, int y ) const; + int pixelIndex( int x, int y ) const; + TQRgb pixel( int x, int y ) const; + void setPixel( int x, int y, uint index_or_rgb ); + + // Auxiliary data + int dotsPerMeterX() const; + int dotsPerMeterY() const; + void setDotsPerMeterX(int); + void setDotsPerMeterY(int); + TQPoint offset() const; + void setOffset(const TQPoint&); +#ifndef TQT_NO_IMAGE_TEXT + TQValueList textList() const; + TQStringList textLanguages() const; + TQStringList textKeys() const; + TQString text(const char* key, const char* lang=0) const; + TQString text(const TQImageTextKeyLang&) const; + void setText(const char* key, const char* lang, const TQString&); +#endif +private: + void init(); + void reinit(); + void freeBits(); + static void warningIndexRange( const char *, int ); + + struct TQImageData : public TQShared { // internal image data + int w; // image width + int h; // image height + int d; // image depth + int ncols; // number of colors + int nbytes; // number of bytes data + int bitordr; // bit order (1 bit depth) + TQRgb *ctbl; // color table + uchar **bits; // image data + bool alpha; // alpha buffer + int dpmx; // dots per meter X (or 0) + int dpmy; // dots per meter Y (or 0) + TQPoint offset; // offset in pixels +#ifndef TQT_NO_IMAGE_TEXT + TQImageDataMisc* misc; // less common stuff +#endif + bool ctbl_mine; // this allocated ctbl + } *data; +#ifndef TQT_NO_IMAGE_TEXT + TQImageDataMisc& misc() const; +#endif +#ifndef TQT_NO_IMAGEIO + bool doImageIO( TQImageIO* io, int quality ) const; +#endif + friend TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, + const TQImage* src, int sx, int sy, + int sw, int sh, int conversion_flags ); +}; + + +// TQImage stream functions + +#if !defined(TQT_NO_DATASTREAM) && !defined(TQT_NO_IMAGEIO) +TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQImage & ); +TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQImage & ); +#endif + +#ifndef TQT_NO_IMAGEIO +class TQIODevice; +typedef void (*image_io_handler)( TQImageIO * ); // image IO handler + + +struct TQImageIOData; + + +class TQ_EXPORT TQImageIO +{ +public: + TQImageIO(); + TQImageIO( TQIODevice *ioDevice, const char *format ); + TQImageIO( const TQString &fileName, const char* format ); + ~TQImageIO(); + + + const TQImage &image() const { return im; } + int status() const { return iostat; } + const char *format() const { return frmt; } + TQIODevice *ioDevice() const { return iodev; } + TQString fileName() const { return fname; } + int quality() const; + TQString description() const { return descr; } + const char *parameters() const; + float gamma() const; + + void setImage( const TQImage & ); + void setStatus( int ); + void setFormat( const char * ); + void setIODevice( TQIODevice * ); + void setFileName( const TQString & ); + void setQuality( int ); + void setDescription( const TQString & ); + void setParameters( const char * ); + void setGamma( float ); + + bool read(); + bool write(); + + static const char* imageFormat( const TQString &fileName ); + static const char *imageFormat( TQIODevice * ); + static TQStrList inputFormats(); + static TQStrList outputFormats(); + + static void defineIOHandler( const char *format, + const char *header, + const char *flags, + image_io_handler read_image, + image_io_handler write_image ); + +private: + void init(); + + TQImage im; // image + int iostat; // IO status + TQCString frmt; // image format + TQIODevice *iodev; // IO device + TQString fname; // file name + char *params; // image parameters //### change to TQImageIOData *d in 3.0 + TQString descr; // image description + TQImageIOData *d; + +private: // Disabled copy constructor and operator= +#if defined(TQ_DISABLE_COPY) + TQImageIO( const TQImageIO & ); + TQImageIO &operator=( const TQImageIO & ); +#endif +}; + +#endif //TQT_NO_IMAGEIO + +TQ_EXPORT void bitBlt( TQImage* dst, int dx, int dy, const TQImage* src, + int sx=0, int sy=0, int sw=-1, int sh=-1, + int conversion_flags=0 ); + + +/***************************************************************************** + TQImage member functions + *****************************************************************************/ + +inline bool TQImage::hasAlphaBuffer() const +{ + return data->alpha; +} + +inline uchar *TQImage::bits() const +{ + return data->bits ? data->bits[0] : 0; +} + +inline uchar **TQImage::jumpTable() const +{ + return data->bits; +} + +inline TQRgb *TQImage::colorTable() const +{ + return data->ctbl; +} + +inline int TQImage::numBytes() const +{ + return data->nbytes; +} + +inline int TQImage::bytesPerLine() const +{ + return data->h ? data->nbytes/data->h : 0; +} + +inline TQImage TQImage::copy(const TQRect& r) const +{ + return copy(r.x(), r.y(), r.width(), r.height()); +} + +inline TQRgb TQImage::color( int i ) const +{ +#if defined(QT_CHECK_RANGE) + if ( i >= data->ncols ) + warningIndexRange( "color", i ); +#endif + return data->ctbl ? data->ctbl[i] : (TQRgb)-1; +} + +inline void TQImage::setColor( int i, TQRgb c ) +{ +#if defined(QT_CHECK_RANGE) + if ( i >= data->ncols ) + warningIndexRange( "setColor", i ); +#endif + if ( data->ctbl ) + data->ctbl[i] = c; +} + +inline uchar *TQImage::scanLine( int i ) const +{ +#if defined(QT_CHECK_RANGE) + if ( i >= data->h ) + warningIndexRange( "scanLine", i ); +#endif + return data->bits ? data->bits[i] : 0; +} + +inline int TQImage::dotsPerMeterX() const +{ + return data->dpmx; +} + +inline int TQImage::dotsPerMeterY() const +{ + return data->dpmy; +} + +inline TQPoint TQImage::offset() const +{ + return data->offset; +} + + +#endif // TQIMAGE_H diff --git a/src/kernel/tqimageformatinterface_p.h b/src/kernel/tqimageformatinterface_p.h new file mode 100644 index 000000000..8abe49c2d --- /dev/null +++ b/src/kernel/tqimageformatinterface_p.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQIMAGEFORMATINTERFACE_P_H +#define TQIMAGEFORMATINTERFACE_P_H + +#ifndef QT_H +#include +#endif // QT_H + +#if __GNUC__ - 0 > 3 +#pragma GCC system_header +#endif + +// +// W A R N I N G +// ------------- +// +// This file is not part of the TQt API. It exists for the convenience +// of internal files. This header file may change from version to version +// without notice, or even be removed. +// +// We mean it. +// +// + +#ifndef TQT_NO_COMPONENT + +// {04903F05-54B1-4726-A849-FB5CB097CA87} +#ifndef IID_QImageFormat +#define IID_QImageFormat TQUuid( 0x04903f05, 0x54b1, 0x4726, 0xa8, 0x49, 0xfb, 0x5c, 0xb0, 0x97, 0xca, 0x87 ) +#endif + +class TQImage; + +struct TQ_EXPORT TQImageFormatInterface : public TQFeatureListInterface +{ + virtual TQRESULT loadImage( const TQString &format, const TQString &filename, TQImage * ) = 0; + virtual TQRESULT saveImage( const TQString &format, const TQString &filename, const TQImage & ) = 0; + + virtual TQRESULT installIOHandler( const TQString & ) = 0; +}; + +#endif // TQT_NO_COMPONENT + +#endif // TQIMAGEFORMATINTERFACE_P_H diff --git a/src/kernel/tqimageformatplugin.cpp b/src/kernel/tqimageformatplugin.cpp new file mode 100644 index 000000000..ad9057d2c --- /dev/null +++ b/src/kernel/tqimageformatplugin.cpp @@ -0,0 +1,184 @@ +/**************************************************************************** +** +** ... +** +** Copyright (C) 2001-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#include "tqimageformatplugin.h" +#ifndef TQT_NO_IMAGEFORMATPLUGIN +#include "tqimageformatinterface_p.h" +#include "tqimage.h" + +/*! + \class TQImageFormatPlugin tqimageformatplugin.h + \brief The TQImageFormatPlugin class provides an abstract base for custom image format plugins. + + \ingroup plugins + + The image format plugin is a simple plugin interface that makes + it easy to create custom image formats that can be used + transparently by applications. + + Writing an image format plugin is achieved by subclassing this + base class, reimplementing the pure virtual functions keys() and + installIOHandler(), and exporting the class with the + TQ_EXPORT_PLUGIN macro. See the \link plugins-howto.html Plugins + documentation\endlink for details. +*/ + +/*! + \fn TQStringList TQImageFormatPlugin::keys() const + + Returns the list of image formats this plugin supports. + + \sa installIOHandler() +*/ + + +/*! + \fn bool TQImageFormatPlugin::installIOHandler( const TQString &format ) + + Installs a TQImageIO image I/O handler for the image format \a + format. + + \sa keys() +*/ + +class TQImageFormatPluginPrivate : public TQImageFormatInterface +{ +public: + TQImageFormatPluginPrivate( TQImageFormatPlugin *p ) + : plugin( p ) + { + } + virtual ~TQImageFormatPluginPrivate(); + + TQRESULT queryInterface( const TQUuid &iid, TQUnknownInterface **iface ); + TQ_REFCOUNT; + + TQStringList featureList() const; + + TQRESULT loadImage( const TQString &format, const TQString &filename, TQImage * ); + TQRESULT saveImage( const TQString &format, const TQString &filename, const TQImage & ); + + TQRESULT installIOHandler( const TQString & ); + +private: + TQImageFormatPlugin *plugin; +}; + +TQImageFormatPluginPrivate::~TQImageFormatPluginPrivate() +{ + delete plugin; +} + +TQRESULT TQImageFormatPluginPrivate::queryInterface( const TQUuid &iid, TQUnknownInterface **iface ) +{ + *iface = 0; + + if ( iid == IID_QUnknown ) + *iface = this; + else if ( iid == IID_QFeatureList ) + *iface = this; + else if ( iid == IID_QImageFormat ) + *iface = this; + else + return TQE_NOINTERFACE; + + (*iface)->addRef(); + return TQS_OK; +} + +TQStringList TQImageFormatPluginPrivate::featureList() const +{ + return plugin->keys(); +} + +TQRESULT TQImageFormatPluginPrivate::loadImage( const TQString &format, const TQString &filename, TQImage *image ) +{ + return plugin->loadImage( format, filename, image ) ? TQS_FALSE : TQS_OK; +} + +TQRESULT TQImageFormatPluginPrivate::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) +{ + return plugin->saveImage( format, filename, image ) ? TQS_FALSE : TQS_OK; +} + +TQRESULT TQImageFormatPluginPrivate::installIOHandler( const TQString &format ) +{ + return plugin->installIOHandler( format ) ? TQS_FALSE : TQS_OK; +} + +/*! + Constructs an image format plugin. This is invoked automatically + by the TQ_EXPORT_PLUGIN macro. +*/ +TQImageFormatPlugin::TQImageFormatPlugin() + : TQGPlugin( d = new TQImageFormatPluginPrivate( this ) ) +{ +} + +/*! + Destroys the image format plugin. + + You never have to call this explicitly. TQt destroys a plugin + automatically when it is no longer used. +*/ +TQImageFormatPlugin::~TQImageFormatPlugin() +{ +} + + +/*!\internal + */ +bool TQImageFormatPlugin::loadImage( const TQString &format, const TQString &filename, TQImage *image ) +{ + Q_UNUSED( format ) + Q_UNUSED( filename ) + Q_UNUSED( image ) + return FALSE; +} + +/*! \internal + */ +bool TQImageFormatPlugin::saveImage( const TQString &format, const TQString &filename, const TQImage &image ) +{ + Q_UNUSED( format ) + Q_UNUSED( filename ) + Q_UNUSED( image ) + return FALSE; +} + +#endif // TQT_NO_IMAGEFORMATPLUGIN diff --git a/src/kernel/tqimageformatplugin.h b/src/kernel/tqimageformatplugin.h new file mode 100644 index 000000000..237817e9f --- /dev/null +++ b/src/kernel/tqimageformatplugin.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Definition of ??? +** +** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved. +** +** This file is part of the kernel module of the TQt GUI Toolkit. +** +** This file may be used under the terms of the GNU General +** Public License versions 2.0 or 3.0 as published by the Free +** Software Foundation and appearing in the files LICENSE.GPL2 +** and LICENSE.GPL3 included in the packaging of this file. +** Alternatively you may (at your option) use any later version +** of the GNU General Public License if such license has been +** publicly approved by Trolltech ASA (or its successors, if any) +** and the KDE Free TQt Foundation. +** +** Please review the following information to ensure GNU General +** Public Licensing requirements will be met: +** http://trolltech.com/products/qt/licenses/licensing/opensource/. +** If you are unsure which license is appropriate for your use, please +** review the following information: +** http://trolltech.com/products/qt/licenses/licensing/licensingoverview +** or contact the sales department at sales@trolltech.com. +** +** This file may be used under the terms of the Q Public License as +** defined by Trolltech ASA and appearing in the file LICENSE.TQPL +** included in the packaging of this file. Licensees holding valid TQt +** Commercial 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 WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted +** herein. +** +**********************************************************************/ + +#ifndef TQIMAGEFORMATPLUGIN_H +#define TQIMAGEFORMATPLUGIN_H + +#ifndef QT_H +#include "ntqgplugin.h" +#include "ntqstringlist.h" +#endif // QT_H + +#ifndef TQT_NO_IMAGEFORMATPLUGIN +class TQImageFormat; +class TQImageFormatPluginPrivate; + +class TQ_EXPORT TQImageFormatPlugin : public TQGPlugin +{ + TQ_OBJECT +public: + TQImageFormatPlugin(); + ~TQImageFormatPlugin(); + + virtual TQStringList keys() const = 0; + virtual bool loadImage( const TQString &format, const TQString &filename, TQImage *image ); + virtual bool saveImage( const TQString &format, const TQString &filename, const TQImage &image ); + virtual bool installIOHandler( const TQString &format ) = 0; + +private: + TQImageFormatPluginPrivate *d; +}; +#endif // TQT_NO_IMAGEFORMATPLUGIN +#endif // TQIMAGEFORMATPLUGIN_H diff --git a/src/kernel/tqwidget_x11.cpp b/src/kernel/tqwidget_x11.cpp index 88bed113c..8329bf7a8 100644 --- a/src/kernel/tqwidget_x11.cpp +++ b/src/kernel/tqwidget_x11.cpp @@ -44,7 +44,7 @@ #include "ntqpaintdevicemetrics.h" #include "ntqpainter.h" #include "ntqbitmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "tqobjectlist.h" #include "ntqlayout.h" #include "ntqtextcodec.h" diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 6882259d8..0436c01c2 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -41,7 +41,7 @@ #include "ntqgl.h" #include "ntqpixmap.h" #include "ntqpaintdevicemetrics.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqcleanuphandler.h" #include "tqptrdict.h" diff --git a/src/qt.pro b/src/qt.pro index 8e6298fb1..e66adeef5 100644 --- a/src/qt.pro +++ b/src/qt.pro @@ -180,14 +180,14 @@ wince-* { message( ...removing plugin stuff... (not permanent) ) HEADERS -= $$TOOLS_CPP/qcomlibrary.h \ $$KERNEL_CPP/ntqgplugin.h \ - $$KERNEL_CPP/ntqimageformatplugin.h \ + $$KERNEL_CPP/tqimageformatplugin.h \ $$STYLES_CPP/ntqstyleplugin.h \ $$CODECS_CPP/ntqtextcodecplugin.h \ $$WIDGETS_CPP/tqwidgetplugin.h SOURCES -= $$TOOLS_CPP/qcomlibrary.cpp \ $$KERNEL_CPP/qgplugin.cpp \ - $$KERNEL_CPP/qimageformatplugin.cpp \ + $$KERNEL_CPP/tqimageformatplugin.cpp \ $$STYLES_CPP/qstyleplugin.cpp \ $$CODECS_CPP/qtextcodecplugin.cpp \ $$WIDGETS_CPP/tqwidgetplugin.cpp diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index 36d85aafc..a611426e2 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -60,7 +60,7 @@ #include "ntqdockwindow.h" #include "ntqdockarea.h" #include "ntqprogressbar.h" -#include "ntqimage.h" +#include "tqimage.h" #include diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp index b8f3a5410..b979e9a0b 100644 --- a/src/styles/qwindowsstyle.cpp +++ b/src/styles/qwindowsstyle.cpp @@ -49,7 +49,7 @@ #include "ntqpixmap.h" // for now #include "tqwidget.h" #include "ntqlabel.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpushbutton.h" #include "ntqcombobox.h" #include "ntqlistbox.h" diff --git a/src/tools/qfeatures.txt b/src/tools/qfeatures.txt index 6a9b92bf3..f528e8e74 100644 --- a/src/tools/qfeatures.txt +++ b/src/tools/qfeatures.txt @@ -1283,7 +1283,7 @@ SeeAlso: ??? Feature: IMAGEFORMATPLUGIN Section: Images Requires: COMPONENT IMAGEIO -Name: QImageFormatPlugin +Name: TQImageFormatPlugin SeeAlso: ??? diff --git a/src/widgets/qeffects.cpp b/src/widgets/qeffects.cpp index d40cdb868..07dee3f56 100644 --- a/src/widgets/qeffects.cpp +++ b/src/widgets/qeffects.cpp @@ -43,7 +43,7 @@ #include "tqwidget.h" #include "qeffects_p.h" #include "ntqpixmap.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqtimer.h" #include "ntqdatetime.h" #include "ntqguardedptr.h" diff --git a/src/widgets/qiconview.cpp b/src/widgets/qiconview.cpp index 82ee76060..049338708 100644 --- a/src/widgets/qiconview.cpp +++ b/src/widgets/qiconview.cpp @@ -53,7 +53,7 @@ #include "ntqevent.h" #include "ntqpalette.h" #include "ntqmime.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpen.h" #include "ntqbrush.h" #include "ntqtimer.h" diff --git a/src/widgets/qlabel.cpp b/src/widgets/qlabel.cpp index a9b485af8..d376b1fff 100644 --- a/src/widgets/qlabel.cpp +++ b/src/widgets/qlabel.cpp @@ -44,7 +44,7 @@ #include "ntqdrawutil.h" #include "ntqaccel.h" #include "ntqmovie.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqbitmap.h" #include "ntqpicture.h" #include "ntqapplication.h" diff --git a/src/widgets/qtextbrowser.cpp b/src/widgets/qtextbrowser.cpp index c9baa8144..23b2452f6 100644 --- a/src/widgets/qtextbrowser.cpp +++ b/src/widgets/qtextbrowser.cpp @@ -53,7 +53,7 @@ #include "ntqlayout.h" #include "ntqbitmap.h" #include "ntqtimer.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqsimplerichtext.h" #include "ntqdragobject.h" #include "ntqurl.h" diff --git a/src/widgets/qtitlebar.cpp b/src/widgets/qtitlebar.cpp index 97b2288e5..0879c3226 100644 --- a/src/widgets/qtitlebar.cpp +++ b/src/widgets/qtitlebar.cpp @@ -50,7 +50,7 @@ #include "ntqdatetime.h" #include "private/qapplication_p.h" #include "ntqtooltip.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqtimer.h" #include "ntqpainter.h" #include "ntqstyle.h" diff --git a/src/widgets/qtoolbutton.cpp b/src/widgets/qtoolbutton.cpp index b2a4443bf..c2cdaa93f 100644 --- a/src/widgets/qtoolbutton.cpp +++ b/src/widgets/qtoolbutton.cpp @@ -50,7 +50,7 @@ #include "ntqmainwindow.h" #include "ntqtooltip.h" #include "ntqtoolbar.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqiconset.h" #include "ntqtimer.h" #include "ntqpopupmenu.h" diff --git a/src/workspace/qworkspace.cpp b/src/workspace/qworkspace.cpp index 4479c0d8a..4e1ae7f01 100644 --- a/src/workspace/qworkspace.cpp +++ b/src/workspace/qworkspace.cpp @@ -58,7 +58,7 @@ #include "ntqdatetime.h" #include "ntqtooltip.h" #include "ntqwmatrix.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqscrollbar.h" #include "ntqstyle.h" #include "ntqbitmap.h" diff --git a/src/xml/qsvgdevice.cpp b/src/xml/qsvgdevice.cpp index ceeb8b6e6..d2895838f 100644 --- a/src/xml/qsvgdevice.cpp +++ b/src/xml/qsvgdevice.cpp @@ -47,7 +47,7 @@ #include "ntqregexp.h" #include "tqvaluelist.h" #include "ntqtextstream.h" -#include "ntqimage.h" +#include "tqimage.h" #include "ntqpixmap.h" #include diff --git a/tools/designer/designer/pixmapchooser.cpp b/tools/designer/designer/pixmapchooser.cpp index 037694e7d..ce63c4d2e 100644 --- a/tools/designer/designer/pixmapchooser.cpp +++ b/tools/designer/designer/pixmapchooser.cpp @@ -45,7 +45,7 @@ #include "project.h" #include -#include +#include #include #include #include diff --git a/tools/designer/designer/pixmapcollection.cpp b/tools/designer/designer/pixmapcollection.cpp index 83bb14502..0a94c591d 100644 --- a/tools/designer/designer/pixmapcollection.cpp +++ b/tools/designer/designer/pixmapcollection.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include PixmapCollection::PixmapCollection( Project *pro ) : project( pro ) diff --git a/tools/designer/designer/pixmapcollectioneditor.ui b/tools/designer/designer/pixmapcollectioneditor.ui index f6104f640..e6075c9e4 100644 --- a/tools/designer/designer/pixmapcollectioneditor.ui +++ b/tools/designer/designer/pixmapcollectioneditor.ui @@ -198,7 +198,7 @@ pixmapchooser.h project.h ntqfileinfo.h - ntqimage.h + tqimage.h ntqpixmap.h pixmapcollectioneditor.ui.h diff --git a/tools/designer/designer/resource.h b/tools/designer/designer/resource.h index 6e75e83c9..b2b437d1c 100644 --- a/tools/designer/designer/resource.h +++ b/tools/designer/designer/resource.h @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "actiondnd.h" #include "metadatabase.h" diff --git a/tools/designer/designer/styledbutton.cpp b/tools/designer/designer/styledbutton.cpp index 22096d36e..f3a31001d 100644 --- a/tools/designer/designer/styledbutton.cpp +++ b/tools/designer/designer/styledbutton.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/designer/examples/credit/creditformbase.cpp b/tools/designer/examples/credit/creditformbase.cpp index 372a756d3..e1ac4c506 100644 --- a/tools/designer/examples/credit/creditformbase.cpp +++ b/tools/designer/examples/credit/creditformbase.cpp @@ -19,7 +19,7 @@ #include #include #include "creditformbase.ui.h" -#include +#include #include static TQPixmap uic_load_pixmap_CreditFormBase( const TQString &name ) diff --git a/tools/designer/plugins/glade/glade2ui.cpp b/tools/designer/plugins/glade/glade2ui.cpp index b1bbe9ca7..cd7d7f7e0 100644 --- a/tools/designer/plugins/glade/glade2ui.cpp +++ b/tools/designer/plugins/glade/glade2ui.cpp @@ -38,7 +38,7 @@ #include #include -#include +#include #include #include #include diff --git a/tools/designer/uic/embed.cpp b/tools/designer/uic/embed.cpp index 5a272e33d..670b688cd 100644 --- a/tools/designer/uic/embed.cpp +++ b/tools/designer/uic/embed.cpp @@ -33,7 +33,7 @@ #include "uic.h" #include -#include +#include #include #include #include @@ -143,7 +143,7 @@ void Uic::embed( TQTextStream& out, const char* project, const TQStringList& ima out << "****************************************************************************/\n"; out << "\n"; - out << "#include \n"; + out << "#include \n"; out << "#include \n"; out << "#include \n"; out << "#include \n"; diff --git a/tools/designer/uic/form.cpp b/tools/designer/uic/form.cpp index 127d1915d..ebbcb1575 100644 --- a/tools/designer/uic/form.cpp +++ b/tools/designer/uic/form.cpp @@ -851,7 +851,7 @@ void Uic::createFormImpl( const TQDomElement &e ) } if ( !requiredImages.isEmpty() || externPixmaps ) { - out << "#include " << endl; + out << "#include " << endl; out << "#include " << endl << endl; } diff --git a/tools/designer/uilib/tqwidgetfactory.h b/tools/designer/uilib/tqwidgetfactory.h index 80df0bbbc..4838f6f64 100644 --- a/tools/designer/uilib/tqwidgetfactory.h +++ b/tools/designer/uilib/tqwidgetfactory.h @@ -37,7 +37,7 @@ #ifndef QT_H #include #include -#include +#include #include #include #include diff --git a/tools/qembed/qembed.cpp b/tools/qembed/qembed.cpp index 978a4f3d4..4db18202a 100644 --- a/tools/qembed/qembed.cpp +++ b/tools/qembed/qembed.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -96,7 +96,7 @@ int main( int argc, char **argv ) TQString arg = (*it); if ( arg == "--images" ) { if ( !images ) { - out << "#include \n"; + out << "#include \n"; out << "#include \n"; images = TRUE; } diff --git a/tools/tqvfb/qanimationwriter.h b/tools/tqvfb/qanimationwriter.h index 13e8ea136..88cbfe9db 100644 --- a/tools/tqvfb/qanimationwriter.h +++ b/tools/tqvfb/qanimationwriter.h @@ -34,7 +34,7 @@ #ifndef TQANIMATIONWRITER_H #define TQANIMATIONWRITER_H -#include +#include class TQAnimationWriterData; diff --git a/tools/tqvfb/tqvfb.cpp b/tools/tqvfb/tqvfb.cpp index 5a5497432..f4535615e 100644 --- a/tools/tqvfb/tqvfb.cpp +++ b/tools/tqvfb/tqvfb.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/tqvfb/tqvfbview.cpp b/tools/tqvfb/tqvfbview.cpp index b7639a6cf..35a846b29 100644 --- a/tools/tqvfb/tqvfbview.cpp +++ b/tools/tqvfb/tqvfbview.cpp @@ -46,7 +46,7 @@ #define TQTE_PIPE "TQtEmbedded-%1" #include -#include +#include #include #include #include -- cgit v1.2.3