diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 22:37:25 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2011-05-03 22:37:25 +0200 |
commit | 181df199d31a8018cfcfc31b548909fe4b57ccbd (patch) | |
tree | 76833450e7d545d8345a4f529ef5320f24188c1e /src/gui/image | |
parent | 52352c6c572f15c10c4c3de641db81723aada468 (diff) |
remove more QT3_SUPPORT code
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qbitmap.cpp | 87 | ||||
-rw-r--r-- | src/gui/image/qbitmap.h | 23 | ||||
-rw-r--r-- | src/gui/image/qicon.cpp | 94 | ||||
-rw-r--r-- | src/gui/image/qicon.h | 19 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 553 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 49 | ||||
-rw-r--r-- | src/gui/image/qimage_p.h | 3 | ||||
-rw-r--r-- | src/gui/image/qmovie.h | 20 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 3 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 185 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 28 |
11 files changed, 0 insertions, 1064 deletions
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index b861997cbb..6cd8363374 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -204,20 +204,6 @@ QBitmap &QBitmap::operator=(const QPixmap &pixmap) return *this; } - -#ifdef QT3_SUPPORT -QBitmap::QBitmap(int w, int h, const uchar *bits, bool isXbitmap) -{ - *this = fromData(QSize(w, h), bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono); -} - - -QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap) -{ - *this = fromData(size, bits, isXbitmap ? QImage::Format_MonoLSB : QImage::Format_Mono); -} -#endif - /*! Destroys the bitmap. */ @@ -332,77 +318,4 @@ QBitmap QBitmap::transformed(const QMatrix &matrix) const return transformed(QTransform(matrix)); } -#ifdef QT3_SUPPORT -/*! - \fn QBitmap QBitmap::xForm(const QMatrix &matrix) const - - Returns a copy of this bitmap, transformed according to the given - \a matrix. - - Use transformed() instead. -*/ - -/*! - \fn QBitmap::QBitmap(const QSize &size, bool clear) - - Constructs a bitmap with the given \a size. If \a clear is true, - the bits are initialized to Qt::color0. - - Use the corresponding QBitmap() constructor instead, and then call - the clear() function if the \a clear parameter is true. -*/ - -/*! - \fn QBitmap::QBitmap(int width, int height, bool clear) - - Constructs a bitmap with the given \a width and \a height. If \a - clear is true, the bits are initialized to Qt::color0. - - Use the corresponding QBitmap() constructor instead, and then call - the clear() function if the \a clear parameter is true. -*/ - -/*! - \fn QBitmap::QBitmap(int width, int height, const uchar *bits, bool isXbitmap) - - Constructs a bitmap with the given \a width and \a height, and - sets the contents to the \a bits supplied. The \a isXbitmap flag - should be true if \a bits was generated by the X11 bitmap - program. - - Use the static fromData() function instead. If \a isXbitmap is - true, use the default bit order(QImage_FormatMonoLSB) otherwise - use QImage::Format_Mono. - - \omit - The X bitmap bit order is little endian. The QImage - documentation discusses bit order of monochrome images. Opposed to - QImage, the data has to be byte aligned. - - Example (creates an arrow bitmap): - \snippet doc/src/snippets/code/src_gui_image_qbitmap.cpp 0 - \endomit -*/ - - -/*! - \fn QBitmap::QBitmap(const QSize &size, const uchar *bits, bool isXbitmap) - - \overload - - Constructs a bitmap with the given \a size, and sets the contents - to the \a bits supplied. The \a isXbitmap flag should be true if - \a bits was generated by the X11 bitmap program. - - \omit - The X bitmap bit order is little endian. The QImage documentation - discusses bit order of monochrome images. - \endomit - - Use the static fromData() function instead. If \a isXbitmap is - true, use the default bit order(QImage_FormatMonoLSB) otherwise - use QImage::Format_Mono. -*/ -#endif - QT_END_NAMESPACE diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index f1771e3e43..9dff0816dd 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -74,34 +74,11 @@ public: QBitmap transformed(const QMatrix &) const; QBitmap transformed(const QTransform &matrix) const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, bool clear); - inline QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, bool clear); - QT3_SUPPORT_CONSTRUCTOR QBitmap(int w, int h, const uchar *bits, bool isXbitmap=false); - QT3_SUPPORT_CONSTRUCTOR QBitmap(const QSize &, const uchar *bits, bool isXbitmap=false); - inline QT3_SUPPORT QBitmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - QT3_SUPPORT_CONSTRUCTOR QBitmap(const QImage &image) { *this = fromImage(image); } - QT3_SUPPORT QBitmap &operator=(const QImage &image) { *this = fromImage(image); return *this; } -#endif typedef QExplicitlySharedDataPointer<QPixmapData> DataPtr; }; Q_DECLARE_SHARED(QBitmap) -#ifdef QT3_SUPPORT -inline QBitmap::QBitmap(int w, int h, bool clear) - : QPixmap(QSize(w, h), 1) -{ - if (clear) this->clear(); -} - -inline QBitmap::QBitmap(const QSize &size, bool clear) - : QPixmap(size, 1) -{ - if (clear) this->clear(); -} -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index cfd837da45..59687c709d 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1151,100 +1151,6 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon) #endif //QT_NO_DATASTREAM - -#ifdef QT3_SUPPORT - -static int widths[2] = { 22, 32 }; -static int heights[2] = { 22, 32 }; - -static QSize pixmapSizeHelper(QIcon::Size which) -{ - int i = 0; - if (which == QIcon::Large) - i = 1; - return QSize(widths[i], heights[i]); -} - -/*! - \enum QIcon::Size - \compat - - \value Small Use QStyle::pixelMetric(QStyle::PM_SmallIconSize) instead. - \value Large Use QStyle::pixelMetric(QStyle::PM_LargeIconSize) instead. - \value Automatic N/A. -*/ - -/*! - Use pixmap(QSize(...), \a mode, \a state), where the first - argument is an appropriate QSize instead of a \l Size value. - - \sa pixmapSize() -*/ -QPixmap QIcon::pixmap(Size size, Mode mode, State state) const -{ return pixmap(pixmapSizeHelper(size), mode, state); } - -/*! - Use pixmap(QSize(...), mode, \a state), where the first argument - is an appropriate QSize instead of a \l Size value, and the - second argument is QIcon::Normal or QIcon::Disabled, depending on - the value of \a enabled. - - \sa pixmapSize() -*/ -QPixmap QIcon::pixmap(Size size, bool enabled, State state) const -{ return pixmap(pixmapSizeHelper(size), enabled ? Normal : Disabled, state); } - -/*! - Use one of the other pixmap() overloads. -*/ -QPixmap QIcon::pixmap() const -{ return pixmap(pixmapSizeHelper(Small), Normal, Off); } - -/*! - The pixmap() function now takes a QSize instead of a QIcon::Size, - so there is no need for this function in new code. -*/ -void QIcon::setPixmapSize(Size which, const QSize &size) -{ - int i = 0; - if (which == Large) - i = 1; - widths[i] = size.width(); - heights[i] = size.height(); -} - -/*! - Use QStyle::pixelMetric() with QStyle::PM_SmallIconSize or - QStyle::PM_LargeIconSize as the first argument, depending on \a - which. -*/ -QSize QIcon::pixmapSize(Size which) -{ - return pixmapSizeHelper(which); -} - -/*! - \fn void QIcon::reset(const QPixmap &pixmap, Size size) - - Use the constructor that takes a QPixmap and operator=(). -*/ - -/*! - \fn void QIcon::setPixmap(const QPixmap &pixmap, Size size, Mode mode, State state) - - Use addPixmap(\a pixmap, \a mode, \a state) instead. The \a size - parameter is ignored. -*/ - -/*! - \fn void QIcon::setPixmap(const QString &fileName, Size size, Mode mode, State state) - - Use addFile(\a fileName, \a mode, \a state) instead. The \a size - parameter is ignored. -*/ - -#endif // QT3_SUPPORT - /*! \fn DataPtr &QIcon::data_ptr() \internal diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h index 170559182b..4e3960925e 100644 --- a/src/gui/image/qicon.h +++ b/src/gui/image/qicon.h @@ -114,21 +114,6 @@ public: static QString themeName(); static void setThemeName(const QString &path); - -#ifdef QT3_SUPPORT - enum Size { Small, Large, Automatic = Small }; - static QT3_SUPPORT void setPixmapSize(Size which, const QSize &size); - static QT3_SUPPORT QSize pixmapSize(Size which); - inline QT3_SUPPORT void reset(const QPixmap &pixmap, Size /*size*/) { *this = QIcon(pixmap); } - inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap, Size, Mode mode = Normal, State state = Off) - { addPixmap(pixmap, mode, state); } - inline QT3_SUPPORT void setPixmap(const QString &fileName, Size, Mode mode = Normal, State state = Off) - { addPixmap(QPixmap(fileName), mode, state); } - QT3_SUPPORT QPixmap pixmap(Size size, Mode mode, State state = Off) const; - QT3_SUPPORT QPixmap pixmap(Size size, bool enabled, State state = Off) const; - QT3_SUPPORT QPixmap pixmap() const; -#endif - Q_DUMMY_COMPARISON_OPERATOR(QIcon) private: @@ -151,10 +136,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QIcon &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QIcon &); #endif -#ifdef QT3_SUPPORT -typedef QIcon QIconSet; -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 50b372ea63..448e1b4be0 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -124,9 +124,6 @@ QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); QImageData::QImageData() : ref(0), width(0), height(0), depth(0), nbytes(0), data(0), -#ifdef QT3_SUPPORT - jumptable(0), -#endif format(QImage::Format_ARGB32), bytes_per_line(0), ser_no(qimage_serial_number.fetchAndAddRelaxed(1)), detach_no(0), @@ -220,11 +217,6 @@ QImageData::~QImageData() delete paintEngine; if (data && own_data) free(data); -#ifdef QT3_SUPPORT - if (jumptable) - free(jumptable); - jumptable = 0; -#endif data = 0; } @@ -757,27 +749,6 @@ const uchar *qt_get_bitflip_array() // called from QPixma return bitflip; } -#if defined(QT3_SUPPORT) -static QImage::Format formatFor(int depth, QImage::Endian bitOrder) -{ - QImage::Format format; - if (depth == 1) { - format = bitOrder == QImage::BigEndian ? QImage::Format_Mono : QImage::Format_MonoLSB; - } else if (depth == 8) { - format = QImage::Format_Indexed8; - } else if (depth == 32) { - format = QImage::Format_RGB32; - } else if (depth == 24) { - format = QImage::Format_RGB888; - } else if (depth == 16) { - format = QImage::Format_RGB16; - } else { - qWarning("QImage: Depth %d not supported", depth); - format = QImage::Format_Invalid; - } - return format; -} -#endif /*! Constructs a null image. @@ -991,42 +962,6 @@ QImage::QImage(const QString &fileName, const char *format) load(fileName, format); } -/*! - Constructs an image and tries to load the image from the file with - the given \a fileName. - - The loader attempts to read the image using the specified \a - format. If the \a format is not specified (which is the default), - the loader probes the file for a header to guess the file format. - - If the loading of the image failed, this object is a null image. - - The file name can either refer to an actual file on disk or to one - of the application's embedded resources. See the - \l{resources.html}{Resource System} overview for details on how to - embed images and other resource files in the application's - executable. - - You can disable this constructor by defining \c - QT_NO_CAST_FROM_ASCII when you compile your applications. This can - be useful, for example, if you want to ensure that all - user-visible strings go through QObject::tr(). - - \sa QString::fromAscii(), isNull(), {QImage#Reading and Writing - Image Files}{Reading and Writing Image Files} -*/ -#ifndef QT_NO_CAST_FROM_ASCII -QImage::QImage(const char *fileName, const char *format) - : QPaintDevice() -{ - // ### Qt 5: if you remove the QImage(const QByteArray &) QT3_SUPPORT - // constructor, remove this constructor as well. The constructor here - // exists so that QImage("foo.png") compiles without ambiguity. - d = 0; - load(QString::fromAscii(fileName), format); -} -#endif - #ifndef QT_NO_IMAGEFORMAT_XPM extern bool qt_read_xpm_image_or_array(QIODevice *device, const char * const *source, QImage &image); @@ -1097,178 +1032,6 @@ QImage::QImage(const QImage &image) } } -#ifdef QT3_SUPPORT -/*! - \fn QImage::QImage(int width, int height, int depth, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, \a depth, - \a numColors colors and \a bitOrder. - - Use the constructor that accepts a width, a height and a format - (i.e. specifying the depth and bit order), in combination with the - setColorCount() function, instead. - - \oldcode - QImage image(width, height, depth, numColors); - \newcode - QImage image(width, height, format); - - // For 8 bit images the default number of colors is 256. If - // another number of colors is required it can be specified - // using the setColorCount() function. - image.setColorCount(numColors); - \endcode -*/ - -QImage::QImage(int w, int h, int depth, int colorCount, Endian bitOrder) - : QPaintDevice() -{ - d = QImageData::create(QSize(w, h), formatFor(depth, bitOrder), colorCount); -} - -/*! - Constructs an image with the given \a size, \a depth, \a numColors - and \a bitOrder. - - Use the constructor that accepts a size and a format - (i.e. specifying the depth and bit order), in combination with the - setColorCount() function, instead. - - \oldcode - QSize mySize(width, height); - QImage image(mySize, depth, numColors); - \newcode - QSize mySize(width, height); - QImage image(mySize, format); - - // For 8 bit images the default number of colors is 256. If - // another number of colors is required it can be specified - // using the setColorCount() function. - image.setColorCount(numColors); - \endcode -*/ -QImage::QImage(const QSize& size, int depth, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = QImageData::create(size, formatFor(depth, bitOrder), numColors); -} - -/*! - \fn QImage::QImage(uchar* data, int width, int height, int depth, const QRgb* colortable, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, depth, \a - colortable, \a numColors and \a bitOrder, that uses an existing - memory buffer, \a data. - - Use the constructor that accepts a uchar pointer, a width, a - height and a format (i.e. specifying the depth and bit order), in - combination with the setColorTable() function, instead. - - \oldcode - uchar *myData; - QRgb *myColorTable; - - QImage image(myData, width, height, depth, - myColorTable, numColors, IgnoreEndian); - \newcode - uchar *myData; - QVector<QRgb> myColorTable; - - QImage image(myData, width, height, format); - image.setColorTable(myColorTable); - \endcode -*/ -QImage::QImage(uchar* data, int w, int h, int depth, const QRgb* colortable, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = 0; - Format f = formatFor(depth, bitOrder); - if (f == Format_Invalid) - return; - - const int bytes_per_line = ((w*depth+31)/32)*4; // bytes per scanline - if (w <= 0 || h <= 0 || numColors < 0 || !data - || INT_MAX/sizeof(uchar *) < uint(h) - || INT_MAX/uint(depth) < uint(w) - || bytes_per_line <= 0 - || INT_MAX/uint(bytes_per_line) < uint(h)) - return; // invalid parameter(s) - d = new QImageData; - d->ref.ref(); - - d->own_data = false; - d->data = data; - d->width = w; - d->height = h; - d->depth = depth; - d->format = f; - if (depth == 32) - numColors = 0; - - d->bytes_per_line = bytes_per_line; - d->nbytes = d->bytes_per_line * h; - if (colortable) { - d->colortable.resize(numColors); - for (int i = 0; i < numColors; ++i) - d->colortable[i] = colortable[i]; - } else if (numColors) { - setColorCount(numColors); - } -} - -#ifdef Q_WS_QWS - -/*! - \fn QImage::QImage(uchar* data, int width, int height, int depth, int bytesPerLine, const QRgb* colortable, int numColors, Endian bitOrder) - - Constructs an image with the given \a width, \a height, \a depth, - \a bytesPerLine, \a colortable, \a numColors and \a bitOrder, that - uses an existing memory buffer, \a data. The image does not delete - the buffer at destruction. - - \warning This constructor is only available in Qt for Embedded Linux. - - The data has to be 32-bit aligned, and each scanline of data in the image - must also be 32-bit aligned, so it's no longer possible to specify a custom - \a bytesPerLine value. -*/ -QImage::QImage(uchar* data, int w, int h, int depth, int bpl, const QRgb* colortable, int numColors, Endian bitOrder) - : QPaintDevice() -{ - d = 0; - Format f = formatFor(depth, bitOrder); - if (f == Format_Invalid) - return; - if (!data || 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) - - d = new QImageData; - d->ref.ref(); - d->own_data = false; - d->data = data; - d->width = w; - d->height = h; - d->depth = depth; - d->format = f; - if (depth == 32) - numColors = 0; - d->bytes_per_line = bpl; - d->nbytes = d->bytes_per_line * h; - if (colortable) { - d->colortable.resize(numColors); - for (int i = 0; i < numColors; ++i) - d->colortable[i] = colortable[i]; - } else if (numColors) { - setColorCount(numColors); - } -} -#endif // Q_WS_QWS -#endif // QT3_SUPPORT - /*! Destroys the image and cleans up. */ @@ -1613,75 +1376,6 @@ int QImage::colorCount() const return d ? d->colortable.size() : 0; } - -#ifdef QT3_SUPPORT -/*! - \fn QImage::Endian QImage::bitOrder() const - - Returns the bit order for the image. If it is a 1-bpp image, this - function returns either QImage::BigEndian or - QImage::LittleEndian. Otherwise, this function returns - QImage::IgnoreEndian. - - Use the format() function instead for the monochrome formats. For - non-monochrome formats the bit order is irrelevant. -*/ - -/*! - Returns a pointer to the scanline pointer table. This is the - beginning of the data block for the image. - Returns 0 in case of an error. - - Use the bits() or scanLine() function instead. -*/ -uchar **QImage::jumpTable() -{ - if (!d) - return 0; - detach(); - - // in case detach() ran out of memory.. - if (!d) - return 0; - - if (!d->jumptable) { - d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *)); - if (!d->jumptable) - return 0; - uchar *data = d->data; - int height = d->height; - uchar **p = d->jumptable; - while (height--) { - *p++ = data; - data += d->bytes_per_line; - } - } - return d->jumptable; -} - -/*! - \overload -*/ -const uchar * const *QImage::jumpTable() const -{ - if (!d) - return 0; - if (!d->jumptable) { - d->jumptable = (uchar **)malloc(d->height*sizeof(uchar *)); - if (!d->jumptable) - return 0; - uchar *data = d->data; - int height = d->height; - uchar **p = d->jumptable; - while (height--) { - *p++ = data; - data += d->bytes_per_line; - } - } - return d->jumptable; -} -#endif - /*! Sets the color table used to translate color indexes to QRgb values, to the specified \a colors. @@ -2223,116 +1917,6 @@ QImage::Format QImage::format() const } -#ifdef QT3_SUPPORT -/*! - Returns true if alpha buffer mode is enabled; otherwise returns - false. - - Use the hasAlphaChannel() function instead. - -*/ -bool QImage::hasAlphaBuffer() const -{ - if (!d) - return false; - - switch (d->format) { - case Format_ARGB32: - case Format_ARGB32_Premultiplied: - case Format_ARGB8565_Premultiplied: - case Format_ARGB8555_Premultiplied: - case Format_ARGB6666_Premultiplied: - case Format_ARGB4444_Premultiplied: - return true; - default: - return false; - } -} - -/*! - Enables alpha buffer mode if \a enable is true, otherwise disables - it. The alpha buffer is used to set a mask when a QImage is - translated to a QPixmap. - - If a monochrome or indexed 8-bit image has alpha channels in their - color tables they will automatically detect that they have an - alpha channel, so this function is not required. To force alpha - channels on 32-bit images, use the convertToFormat() function. -*/ - -void QImage::setAlphaBuffer(bool enable) -{ - if (!d - || d->format == Format_Mono - || d->format == Format_MonoLSB - || d->format == Format_Indexed8) - return; - if (enable && (d->format == Format_ARGB32 || - d->format == Format_ARGB32_Premultiplied || - d->format == Format_ARGB8565_Premultiplied || - d->format == Format_ARGB6666_Premultiplied || - d->format == Format_ARGB8555_Premultiplied || - d->format == Format_ARGB4444_Premultiplied)) - { - return; - } - if (!enable && (d->format == Format_RGB32 || - d->format == Format_RGB555 || - d->format == Format_RGB666 || - d->format == Format_RGB888 || - d->format == Format_RGB444)) - { - return; - } - detach(); - d->format = (enable ? Format_ARGB32 : Format_RGB32); -} - - -/*! - \fn bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder) - - 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 QImage::LittleEndian or QImage::BigEndian. For other depths - \a bitOrder must be QImage::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()). - - Use a QImage constructor instead. -*/ -bool QImage::create(int width, int height, int depth, int numColors, Endian bitOrder) -{ - if (d && !d->ref.deref()) - delete d; - d = QImageData::create(QSize(width, height), formatFor(depth, bitOrder), numColors); - return true; -} - -/*! - \fn bool QImage::create(const QSize& size, int depth, int numColors, Endian bitOrder) - \overload - - The width and height are specified in the \a size argument. - - Use a QImage constructor instead. -*/ -bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian bitOrder) -{ - if (d && !d->ref.deref()) - delete d; - d = QImageData::create(size, formatFor(depth, bitOrder), numColors); - return true; -} -#endif // QT3_SUPPORT /***************************************************************************** Internal routines for converting image depth. @@ -4022,30 +3606,6 @@ QImage QImage::convertToFormat(Format format, const QVector<QRgb> &colorTable, Q return image; } -#ifdef QT3_SUPPORT -/*! - Converts the depth (bpp) of the image to the given \a depth and - returns the converted image. The original image is not changed. - Returns this image if \a depth is equal to the image depth, or a - null image if this image cannot be converted. The \a depth - argument must be 1, 8 or 32. 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 flags to specify how you'd prefer this to - happen. - - Use the convertToFormat() function instead. -*/ - -QImage QImage::convertDepth(int depth, Qt::ImageConversionFlags flags) const -{ - if (!d || d->depth == depth) - return *this; - - Format format = formatFor (depth, QImage::LittleEndian); - return convertToFormat(format, flags); -} -#endif - /*! \fn bool QImage::valid(const QPoint &pos) const @@ -4264,41 +3824,6 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) } } -#ifdef QT3_SUPPORT -/*! - Converts the bit order of the image to the given \a bitOrder and - returns the converted image. The original image is not changed. - Returns this image if the given \a bitOrder is equal to the image - current bit order, or a null image if this image cannot be - converted. - - Use convertToFormat() instead. -*/ - -QImage QImage::convertBitOrder(Endian bitOrder) const -{ - if (!d || isNull() || d->depth != 1 || !(bitOrder == BigEndian || bitOrder == LittleEndian)) - return QImage(); - - if ((d->format == Format_Mono && bitOrder == BigEndian) - || (d->format == Format_MonoLSB && bitOrder == LittleEndian)) - return *this; - - QImage image(d->width, d->height, d->format == Format_Mono ? Format_MonoLSB : Format_Mono); - - const uchar *data = d->data; - const uchar *end = data + d->nbytes; - uchar *ndata = image.d->data; - while (data < end) - *ndata++ = bitflip[*data++]; - - image.setDotsPerMeterX(dotsPerMeterX()); - image.setDotsPerMeterY(dotsPerMeterY()); - - image.d->colortable = d->colortable; - return image; -} -#endif /*! Returns true if all the colors in the image are shades of gray (i.e. their red, green and blue components are equal); otherwise @@ -5283,66 +4808,6 @@ QDataStream &operator>>(QDataStream &s, QImage &image) #endif // QT_NO_DATASTREAM -#ifdef QT3_SUPPORT -/*! - \fn QImage QImage::convertDepthWithPalette(int depth, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const - - Returns an image with the given \a depth, using the \a - palette_count colors pointed to by \a palette. If \a depth is 1 or - 8, the returned image will have its color table ordered in the - same way 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 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. - - Use the convertToFormat() function in combination with the - setColorTable() function instead. -*/ -QImage QImage::convertDepthWithPalette(int d, QRgb* palette, int palette_count, Qt::ImageConversionFlags flags) const -{ - Format f = formatFor(d, QImage::LittleEndian); - QVector<QRgb> colortable; - for (int i = 0; i < palette_count; ++i) - colortable.append(palette[i]); - return convertToFormat(f, colortable, flags); -} - -/*! - \relates QImage - - Copies a block of pixels from \a src to \a dst. The pixels - copied from source (src) are converted according to - \a 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. - - Use copy() or QPainter::drawImage() instead. -*/ -void bitBlt(QImage *dst, int dx, int dy, const QImage *src, int sx, int sy, int sw, int sh, - Qt::ImageConversionFlags flags) -{ - if (dst->isNull() || src->isNull()) - return; - QPainter p(dst); - p.drawImage(QPoint(dx, dy), *src, QRect(sx, sy, sw, sh), flags); -} -#endif /*! \fn bool QImage::operator==(const QImage & image) const @@ -6322,24 +5787,6 @@ int QImage::bitPlaneCount() const return bpc; } - -#ifdef QT3_SUPPORT -#if defined(Q_WS_X11) -QT_BEGIN_INCLUDE_NAMESPACE -#include <private/qt_x11_p.h> -QT_END_INCLUDE_NAMESPACE -#endif - -QImage::Endian QImage::systemBitOrder() -{ -#if defined(Q_WS_X11) - return BitmapBitOrder(X11->display) == MSBFirst ? BigEndian : LittleEndian; -#else - return BigEndian; -#endif -} -#endif - /*! \fn QImage QImage::copy(const QRect &rect, Qt::ImageConversionFlags flags) const \compat diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 496fe93c54..849f731f5e 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -283,50 +283,6 @@ public: void setText(const char* key, const char* lang, const QString&); #endif -#ifdef QT3_SUPPORT - enum Endian { BigEndian, LittleEndian, IgnoreEndian }; - QT3_SUPPORT_CONSTRUCTOR QImage(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT_CONSTRUCTOR QImage(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, const QRgb *colortable, int numColors, Endian bitOrder); -#ifdef Q_WS_QWS - QT3_SUPPORT_CONSTRUCTOR QImage(uchar *data, int w, int h, int depth, int pbl, const QRgb *colortable, int numColors, Endian bitOrder); -#endif - inline QT3_SUPPORT Endian bitOrder() const { - Format f = format(); - return f == Format_Mono ? BigEndian : (f == Format_MonoLSB ? LittleEndian : IgnoreEndian); - } - QT3_SUPPORT QImage convertDepth(int, Qt::ImageConversionFlags flags = Qt::AutoColor) const; - QT3_SUPPORT QImage convertDepthWithPalette(int, QRgb* p, int pc, Qt::ImageConversionFlags flags = Qt::AutoColor) const; - QT3_SUPPORT QImage convertBitOrder(Endian) const; - QT3_SUPPORT bool hasAlphaBuffer() const; - QT3_SUPPORT void setAlphaBuffer(bool); - QT3_SUPPORT uchar **jumpTable(); - QT3_SUPPORT const uchar * const *jumpTable() const; - inline QT3_SUPPORT void reset() { *this = QImage(); } - static inline QT3_SUPPORT Endian systemByteOrder() - { return QSysInfo::ByteOrder == QSysInfo::BigEndian ? BigEndian : LittleEndian; } - inline QT3_SUPPORT QImage swapRGB() const { return rgbSwapped(); } - inline QT3_SUPPORT QImage mirror(bool horizontally = false, bool vertically = true) const - { return mirrored(horizontally, vertically); } - QT3_SUPPORT bool create(const QSize&, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - QT3_SUPPORT bool create(int width, int height, int depth, int numColors=0, Endian bitOrder=IgnoreEndian); - inline QT3_SUPPORT QImage xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - inline QT3_SUPPORT QImage smoothScale(int w, int h, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const - { return scaled(QSize(w, h), mode, Qt::SmoothTransformation); } - inline QImage QT3_SUPPORT smoothScale(const QSize &s, Qt::AspectRatioMode mode = Qt::IgnoreAspectRatio) const - { return scaled(s, mode, Qt::SmoothTransformation); } - inline QT3_SUPPORT QImage scaleWidth(int w) const { return scaledToWidth(w); } - inline QT3_SUPPORT QImage scaleHeight(int h) const { return scaledToHeight(h); } - inline QT3_SUPPORT void invertPixels(bool invertAlpha) { invertAlpha ? invertPixels(InvertRgba) : invertPixels(InvertRgb); } - inline QT3_SUPPORT QImage copy(int x, int y, int w, int h, Qt::ImageConversionFlags) const - { return copy(QRect(x, y, w, h)); } - inline QT3_SUPPORT QImage copy(const QRect &rect, Qt::ImageConversionFlags) const - { return copy(rect); } - static QT3_SUPPORT Endian systemBitOrder(); - inline QT3_SUPPORT_CONSTRUCTOR QImage(const QByteArray &data) - { d = 0; *this = QImage::fromData(data); } -#endif - protected: virtual int metric(PaintDeviceMetric metric) const; @@ -362,11 +318,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QImage &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QImage &); #endif -#ifdef QT3_SUPPORT -Q_GUI_EXPORT QT3_SUPPORT void bitBlt(QImage* dst, int dx, int dy, const QImage* src, - int sx=0, int sy=0, int sw=-1, int sh=-1, Qt::ImageConversionFlags flags = Qt::AutoColor); -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index db6620b39c..93ab8a78ba 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -79,9 +79,6 @@ struct Q_GUI_EXPORT QImageData { // internal image data int nbytes; // number of bytes data QVector<QRgb> colortable; uchar *data; -#ifdef QT3_SUPPORT - uchar **jumptable; -#endif QImage::Format format; int bytes_per_line; int ser_no; // serial number diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index b64df29c41..98fcf68ee6 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -51,11 +51,6 @@ #include <QtCore/qobject.h> #include <QtGui/qimagereader.h> -#ifdef QT3_SUPPORT -#include <QtGui/qimage.h> -#include <QtGui/qpixmap.h> -#endif - QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -151,21 +146,6 @@ public Q_SLOTS: private: Q_DISABLE_COPY(QMovie) Q_PRIVATE_SLOT(d_func(), void _q_loadNextFrame()) - -#ifdef QT3_SUPPORT -public: - inline QT3_SUPPORT bool isNull() const { return isValid(); } - inline QT3_SUPPORT int frameNumber() const { return currentFrameNumber(); } - inline QT3_SUPPORT bool running() const { return state() == Running; } - inline QT3_SUPPORT bool paused() const { return state() == Paused; } - inline QT3_SUPPORT bool finished() const { return state() == NotRunning; } - inline QT3_SUPPORT void restart() { stop(); start(); } - inline QT3_SUPPORT QImage frameImage() const { return currentImage(); } - inline QT3_SUPPORT QPixmap framePixmap() const { return currentPixmap(); } - inline QT3_SUPPORT void step() { jumpToNextFrame(); } - inline QT3_SUPPORT void pause() { setPaused(true); } - inline QT3_SUPPORT void unpause() { setPaused(false); } -#endif }; QT_END_NAMESPACE diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index c478ed962e..3bcd87e5a0 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -104,9 +104,6 @@ protected: QPicture(QPicturePrivate &data); int metric(PaintDeviceMetric m) const; -#ifdef QT3_SUPPORT - inline QT3_SUPPORT QPicture copy() const { QPicture p(*this); p.detach(); return p; } -#endif private: bool exec(QPainter *p, QDataStream &ds, int i); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index aee1f2bc03..a9f2353dd4 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -640,65 +640,6 @@ int QPixmap::depth() const pixmap = pixmap.copy(QRect(QPoint(0, 0), size)); \endcode */ -#ifdef QT3_SUPPORT -void QPixmap::resize_helper(const QSize &s) -{ - int w = s.width(); - int h = s.height(); - if (w < 1 || h < 1) { - *this = QPixmap(); - return; - } - - if (size() == s) - return; - - // QPixmap.data member may be QRuntimePixmapData so use pixmapData() function to get - // the actual underlaying runtime pixmap data. - QPixmapData *pd = pixmapData(); - - // Create new pixmap - QPixmap pm(QSize(w, h), pd ? pd->type : QPixmapData::PixmapType); - bool uninit = false; -#if defined(Q_WS_X11) - QX11PixmapData *x11Data = pd && pd->classId() == QPixmapData::X11Class ? static_cast<QX11PixmapData*>(pd) : 0; - if (x11Data) { - pm.x11SetScreen(x11Data->xinfo.screen()); - uninit = x11Data->flags & QX11PixmapData::Uninitialized; - } -#elif defined(Q_WS_MAC) - QMacPixmapData *macData = pd && pd->classId() == QPixmapData::MacClass ? static_cast<QMacPixmapData*>(pd) : 0; - if (macData) - uninit = macData->uninit; -#endif - if (!uninit && !isNull()) { - // Copy old pixmap - if (hasAlphaChannel()) - pm.fill(Qt::transparent); - QPainter p(&pm); - p.drawPixmap(0, 0, *this, 0, 0, qMin(width(), w), qMin(height(), h)); - } - -#if defined(Q_WS_X11) - if (x11Data && x11Data->x11_mask) { - QPixmapData *newPd = pm.pixmapData(); - QX11PixmapData *pmData = (newPd && newPd->classId() == QPixmapData::X11Class) - ? static_cast<QX11PixmapData*>(newPd) : 0; - if (pmData) { - pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display, - RootWindow(x11Data->xinfo.display(), - x11Data->xinfo.screen()), - w, h, 1); - GC gc = XCreateGC(X11->display, pmData->x11_mask, 0, 0); - XCopyArea(X11->display, x11Data->x11_mask, pmData->x11_mask, gc, 0, 0, - qMin(width(), w), qMin(height(), h), 0, 0); - XFreeGC(X11->display, gc); - } - } -#endif - *this = pm; -} -#endif /*! \fn void QPixmap::resize(int width, int height) @@ -1226,104 +1167,6 @@ Qt::HANDLE QPixmap::handle() const #endif -#ifdef QT3_SUPPORT -static Qt::ImageConversionFlags colorModeToFlags(QPixmap::ColorMode mode) -{ - Qt::ImageConversionFlags flags = Qt::AutoColor; - switch (mode) { - case QPixmap::Color: - flags |= Qt::ColorOnly; - break; - case QPixmap::Mono: - flags |= Qt::MonoOnly; - break; - default: - break;// Nothing. - } - return flags; -} - -/*! - Use the constructor that takes a Qt::ImageConversionFlag instead. -*/ - -QPixmap::QPixmap(const QString& fileName, const char *format, ColorMode mode) - : QPaintDevice() -{ - init(0, 0, QPixmapData::PixmapType); - if (!qt_pixmap_thread_test()) - return; - - load(fileName, format, colorModeToFlags(mode)); -} - -/*! - Constructs a pixmap from the QImage \a image. - - Use the static fromImage() function instead. -*/ -QPixmap::QPixmap(const QImage& image) - : QPaintDevice() -{ - init(0, 0, QPixmapData::PixmapType); - if (!qt_pixmap_thread_test()) - return; - - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); -} - -/*! - \overload - - Converts the given \a image to a pixmap that is assigned to this - pixmap. - - Use the static fromImage() function instead. -*/ - -QPixmap &QPixmap::operator=(const QImage &image) -{ - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image); - else - *this = fromImage(image); - return *this; -} - -/*! - Use the load() function that takes a Qt::ImageConversionFlag instead. -*/ - -bool QPixmap::load(const QString &fileName, const char *format, ColorMode mode) -{ - return load(fileName, format, colorModeToFlags(mode)); -} - -/*! - Use the loadFromData() function that takes a Qt::ImageConversionFlag instead. -*/ - -bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, ColorMode mode) -{ - return loadFromData(buf, len, format, colorModeToFlags(mode)); -} - -/*! - Use the static fromImage() function instead. -*/ -bool QPixmap::convertFromImage(const QImage &image, ColorMode mode) -{ - if (data && data->pixelType() == QPixmapData::BitmapType) - *this = QBitmap::fromImage(image, colorModeToFlags(mode)); - else - *this = fromImage(image, colorModeToFlags(mode)); - return !isNull(); -} - -#endif /***************************************************************************** QPixmap stream functions @@ -1369,34 +1212,6 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) #endif // QT_NO_DATASTREAM -#ifdef QT3_SUPPORT -Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, - const QPixmap *src, int sx, int sy, int sw, int sh) -{ - Q_ASSERT_X(dst, "::copyBlt", "Destination pixmap must be non-null"); - Q_ASSERT_X(src, "::copyBlt", "Source pixmap must be non-null"); - - if (src->hasAlphaChannel()) { - if (dst->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) { - QPainter p(dst); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - } else { - QImage image = dst->toImage().convertToFormat(QImage::Format_ARGB32_Premultiplied); - QPainter p(&image); - p.setCompositionMode(QPainter::CompositionMode_Source); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - p.end(); - *dst = QPixmap::fromImage(image); - } - } else { - QPainter p(dst); - p.drawPixmap(dx, dy, *src, sx, sy, sw, sh); - } - -} -#endif - /*! \internal */ diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index f2e79c14f4..77f06b060b 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -224,26 +224,6 @@ public: protected: int metric(PaintDeviceMetric) const; -#ifdef QT3_SUPPORT -public: - enum ColorMode { Auto, Color, Mono }; - QT3_SUPPORT_CONSTRUCTOR QPixmap(const QString& fileName, const char *format, ColorMode mode); - QT3_SUPPORT bool load(const QString& fileName, const char *format, ColorMode mode); - QT3_SUPPORT bool loadFromData(const uchar *buf, uint len, const char* format, ColorMode mode); - QT3_SUPPORT_CONSTRUCTOR QPixmap(const QImage& image); - QT3_SUPPORT QPixmap &operator=(const QImage &); - inline QT3_SUPPORT QImage convertToImage() const { return toImage(); } - QT3_SUPPORT bool convertFromImage(const QImage &, ColorMode mode); - inline QT3_SUPPORT operator QImage() const { return toImage(); } - inline QT3_SUPPORT QPixmap xForm(const QMatrix &matrix) const { return transformed(QTransform(matrix)); } - inline QT3_SUPPORT bool selfMask() const { return false; } -private: - void resize_helper(const QSize &s); -public: - inline QT3_SUPPORT void resize(const QSize &s) { resize_helper(s); } - inline QT3_SUPPORT void resize(int width, int height) { resize_helper(QSize(width, height)); } -#endif - private: QExplicitlySharedDataPointer<QPixmapData> data; @@ -320,14 +300,6 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPixmap &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPixmap &); #endif -/***************************************************************************** - QPixmap (and QImage) helper functions -*****************************************************************************/ -#ifdef QT3_SUPPORT -QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, const QPixmap *src, - int sx=0, int sy=0, int sw=-1, int sh=-1); -#endif // QT3_SUPPORT - QT_END_NAMESPACE QT_END_HEADER |