diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-05-26 21:04:57 +0000 |
commit | bf7f88413be3831a9372d323d02fc0335b9f9188 (patch) | |
tree | 516fdef9206245b40a14f99b4e3d9ef9289196e0 /src/gvcore/qxcfi.h | |
parent | e238aa77b1fb3c2f55aef2ef2c91ce52166d2cc8 (diff) | |
download | gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.tar.gz gwenview-bf7f88413be3831a9372d323d02fc0335b9f9188.zip |
TQt4 port Gwenview
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/gwenview@1233720 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gvcore/qxcfi.h')
-rw-r--r-- | src/gvcore/qxcfi.h | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/src/gvcore/qxcfi.h b/src/gvcore/qxcfi.h index ac82173..e98f226 100644 --- a/src/gvcore/qxcfi.h +++ b/src/gvcore/qxcfi.h @@ -1,10 +1,10 @@ -#ifndef QXCFI_H -#define QXCFI_H +#ifndef TQXCFI_H +#define TQXCFI_H -#include <qimage.h> -#include <qimageformatplugin.h> -#include <qvaluestack.h> -#include <qvaluevector.h> +#include <tqimage.h> +#include <tqimageformatplugin.h> +#include <tqvaluestack.h> +#include <tqvaluevector.h> #include "gimp.h" namespace Gwenview { @@ -12,11 +12,11 @@ namespace Gwenview { // Safe readBlock helper functions class SafeDataStream { public: - SafeDataStream(QIODevice* device) + SafeDataStream(TQIODevice* device) : mDevice(device), mFailed(false) {} bool failed() const { return mFailed; } - QIODevice* device() const { return mDevice; } + TQIODevice* device() const { return mDevice; } SafeDataStream& readRawBytes(char* data, uint length) { if (mFailed) return *this; @@ -26,11 +26,11 @@ public: return *this; } - SafeDataStream& operator>>(Q_INT8& value) { + SafeDataStream& operator>>(TQ_INT8& value) { return readRawBytes((char*)&value, 1); } - SafeDataStream& operator>>(Q_UINT32& value) { + SafeDataStream& operator>>(TQ_UINT32& value) { if (mFailed) return *this; uchar *p = (uchar *)(&value); char b[4]; @@ -45,18 +45,18 @@ public: return *this; } - SafeDataStream& operator>>(Q_INT32& value) { - return *this >>((Q_UINT32&)value); + SafeDataStream& operator>>(TQ_INT32& value) { + return *this >>((TQ_UINT32&)value); } SafeDataStream& operator>>(float& value) { - return *this >>((Q_UINT32&)value); + return *this >>((TQ_UINT32&)value); } SafeDataStream& operator>>(char*& value) { if (mFailed) return *this; - Q_UINT32 len; + TQ_UINT32 len; *this >> len; if (mFailed) return *this; if ( len == 0 ) { @@ -95,17 +95,17 @@ public: int at() const; private: - QIODevice* mDevice; + TQIODevice* mDevice; bool mFailed; }; //! Plug-in for loading a GIMP XCF image file directly. /*! - * This class uses the Qt 3.0 Image format plug-in loader to provide + * This class uses the TQt 3.0 Image format plug-in loader to provide * the ability to read The GIMP XCF image files. This plug-in will * be dynamically loaded as needed. */ -class XCFImageFormat : public QImageFormatPlugin { +class XCFImageFormat : public TQImageFormatPlugin { /*! * Each layer in an XCF file is stored as a matrix of @@ -114,7 +114,7 @@ class XCFImageFormat : public QImageFormatPlugin { * parallel processing on a tile-by-tile basis. Here, though, * we just read them in en-masse and store them in a matrix. */ - typedef QValueVector< QValueVector< QImage > > Tiles; + typedef TQValueVector< TQValueVector< TQImage > > Tiles; /*! * Each GIMP image is composed of one or more layers. A layer can @@ -122,15 +122,15 @@ class XCFImageFormat : public QImageFormatPlugin { * optional alpha channel, there are six possible types altogether. * * Note: there is only ever one instance of this structure. The - * layer info is discarded after it is merged into the final QImage. + * layer info is discarded after it is merged into the final TQImage. */ struct Layer { - Q_UINT32 width; //!< Width of the layer - Q_UINT32 height; //!< Height of the layer - Q_INT32 type; //!< Type of the layer (GimpImageType) + TQ_UINT32 width; //!< Width of the layer + TQ_UINT32 height; //!< Height of the layer + TQ_INT32 type; //!< Type of the layer (GimpImageType) char* name; //!< Name of the layer - Q_UINT32 hierarchy_offset; //!< File position of Tile hierarchy - Q_UINT32 mask_offset; //!< File position of mask image + TQ_UINT32 hierarchy_offset; //!< File position of Tile hierarchy + TQ_UINT32 tqmask_offset; //!< File position of tqmask image uint nrows; //!< Number of rows of tiles (y direction) uint ncols; //!< Number of columns of tiles (x direction) @@ -139,36 +139,36 @@ class XCFImageFormat : public QImageFormatPlugin { //! For Grayscale and Indexed images, the alpha channel is stored //! separately (in this data structure, anyway). Tiles alpha_tiles; - Tiles mask_tiles; //!< The layer mask (optional) + Tiles tqmask_tiles; //!< The layer tqmask (optional) - //! Additional information about a layer mask. + //! Additional information about a layer tqmask. struct { - Q_UINT32 opacity; - Q_UINT32 visible; - Q_UINT32 show_masked; + TQ_UINT32 opacity; + TQ_UINT32 visible; + TQ_UINT32 show_tqmasked; uchar red, green, blue; - Q_UINT32 tattoo; - } mask_channel; + TQ_UINT32 tattoo; + } tqmask_channel; bool active; //!< Is this layer the active layer? - Q_UINT32 opacity; //!< The opacity of the layer - Q_UINT32 visible; //!< Is the layer visible? - Q_UINT32 linked; //!< Is this layer linked (geometrically) - Q_UINT32 preserve_transparency; //!< Preserve alpha when drawing on layer? - Q_UINT32 apply_mask; //!< Apply the layer mask? - Q_UINT32 edit_mask; //!< Is the layer mask the being edited? - Q_UINT32 show_mask; //!< Show the layer mask rather than the image? - Q_INT32 x_offset; //!< x offset of the layer relative to the image - Q_INT32 y_offset; //!< y offset of the layer relative to the image - Q_UINT32 mode; //!< Combining mode of layer (LayerModeEffects) - Q_UINT32 tattoo; //!< (unique identifier?) + TQ_UINT32 opacity; //!< The opacity of the layer + TQ_UINT32 visible; //!< Is the layer visible? + TQ_UINT32 linked; //!< Is this layer linked (geometrically) + TQ_UINT32 preserve_transparency; //!< Preserve alpha when drawing on layer? + TQ_UINT32 apply_tqmask; //!< Apply the layer tqmask? + TQ_UINT32 edit_tqmask; //!< Is the layer tqmask the being edited? + TQ_UINT32 show_tqmask; //!< Show the layer tqmask rather than the image? + TQ_INT32 x_offset; //!< x offset of the layer relative to the image + TQ_INT32 y_offset; //!< y offset of the layer relative to the image + TQ_UINT32 mode; //!< Combining mode of layer (LayerModeEffects) + TQ_UINT32 tattoo; //!< (unique identifier?) //! As each tile is read from the file, it is buffered here. - uchar tile[TILE_WIDTH * TILE_HEIGHT * sizeof(QRgb)]; + uchar tile[TILE_WIDTH * TILE_HEIGHT * sizeof(TQRgb)]; //! The data from tile buffer is copied to the Tile by this //! method. Depending on the type of the tile (RGB, Grayscale, - //! Indexed) and use (image or mask), the bytes in the buffer are + //! Indexed) and use (image or tqmask), the bytes in the buffer are //! copied in different ways. void (*assignBytes)( Layer& layer, uint i, uint j ); @@ -183,36 +183,36 @@ class XCFImageFormat : public QImageFormatPlugin { * metadata items, but is mostly a container for the layer information. */ struct XCFImage { - Q_UINT32 width; //!< width of the XCF image - Q_UINT32 height; //!< height of the XCF image - Q_INT32 type; //!< type of the XCF image (GimpImageBaseType) + TQ_UINT32 width; //!< width of the XCF image + TQ_UINT32 height; //!< height of the XCF image + TQ_INT32 type; //!< type of the XCF image (GimpImageBaseType) - Q_UINT8 compression; //!< tile compression method (CompressionType) + TQ_UINT8 compression; //!< tile compression method (CompressionType) float x_resolution; //!< x resolution in dots per inch float y_resolution; //!< y resolution in dots per inch - Q_INT32 tattoo; //!< (unique identifier?) - Q_UINT32 unit; //!< Units of The GIMP (inch, mm, pica, etc...) - Q_INT32 num_colors; //!< number of colors in an indexed image - QValueVector< QRgb > palette; //!< indexed image color palette + TQ_INT32 tattoo; //!< (unique identifier?) + TQ_UINT32 unit; //!< Units of The GIMP (inch, mm, pica, etc...) + TQ_INT32 num_colors; //!< number of colors in an indexed image + TQValueVector< TQRgb > palette; //!< indexed image color palette int num_layers; //!< number of layers Layer layer; //!< most recently read layer - bool initialized; //!< Is the QImage initialized? - QImage image; //!< final QImage + bool initialized; //!< Is the TQImage initialized? + TQImage image; //!< final TQImage //! Simple constructor. XCFImage ( void ) : initialized( false ) {} }; - //! The bottom-most layer is copied into the final QImage by this + //! The bottom-most layer is copied into the final TQImage by this //! routine. typedef void (*PixelCopyOperation) ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); - //! Higher layers are merged into the the final QImage by this routine. + //! Higher layers are merged into the the final TQImage by this routine. typedef void (*PixelMergeOperation) ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); //! In layer DISSOLVE mode, a random number is chosen to compare to a //! pixel's alpha. If the alpha is greater than the random number, the @@ -245,31 +245,31 @@ public: /*! * The image loader makes no (direct) use of dynamic memory - * and the Qt infrastructure takes care of constructing and destructing + * and the TQt infrastructure takes care of constructing and destructing * the loader so there is not much to do here. */ ~XCFImageFormat () {} /*! - * You can query Qt about the types of image file formats it knows about - * via QImage::inputFormats or QImage::inputFormatList(). + * You can query TQt about the types of image file formats it knows about + * via TQImage::inputFormats or TQImage::inputFormatList(). * This method returns "xcf". */ - QStringList keys () const { - return QStringList() << "XCF"; + TQStringList keys () const { + return TQStringList() << "XCF"; } /*! * This method installs the XCF reader on demand. */ - bool installIOHandler ( const QString& ); + bool installIOHandler ( const TQString& ); static void registerFormat(); private: - static void readXCF ( QImageIO* image_io ); + static void readXCF ( TQImageIO* image_io ); #ifdef TMP_WRITE - static void writeXCF ( QImageIO* ) {} + static void writeXCF ( TQImageIO* ) {} #endif static void initializeImage ( XCFImage& xcf_image ); static void composeTiles ( XCFImage& xcf_image ); @@ -279,52 +279,52 @@ private: static bool loadChannelProperties ( SafeDataStream& xcf_io, Layer& layer ); static bool loadHierarchy ( SafeDataStream& xcf_io, Layer& layer ); static bool loadMask ( SafeDataStream& xcf_io, Layer& layer ); - static bool loadLevel ( SafeDataStream& xcf_io, Layer& layer, Q_INT32 bpp ); + static bool loadLevel ( SafeDataStream& xcf_io, Layer& layer, TQ_INT32 bpp ); static bool loadTileRLE ( SafeDataStream& xcf_io, uchar* tile, int size, - int data_length, Q_INT32 bpp ); + int data_length, TQ_INT32 bpp ); static bool loadProperty ( SafeDataStream& xcf_io, PropType& type, - QByteArray& bytes ); - static void setGrayPalette ( QImage& image ); - static void setPalette ( XCFImage& xcf_image, QImage& image ); + TQByteArray& bytes ); + static void setGrayPalette ( TQImage& image ); + static void setPalette ( XCFImage& xcf_image, TQImage& image ); static void assignImageBytes ( Layer& layer, uint i, uint j ); static void assignMaskBytes ( Layer& layer, uint i, uint j ); static void copyLayerToImage ( XCFImage& xcf_image ); static void copyRGBToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyGrayToGray ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyGrayToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyGrayAToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyIndexedToIndexed ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyIndexedAToIndexed ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void copyIndexedAToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeLayerIntoImage ( XCFImage& xcf_image ); static void mergeRGBToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeGrayToGray ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeGrayAToGray ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeGrayToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeGrayAToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeIndexedToIndexed ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeIndexedAToIndexed ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); static void mergeIndexedAToRGB ( Layer& layer, uint i, uint j, int k, int l, - QImage& image, int m, int n ); + TQImage& image, int m, int n ); - static void dissolveRGBPixels ( QImage& image, int x, int y ); - static void dissolveAlphaPixels ( QImage& image, int x, int y ); + static void dissolveRGBPixels ( TQImage& image, int x, int y ); + static void dissolveAlphaPixels ( TQImage& image, int x, int y ); }; } // namespace |