Qt 3 Support Members for QPixmapThe following class members are part of the Qt 3 support layer. They are provided to help you port old code to Qt 4. We advise against using them in new code. Public Types
Public Functions
Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QPixmap::Auto | 0 | Select Color or Mono on a case-by-case basis. |
QPixmap::Color | 1 | Always create colored pixmaps. |
QPixmap::Mono | 2 | Always create bitmaps. |
Use the constructor that takes a Qt::ImageConversionFlag instead.
Constructs a pixmap from the QImage image.
Use the static fromImage() function instead.
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 on X11 and 8-bit on Windows and Mac OS X.
You can use this function while debugging to get a visible image of the alpha channel. If the pixmap doesn't have an alpha channel, i.e., the alpha channel's value for all pixels equals 0xff), a null pixmap is returned. You can check this with the isNull() function.
We show an example:
pixmap = QPixmap(100, 100); pixmap.fill(Qt::transparent); QRadialGradient gradient(50, 50, 50, 50, 50); gradient.setColorAt(0, QColor::fromRgbF(1, 0, 0, 1)); gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0)); QPainter painter(&pixmap); painter.fillRect(0, 0, 100, 100, gradient); channelImage = pixmap.alphaChannel(); update();
Warning: This is an expensive operation. The alpha channel of the pixmap is extracted dynamically from the pixeldata. Most usecases of this function are covered by QPainter and compositionModes which will normally execute faster.
See also setAlphaChannel() and Pixmap Information.
Use the static fromImage() function instead.
Use the toImage() function instead.
Use the load() function that takes a Qt::ImageConversionFlag instead.
Use the loadFromData() function that takes a Qt::ImageConversionFlag instead.
Use QPixmap::copy() instead to get the pixmap with the new size.
For example, if you have code like
pixmap.resize(10, 20);
you can rewrite it as
pixmap = pixmap.copy(0, 0, 10, 20);
This is an overloaded function.
Use QPixmap::copy() instead to get the pixmap with the new size.
For example, if you have code like
pixmap.resize(size);
you can rewrite it as
pixmap = pixmap.copy(QRect(QPoint(0, 0), size));
Returns whether the pixmap is its own mask or not.
This function is no longer relevant since the concept of self masking doesn't exists anymore.
Returns a number that identifies the contents of this QPixmap object. Distinct QPixmap objects can only have the same serial number if they refer to the same contents (but they don't have to).
Use cacheKey() instead.
Warning: The serial number doesn't necessarily change when the pixmap is altered. This means that it may be dangerous to use it as a cache key. For caching pixmaps, we recommend using the QPixmapCache class whenever possible.
Sets the alpha channel of this pixmap to the given alphaChannel by converting the alphaChannel into 32 bit and using the intensity of the RGB pixel values.
The effect of this function is undefined when the pixmap is being painted on.
Warning: This is potentially an expensive operation. Most usecases for this function are covered by QPainter and compositionModes which will normally execute faster.
See also alphaChannel() and Pixmap Transformations.
Use transformed() instead.
Returns the pixmap as a QImage.
Use the toImage() function instead.
This is an overloaded function.
Converts the given image to a pixmap that is assigned to this pixmap.
Use the static fromImage() function instead.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt 4.8 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com