diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-07-24 09:45:33 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-07-27 13:04:30 (GMT) |
commit | 3643028959f0b38350e57e60ba4000435b75e592 (patch) | |
tree | c129e4dee11487abd437ab8ebd993ba261e06fa6 /src/gui/image/qpixmap.cpp | |
parent | cf66c667a97c0079141eb3f2d9e997b7378ae792 (diff) | |
parent | c36139c665e61866aff4bf8572890a735167a7d0 (diff) | |
download | Qt-3643028959f0b38350e57e60ba4000435b75e592.zip Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.gz Qt-3643028959f0b38350e57e60ba4000435b75e592.tar.bz2 |
Merge commit 'qt/master-stable'
Conflicts:
configure.exe
qmake/Makefile.unix
qmake/generators/makefile.cpp
src/corelib/global/qglobal.h
src/corelib/kernel/kernel.pri
src/corelib/kernel/qcoreevent.cpp
src/corelib/kernel/qsharedmemory_unix.cpp
src/gui/graphicsview/qgraphicsscene.cpp
src/gui/kernel/qaction.cpp
src/gui/kernel/qaction.h
src/gui/kernel/qaction_p.h
src/gui/kernel/qapplication.cpp
src/gui/kernel/qapplication.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget.h
src/gui/kernel/qwidget_mac.mm
src/gui/painting/qgraphicssystemfactory.cpp
src/gui/styles/qwindowsstyle.cpp
src/gui/text/qfontengine_qpf.cpp
src/gui/widgets/qabstractscrollarea_p.h
src/network/access/qnetworkaccessdebugpipebackend.cpp
src/network/socket/qlocalsocket_unix.cpp
src/network/socket/qnativesocketengine_p.h
src/network/socket/qnativesocketengine_unix.cpp
src/openvg/qpaintengine_vg.cpp
tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
tests/auto/qcssparser/qcssparser.pro
tests/auto/qdir/tst_qdir.cpp
tests/auto/qfile/tst_qfile.cpp
tests/auto/qobject/tst_qobject.cpp
tests/auto/qpathclipper/qpathclipper.pro
tests/auto/qprocess/tst_qprocess.cpp
tests/auto/qsettings/tst_qsettings.cpp
tests/auto/qsharedpointer/qsharedpointer.pro
tests/auto/qsqlquerymodel/qsqlquerymodel.pro
tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro
tests/auto/qsqltablemodel/qsqltablemodel.pro
tests/auto/qsqlthread/qsqlthread.pro
tests/auto/qwidget/tst_qwidget.cpp
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 77 |
1 files changed, 39 insertions, 38 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index a3b2343..12287d3 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -384,6 +384,7 @@ QPixmap QPixmap::copy(const QRect &rect) const /*! \fn QPixmap::scroll(int dx, int dy, int x, int y, int width, int height, QRegion *exposed) + \since 4.6 This convenience function is equivalent to calling QPixmap::scroll(\a dx, \a dy, QRect(\a x, \a y, \a width, \a height), \a exposed). @@ -392,6 +393,8 @@ QPixmap QPixmap::copy(const QRect &rect) const */ /*! + \since 4.6 + Scrolls the area \a rect of this pixmap by (\a dx, \a dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is \a exposed by the scroll operation. @@ -1573,24 +1576,24 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) designed and optimized for showing images on screen. QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1. The isQBitmap() function returns true if a QPixmap object is - really a bitmap, otherwise returns false. Finally, the QPicture class is a - paint device that records and replays QPainter commands. + really a bitmap, otherwise returns false. Finally, the QPicture class + is a paint device that records and replays QPainter commands. A QPixmap can easily be displayed on the screen using QLabel or one of QAbstractButton's subclasses (such as QPushButton and QToolButton). QLabel has a pixmap property, whereas - QAbstractButton has an icon property. And because QPixmap is a - QPaintDevice subclass, QPainter can be used to draw directly onto - pixmaps. + QAbstractButton has an icon property. In addition to the ordinary constructors, a QPixmap can be constructed using the static grabWidget() and grabWindow() functions which creates a QPixmap and paints the given widget, or - window, in it. + window, into it. + + QPixmap objects can be passed around by value since the QPixmap + class uses implicit data sharing. For more information, see the \l + {Implicit Data Sharing} documentation. QPixmap objects can also be + streamed. - Note that the pixel data in a pixmap is internal and is managed by - the underlying window system. Pixels can only be accessed through - QPainter functions or by converting the QPixmap to a QImage. Depending on the system, QPixmap is stored using a RGB32 or a premultiplied alpha format. If the image has an alpha channel, and if the system allows, the preferred format is premultiplied alpha. @@ -1601,6 +1604,13 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) QPixmap are stored on the client side and don't use any GDI resources). + Note that the pixel data in a pixmap is internal and is managed by + the underlying window system. Because QPixmap is a QPaintDevice + subclass, QPainter can be used to draw directly onto pixmaps. + Pixels can only be accessed through QPainter functions or by + converting the QPixmap to a QImage. However, the fill() function + is available for initializing the entire pixmap with a given color. + There are functions to convert between QImage and QPixmap. Typically, the QImage class is used to load an image file, optionally manipulating the image data, before the QImage @@ -1615,11 +1625,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) there are several functions that enables transformation of the pixmap. - QPixmap objects can be passed around by value since the QPixmap - class uses implicit data sharing. For more information, see the \l - {Implicit Data Sharing} documentation. QPixmap objects can also be - streamed. - \tableofcontents \section1 Reading and Writing Image Files @@ -1676,12 +1681,15 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) The hasAlphaChannel() returns true if the pixmap has a format that respects the alpha channel, otherwise returns false, while the hasAlpha() function returns true if the pixmap has an alpha - channel \e or a mask (otherwise false). + channel \e or a mask (otherwise false). The mask() function returns + the mask as a QBitmap object, which can be set using setMask(). - The alphaChannel() function returns the alpha channel as a new - QPixmap object, while the mask() function returns the mask as a - QBitmap object. The alpha channel and mask can be set using the - setAlphaChannel() and setMask() functions, respectively. + The createHeuristicMask() function creates and returns a 1-bpp + heuristic mask (i.e. a QBitmap) for this pixmap. It works by + selecting a color from one of the corners and then chipping away + pixels of that color, starting at all the edges. The + createMaskFromColor() function creates and returns a mask (i.e. a + QBitmap) for the pixmap based on a given color. \row \o Low-level information @@ -1719,14 +1727,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) \section1 Pixmap Transformations QPixmap supports a number of functions for creating a new pixmap - that is a transformed version of the original: The - createHeuristicMask() function creates and returns a 1-bpp - heuristic mask (i.e. a QBitmap) for this pixmap. It works by - selecting a color from one of the corners and then chipping away - pixels of that color, starting at all the edges. The - createMaskFromColor() function creates and returns a mask (i.e. a - QBitmap) for the pixmap based on a given color. - + that is a transformed version of the original: The scaled(), scaledToWidth() and scaledToHeight() functions return scaled copies of the pixmap, while the copy() function @@ -1741,11 +1742,6 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) function returns the actual matrix used for transforming the pixmap. - There are also functions for changing attributes of a pixmap. - in-place: The fill() function fills the entire image with the - given color, the setMask() function sets a mask bitmap, and the - setAlphaChannel() function sets the pixmap's alpha channel. - \sa QBitmap, QImage, QImageReader, QImageWriter */ @@ -1764,7 +1760,7 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) Returns true if this pixmap has an alpha channel, \e or has a mask, otherwise returns false. - \sa hasAlphaChannel(), alphaChannel(), mask() + \sa hasAlphaChannel(), mask() */ bool QPixmap::hasAlpha() const { @@ -1775,7 +1771,7 @@ bool QPixmap::hasAlpha() const Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false. - \sa alphaChannel(), hasAlpha() + \sa hasAlpha() */ bool QPixmap::hasAlphaChannel() const { @@ -1783,7 +1779,7 @@ bool QPixmap::hasAlphaChannel() const } /*! - \reimp + \internal */ int QPixmap::metric(PaintDeviceMetric metric) const { @@ -1792,6 +1788,7 @@ int QPixmap::metric(PaintDeviceMetric metric) const /*! \fn void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) + \obsolete Sets the alpha channel of this pixmap to the given \a alphaChannel by converting the \a alphaChannel into 32 bit and using the @@ -1829,6 +1826,8 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) } /*! + \obsolete + Returns the alpha channel of the pixmap as a new grayscale QPixmap in which each pixel's red, green, and blue values are given the alpha value of the original pixmap. The color depth of the returned pixmap is the system depth @@ -1847,7 +1846,9 @@ void QPixmap::setAlphaChannel(const QPixmap &alphaChannel) \image alphachannelimage.png The pixmap and channelImage QPixmaps \warning This is an expensive operation. The alpha channel of the - pixmap is extracted dynamically from the pixeldata. + pixmap is extracted dynamically from the pixeldata. Most usecases of this + function are covered by QPainter and compositionModes which will normally + execute faster. \sa setAlphaChannel(), {QPixmap#Pixmap Information}{Pixmap Information} @@ -1858,7 +1859,7 @@ QPixmap QPixmap::alphaChannel() const } /*! - \reimp + \internal */ QPaintEngine *QPixmap::paintEngine() const { @@ -1868,7 +1869,7 @@ QPaintEngine *QPixmap::paintEngine() const /*! \fn QBitmap QPixmap::mask() const - Extracts a bitmap mask from the pixmap's alphachannel. + Extracts a bitmap mask from the pixmap's alpha channel. \warning This is potentially an expensive operation. The mask of the pixmap is extracted dynamically from the pixeldata. |