summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image/qimage.cpp')
-rw-r--r--src/gui/image/qimage.cpp93
1 files changed, 0 insertions, 93 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 5460104fd0..8175ef42c1 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4314,99 +4314,6 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
painter.drawImage(rect(), sourceImage);
}
-
-#if QT_DEPRECATED_SINCE(5, 15)
-/*!
- \obsolete
-
- Returns the alpha channel of the image as a new grayscale QImage in which
- each pixel's red, green, and blue values are given the alpha value of the
- original image. The color depth of the returned image is 8-bit.
-
- You can see an example of use of this function in QPixmap's
- \l{QPixmap::}{alphaChannel()}, which works in the same way as
- this function on QPixmaps.
-
- Most usecases for this function can be replaced with QPainter and
- using composition modes.
-
- Note this returns a color-indexed image if you want the alpha channel in
- the alpha8 format instead use convertToFormat(Format_Alpha8) on the source
- image.
-
- \warning This is an expensive function.
-
- \sa setAlphaChannel(), hasAlphaChannel(), convertToFormat(),
- {QPixmap#Pixmap Information}{Pixmap},
- {QImage#Image Transformations}{Image Transformations}
-*/
-
-QImage QImage::alphaChannel() const
-{
- if (!d)
- return QImage();
-
- int w = d->width;
- int h = d->height;
-
- QImage image(w, h, Format_Indexed8);
- image.setColorCount(256);
-
- // set up gray scale table.
- for (int i=0; i<256; ++i)
- image.setColor(i, qRgb(i, i, i));
-
- if (!hasAlphaChannel()) {
- image.fill(255);
- return image;
- }
-
- if (d->format == Format_Indexed8) {
- const uchar *src_data = d->data;
- uchar *dest_data = image.d->data;
- for (int y=0; y<h; ++y) {
- const uchar *src = src_data;
- uchar *dest = dest_data;
- for (int x=0; x<w; ++x) {
- *dest = qAlpha(d->colortable.at(*src));
- ++dest;
- ++src;
- }
- src_data += d->bytes_per_line;
- dest_data += image.d->bytes_per_line;
- }
- } else if (d->format == Format_Alpha8) {
- const uchar *src_data = d->data;
- uchar *dest_data = image.d->data;
- memcpy(dest_data, src_data, d->bytes_per_line * h);
- } else {
- QImage alpha32 = *this;
- bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied);
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- canSkipConversion = canSkipConversion || (d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied);
-#endif
- if (!canSkipConversion)
- alpha32 = convertToFormat(Format_ARGB32);
-
- const uchar *src_data = alpha32.d->data;
- uchar *dest_data = image.d->data;
- for (int y=0; y<h; ++y) {
- const QRgb *src = (const QRgb *) src_data;
- uchar *dest = dest_data;
- for (int x=0; x<w; ++x) {
- *dest = qAlpha(*src);
- ++dest;
- ++src;
- }
- src_data += alpha32.d->bytes_per_line;
- dest_data += image.d->bytes_per_line;
- }
- }
-
- return image;
-}
-#endif
-
/*!
Returns \c true if the image has a format that respects the alpha
channel, otherwise returns \c false.