Qt 4.8
|
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device. More...
#include <qimage.h>
Public Types | |
typedef QImageData * | DataPtr |
enum | Format { Format_Invalid, Format_Mono, Format_MonoLSB, Format_Indexed8, Format_RGB32, Format_ARGB32, Format_ARGB32_Premultiplied, Format_RGB16, Format_ARGB8565_Premultiplied, Format_RGB666, Format_ARGB6666_Premultiplied, Format_RGB555, Format_ARGB8555_Premultiplied, Format_RGB888, Format_RGB444, Format_ARGB4444_Premultiplied } |
The following image formats are available in Qt. More... | |
enum | InvertMode { InvertRgb, InvertRgba } |
This enum type is used to describe how pixel values should be inverted in the invertPixels() function. More... | |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric { PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM, PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY, PdmPhysicalDpiX, PdmPhysicalDpiY } |
Public Functions | |
bool | allGray () const |
Returns true if all the colors in the image are shades of gray (i.e. More... | |
QImage | alphaChannel () const |
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. More... | |
int | bitPlaneCount () const |
Returns the number of bit planes in the image. More... | |
uchar * | bits () |
Returns a pointer to the first pixel data. More... | |
const uchar * | bits () const |
Note that QImage uses Implicit Data Sharing {implicit data sharing}, but this function does not perform a deep copy of the shared pixel data, because the returned data is const. More... | |
int | byteCount () const |
Returns the number of bytes occupied by the image data. More... | |
int | bytesPerLine () const |
Returns the number of bytes per image scanline. More... | |
qint64 | cacheKey () const |
Returns a number that identifies the contents of this QImage object. More... | |
QRgb | color (int i) const |
Returns the color in the color table at index i. More... | |
int | colorCount () const |
Returns the size of the color table for the image. More... | |
QVector< QRgb > | colorTable () const |
Returns a list of the colors contained in the image's color table, or an empty list if the image does not have a color table. More... | |
const uchar * | constBits () const |
Returns a pointer to the first pixel data. More... | |
const uchar * | constScanLine (int) const |
Returns a pointer to the pixel data at the scanline with index i. More... | |
QImage | convertToFormat (Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT |
Returns a copy of the image in the given format. More... | |
QImage | convertToFormat (Format f, const QVector< QRgb > &colorTable, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT |
Returns a copy of the image converted to the given format, using the specified colorTable. More... | |
QImage | copy (const QRect &rect=QRect()) const |
Returns a sub-area of the image as a new image. More... | |
QImage | copy (int x, int y, int w, int h) const |
The returned image is copied from the position (x, y) in this image, and will always have the given width and height. More... | |
QImage | createAlphaMask (Qt::ImageConversionFlags flags=Qt::AutoColor) const |
Builds and returns a 1-bpp mask from the alpha buffer in this image. More... | |
QImage | createHeuristicMask (bool clipTight=true) const |
Creates and returns a 1-bpp heuristic mask for this image. More... | |
QImage | createMaskFromColor (QRgb color, Qt::MaskMode mode=Qt::MaskInColor) const |
Creates and returns a mask for this image based on the given color value. More... | |
DataPtr & | data_ptr () |
int | depth () const |
Returns the depth of the image. More... | |
void | detach () |
If multiple images share common data, this image makes a copy of the data and detaches itself from the sharing mechanism, making sure that this image is the only one referring to the data. More... | |
int | devType () const |
int | dotsPerMeterX () const |
Returns the number of pixels that fit horizontally in a physical meter. More... | |
int | dotsPerMeterY () const |
Returns the number of pixels that fit vertically in a physical meter. More... | |
void | fill (uint pixel) |
Fills the entire image with the given pixelValue. More... | |
void | fill (const QColor &color) |
Fills the entire image with the given color. More... | |
void | fill (Qt::GlobalColor color) |
Fills the image with the given color, described as a standard global color. More... | |
Format | format () const |
Returns the format of the image. More... | |
bool | hasAlphaChannel () const |
Returns true if the image has a format that respects the alpha channel, otherwise returns false. More... | |
int | height () const |
Returns the height of the image. More... | |
void | invertPixels (InvertMode=InvertRgb) |
Inverts all pixel values in the image. More... | |
bool | isDetached () const |
Returns true if the image is detached; otherwise returns false. More... | |
bool | isGrayscale () const |
For 32-bit images, this function is equivalent to allGray(). More... | |
bool | isNull () const |
Returns true if it is a null image, otherwise returns false. More... | |
bool | load (QIODevice *device, const char *format) |
This function reads a QImage from the given device. More... | |
bool | load (const QString &fileName, const char *format=0) |
Loads an image from the file with the given fileName. More... | |
bool | loadFromData (const uchar *buf, int len, const char *format=0) |
Loads an image from the first len bytes of the given binary data. More... | |
bool | loadFromData (const QByteArray &data, const char *aformat=0) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads an image from the given QByteArray data. More... | |
QImage | mirrored (bool horizontally=false, bool vertically=true) const |
Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false. More... | |
QT_DEPRECATED int | numBytes () const |
Returns the number of bytes occupied by the image data. More... | |
QT_DEPRECATED int | numColors () const |
Returns the size of the color table for the image. More... | |
QPoint | offset () const |
Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images. More... | |
operator QVariant () const | |
Returns the image as a QVariant. More... | |
bool | operator!= (const QImage &) const |
Returns true if this image and the given image have different contents; otherwise returns false. More... | |
QImage & | operator= (const QImage &) |
Assigns a shallow copy of the given image to this image and returns a reference to this image. More... | |
bool | operator== (const QImage &) const |
Returns true if this image and the given image have the same contents; otherwise returns false. More... | |
QPaintEngine * | paintEngine () const |
Used by QPainter to retrieve a paint engine for the image. More... | |
QRgb | pixel (int x, int y) const |
Returns the color of the pixel at coordinates (x, y). More... | |
QRgb | pixel (const QPoint &pt) const |
Returns the color of the pixel at the given position. More... | |
int | pixelIndex (int x, int y) const |
Returns the pixel index at (x, y). More... | |
int | pixelIndex (const QPoint &pt) const |
Returns the pixel index at the given position. More... | |
QImage () | |
Constructs a null image. More... | |
QImage (const QSize &size, Format format) | |
Constructs an image with the given size and format. More... | |
QImage (int width, int height, Format format) | |
Constructs an image with the given width, height and format. More... | |
QImage (uchar *data, int width, int height, Format format) | |
Constructs an image with the given width, height and format, that uses an existing memory buffer, data. More... | |
QImage (const uchar *data, int width, int height, Format format) | |
Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data. More... | |
QImage (uchar *data, int width, int height, int bytesPerLine, Format format) | |
Constructs an image with the given width, height and format, that uses an existing memory buffer, data. More... | |
QImage (const uchar *data, int width, int height, int bytesPerLine, Format format) | |
Constructs an image with the given width, height and format, that uses an existing memory buffer, data. More... | |
QImage (const char *const xpm[]) | |
Constructs an image from the given xpm image. More... | |
QImage (const QString &fileName, const char *format=0) | |
Constructs an image and tries to load the image from the file with the given fileName. More... | |
QImage (const char *fileName, const char *format=0) | |
Constructs an image and tries to load the image from the file with the given fileName. More... | |
QImage (const QImage &) | |
Constructs a shallow copy of the given image. More... | |
QRect | rect () const |
Returns the enclosing rectangle (0, 0, width(), height()) of the image. More... | |
QImage | rgbSwapped () const |
Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to an BGR image. More... | |
bool | save (const QString &fileName, const char *format=0, int quality=-1) const |
Saves the image to the file with the given fileName, using the given image file format and quality factor. More... | |
bool | save (QIODevice *device, const char *format=0, int quality=-1) const |
This function writes a QImage to the given device. More... | |
QImage | scaled (int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const |
QImage | scaled (const QSize &s, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const |
QImage | scaledToHeight (int h, Qt::TransformationMode mode=Qt::FastTransformation) const |
Returns a scaled copy of the image. More... | |
QImage | scaledToWidth (int w, Qt::TransformationMode mode=Qt::FastTransformation) const |
Returns a scaled copy of the image. More... | |
uchar * | scanLine (int) |
Returns a pointer to the pixel data at the scanline with index i. More... | |
const uchar * | scanLine (int) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More... | |
int | serialNumber () const |
Returns a number that identifies the contents of this QImage object. More... | |
void | setAlphaChannel (const QImage &alphaChannel) |
Sets the alpha channel of this image to the given alphaChannel. More... | |
void | setColor (int i, QRgb c) |
Sets the color at the given index in the color table, to the given to colorValue. More... | |
void | setColorCount (int) |
Resizes the color table to contain colorCount entries. More... | |
void | setColorTable (const QVector< QRgb > colors) |
Sets the color table used to translate color indexes to QRgb values, to the specified colors. More... | |
void | setDotsPerMeterX (int) |
Sets the number of pixels that fit horizontally in a physical meter, to x. More... | |
void | setDotsPerMeterY (int) |
Sets the number of pixels that fit vertically in a physical meter, to y. More... | |
QT_DEPRECATED void | setNumColors (int) |
Resizes the color table to contain numColors entries. More... | |
void | setOffset (const QPoint &) |
Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to offset. More... | |
void | setPixel (int x, int y, uint index_or_rgb) |
Sets the pixel index or color at (x, y) to index_or_rgb. More... | |
void | setPixel (const QPoint &pt, uint index_or_rgb) |
Sets the pixel index or color at the given position to index_or_rgb. More... | |
void | setText (const QString &key, const QString &value) |
Sets the image text to the given text and associate it with the given key. More... | |
QT_DEPRECATED void | setText (const char *key, const char *lang, const QString &) |
QSize | size () const |
Returns the size of the image, i. More... | |
void | swap (QImage &other) |
Swaps image other with this image. More... | |
QString | text (const QString &key=QString()) const |
Returns the image text associated with the given key. More... | |
QT_DEPRECATED QString | text (const char *key, const char *lang=0) const |
QT_DEPRECATED QString | text (const QImageTextKeyLang &) const |
Returns the text recorded for the given keywordAndLanguage. More... | |
QStringList | textKeys () const |
Returns the text keys for this image. More... | |
QT_DEPRECATED QStringList | textLanguages () const |
Returns the language identifiers for which some texts are recorded. More... | |
QT_DEPRECATED QList< QImageTextKeyLang > | textList () const |
Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set for this image. More... | |
QImage | transformed (const QMatrix &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const |
Returns a copy of the image that is transformed using the given transformation matrix and transformation mode. More... | |
QImage | transformed (const QTransform &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const |
Returns a copy of the image that is transformed using the given transformation matrix and transformation mode. More... | |
bool | valid (int x, int y) const |
Returns true if QPoint(x, y) is a valid coordinate pair within the image; otherwise returns false. More... | |
bool | valid (const QPoint &pt) const |
Returns true if pos is a valid coordinate pair within the image; otherwise returns false. More... | |
int | width () const |
Returns the width of the image. More... | |
~QImage () | |
Destroys the image and cleans up. More... | |
Public Functions inherited from QPaintDevice | |
int | colorCount () const |
int | depth () const |
virtual HDC | getDC () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
QT_DEPRECATED int | numColors () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
virtual void | releaseDC (HDC hdc) const |
int | width () const |
int | widthMM () const |
virtual | ~QPaintDevice () |
Static Public Functions | |
static QImage | fromData (const uchar *data, int size, const char *format=0) |
Constructs a QImage from the first size bytes of the given binary data. More... | |
static QImage | fromData (const QByteArray &data, const char *format=0) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads an image from the given QByteArray data. More... | |
static QMatrix | trueMatrix (const QMatrix &, int w, int h) |
Returns the actual matrix used for transforming an image with the given width, height and matrix. More... | |
static QTransform | trueMatrix (const QTransform &, int w, int h) |
Returns the actual matrix used for transforming an image with the given width, height and matrix. More... | |
Static Public Functions inherited from QPaintDevice | |
static QWSDisplay * | qwsDisplay () |
Protected Functions | |
virtual int | metric (PaintDeviceMetric metric) const |
Returns the size for the specified metric on the device. More... | |
Protected Functions inherited from QPaintDevice | |
QPaintDevice () | |
Properties | |
QImageData * | d |
Friends | |
class | QBlittablePixmapData |
class | QPixmapCacheEntry |
class | QRasterPixmapData |
const QVector< QRgb > * | qt_image_colortable (const QImage &image) |
Q_GUI_EXPORT qint64 | qt_image_id (const QImage &image) |
class | QWSOnScreenSurface |
Related Functions | |
(Note that these are not member functions.) | |
QDataStream & | operator<< (QDataStream &stream, const QImage &image) |
Writes the given image to the given stream as a PNG image, or as a BMP image if the stream's version is 1. More... | |
QDataStream & | operator>> (QDataStream &stream, QImage &image) |
Reads an image from the given stream and stores it in the given image. More... | |
Related Functions inherited from QPaintDevice | |
const Q_GUI_EXPORT QX11Info * | qt_x11Info (const QPaintDevice *pd) |
Returns the QX11Info structure for the pd paint device. More... | |
Additional Inherited Members | |
Protected Variables inherited from QPaintDevice | |
ushort | painters |
The QImage class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, and for direct pixel access and manipulation, while QPixmap is designed and optimized for showing images on screen. QBitmap is only a convenience class that inherits QPixmap, ensuring a depth of 1. Finally, the QPicture class is a paint device that records and replays QPainter commands.
Because QImage is a QPaintDevice subclass, QPainter can be used to draw directly onto images. When using QPainter on a QImage, the painting can be performed in another thread than the current GUI thread.
The QImage class supports several image formats described by the Format enum. These include monochrome, 8-bit, 32-bit and alpha-blended images which are available in all versions of Qt 4.x.
QImage provides a collection of functions that can be used to obtain a variety of information about the image. There are also several functions that enables transformation of the image.
QImage objects can be passed around by value since the QImage class uses Implicit Data Sharing{implicit data sharing}. QImage objects can also be streamed and compared.
QImage provides several ways of loading an image file: The file can be loaded when constructing the QImage object, or by using the load() or loadFromData() functions later on. QImage also provides the static fromData() function, constructing a QImage from the given data. When loading an image, the file name can either refer to an actual file on disk or to one of the application's embedded resources. See The Qt Resource System overview for details on how to embed images and other resource files in the application's executable.
Simply call the save() function to save a QImage object.
The complete list of supported file formats are available through the QImageReader::supportedImageFormats() and QImageWriter::supportedImageFormats() functions. New file formats can be added as plugins. By default, Qt supports the following formats:
Format | Description | Qt's support |
BMP | Windows Bitmap | Read/write |
GIF | Graphic Interchange Format (optional) | Read |
JPG | Joint Photographic Experts Group | Read/write |
JPEG | Joint Photographic Experts Group | Read/write |
PNG | Portable Network Graphics | Read/write |
PBM | Portable Bitmap | Read |
PGM | Portable Graymap | Read |
PPM | Portable Pixmap | Read/write |
TIFF | Tagged Image File Format | Read/write |
XBM | X11 Bitmap | Read/write |
XPM | X11 Pixmap | Read/write |
QImage provides a collection of functions that can be used to obtain a variety of information about the image:
Available Functions | |
Geometry | The size(), width(), height(), dotsPerMeterX(), and dotsPerMeterY() functions provide information about the image size and aspect ratio. The rect() function returns the image's enclosing rectangle. The valid() function tells if a given pair of coordinates is within this rectangle. The offset() function returns the number of pixels by which the image is intended to be offset by when positioned relative to other images, which also can be manipulated using the setOffset() function. |
Colors | The color of a pixel can be retrieved by passing its coordinates to the pixel() function. The pixel() function returns the color as a QRgb value indepedent of the image's format. In case of monochrome and 8-bit images, the colorCount() and colorTable() functions provide information about the color components used to store the image data: The colorTable() function returns the image's entire color table. To obtain a single entry, use the pixelIndex() function to retrieve the pixel index for a given pair of coordinates, then use the color() function to retrieve the color. Note that if you create an 8-bit image manually, you have to set a valid color table on the image as well. The hasAlphaChannel() function tells if the image's format respects the alpha channel, or not. The allGray() and isGrayscale() functions tell whether an image's colors are all shades of gray. See also the Pixel Manipulation and Image Transformations sections. |
Text | The text() function returns the image text associated with the given text key. An image's text keys can be retrieved using the textKeys() function. Use the setText() function to alter an image's text. |
Low-level information | The depth() function returns the depth of the image. The supported depths are 1 (monochrome), 8, 16, 24 and 32 bits. The bitPlaneCount() function tells how many of those bits that are used. For more information see the Image Formats section. The format(), bytesPerLine(), and byteCount() functions provide low-level information about the data stored in the image. The cacheKey() function returns a number that uniquely identifies the contents of this QImage object. |
The functions used to manipulate an image's pixels depend on the image format. The reason is that monochrome and 8-bit images are index-based and use a color lookup table, while 32-bit images store ARGB values directly. For more information on image formats, see the Image Formats section.
In case of a 32-bit image, the setPixel() function can be used to alter the color of the pixel at the given coordinates to any other color specified as an ARGB quadruplet. To make a suitable QRgb value, use the qRgb() (adding a default alpha component to the given RGB values, i.e. creating an opaque color) or qRgba() function. For example:
32-bit | |
In case of a 8-bit and monchrome images, the pixel value is only an index from the image's color table. So the setPixel() function can only be used to alter the color of the pixel at the given coordinates to a predefined color from the image's color table, i.e. it can only change the pixel's index value. To alter or add a color to an image's color table, use the setColor() function.
An entry in the color table is an ARGB quadruplet encoded as an QRgb value. Use the qRgb() and qRgba() functions to make a suitable QRgb value for use with the setColor() function. For example:
8-bit | |
QImage image(3, 3, QImage::Format_Indexed8); QRgb value; value = qRgb(122, 163, 39); // 0xff7aa327 image.setColor(0, value); value = qRgb(237, 187, 51); // 0xffedba31 image.setColor(1, value); value = qRgb(189, 149, 39); // 0xffbd9527 image.setColor(2, value); image.setPixel(0, 1, 0); image.setPixel(1, 0, 0); image.setPixel(1, 1, 2); image.setPixel(2, 1, 1); |
QImage also provide the scanLine() function which returns a pointer to the pixel data at the scanline with the given index, and the bits() function which returns a pointer to the first pixel data (this is equivalent to scanLine(0)
).
Each pixel stored in a QImage is represented by an integer. The size of the integer varies depending on the format. QImage supports several image formats described by the Format enum.
Monochrome images are stored using 1-bit indexes into a color table with at most two colors. There are two different types of monochrome images: big endian (MSB first) or little endian (LSB first) bit order.
8-bit images are stored using 8-bit indexes into a color table, i.e. they have a single byte per pixel. The color table is a QVector<QRgb>, and the QRgb typedef is equivalent to an unsigned int containing an ARGB quadruplet on the format 0xAARRGGBB.
32-bit images have no color table; instead, each pixel contains an QRgb value. There are three different types of 32-bit images storing RGB (i.e. 0xffRRGGBB), ARGB and premultiplied ARGB values respectively. In the premultiplied format the red, green, and blue channels are multiplied by the alpha component divided by 255.
An image's format can be retrieved using the format() function. Use the convertToFormat() functions to convert an image into another format. The allGray() and isGrayscale() functions tell whether a color image can safely be converted to a grayscale image.
QImage supports a number of functions for creating a new image that is a transformed version of the original: The createAlphaMask() function builds and returns a 1-bpp mask from the alpha buffer in this image, and the createHeuristicMask() function creates and returns a 1-bpp heuristic mask for this image. The latter function works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges.
The mirrored() function returns a mirror of the image in the desired direction, the scaled() returns a copy of the image scaled to a rectangle of the desired measures, and the rgbSwapped() function constructs a BGR image from a RGB image.
The scaledToWidth() and scaledToHeight() functions return scaled copies of the image.
The transformed() function returns a copy of the image that is transformed with the given transformation matrix and transformation mode: Internally, the transformation matrix is adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest image containing all transformed points of the original image. The static trueMatrix() function returns the actual matrix used for transforming the image.
There are also functions for changing attributes of an image in-place:
Function | Description |
setDotsPerMeterX() | Defines the aspect ratio by setting the number of pixels that fit horizontally in a physical meter. |
setDotsPerMeterY() | Defines the aspect ratio by setting the number of pixels that fit vertically in a physical meter. |
fill() | Fills the entire image with the given pixel value. |
invertPixels() | Inverts all pixel values in the image using the given InvertMode value. |
setColorTable() | Sets the color table used to translate color indexes. Only monochrome and 8-bit formats. |
setColorCount() | Resizes the color table. Only monochrome and 8-bit formats. |
For smooth scaling, the transformed() functions use code based on smooth scaling algorithm by Daniel M. Duley.
Copyright (C) 2004, 2005 Daniel M. Duley
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
enum QImage::Format |
The following image formats are available in Qt.
Values greater than QImage::Format_RGB16 were added in Qt 4.4. See the notes after the table.
Definition at line 91 of file qimage.h.
enum QImage::InvertMode |
This enum type is used to describe how pixel values should be inverted in the invertPixels() function.
Enumerator | |
---|---|
InvertRgb | |
InvertRgba |
Definition at line 90 of file qimage.h.
QImage::QImage | ( | ) |
Constructs a null image.
Definition at line 798 of file qimage.cpp.
Referenced by alphaChannel(), convertToFormat(), copy(), createAlphaMask(), createHeuristicMask(), createMaskFromColor(), mirrored(), operator>>(), QImage(), rgbSwapped(), scaled(), scaledToHeight(), scaledToWidth(), setPixel(), and transformed().
Constructs an image with the given size and format.
A null image is returned if memory cannot be allocated.
Definition at line 829 of file qimage.cpp.
QImage::QImage | ( | int | width, |
int | height, | ||
Format | format | ||
) |
Constructs an image with the given width, height and format.
A null image will be returned if memory cannot be allocated.
Definition at line 814 of file qimage.cpp.
Constructs an image with the given width, height and format, that uses an existing memory buffer, data.
The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.
The buffer must remain valid throughout the life of the QImage. The image does not delete the buffer at destruction.
If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.
Definition at line 896 of file qimage.cpp.
Constructs an image with the given width, height and format, that uses an existing read-only memory buffer, data.
The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned.
The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction.
If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.
Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.
Definition at line 925 of file qimage.cpp.
Constructs an image with the given width, height and format, that uses an existing memory buffer, data.
The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).
The buffer must remain valid throughout the life of the QImage. The image does not delete the buffer at destruction.
If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.
Definition at line 944 of file qimage.cpp.
Constructs an image with the given width, height and format, that uses an existing memory buffer, data.
The width and height must be specified in pixels. bytesPerLine specifies the number of bytes per line (stride).
The buffer must remain valid throughout the life of the QImage. The image does not delete the buffer at destruction.
If format is an indexed color format, the image color table is initially empty and must be sufficiently expanded with setColorCount() or setColorTable() before the image is used.
Unlike the similar QImage constructor that takes a non-const data buffer, this version will never alter the contents of the buffer. For example, calling QImage::bits() will return a deep copy of the image, rather than the buffer passed to the constructor. This allows for the efficiency of constructing a QImage from raw data, without the possibility of the raw data being changed.
Definition at line 972 of file qimage.cpp.
|
explicit |
Constructs an image from the given xpm image.
Make sure that the image is a valid XPM image. Errors are silently ignored.
Note that it's possible to squeeze the XPM variable a little bit by using an unusual declaration:
The extra const
makes the entire definition read-only, which is slightly more efficient (e.g., when the code is in a shared library) and able to be stored in ROM with the application.
Definition at line 1057 of file qimage.cpp.
|
explicit |
Constructs an image and tries to load the image from the file with the given fileName.
The loader attempts to read the image using the specified format. If the 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 Resource System overview for details on how to embed images and other resource files in the application's executable.
Definition at line 996 of file qimage.cpp.
|
explicit |
Constructs an image and tries to load the image from the file with the given fileName.
The loader attempts to read the image using the specified format. If the 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 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 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().
Definition at line 1027 of file qimage.cpp.
QImage::QImage | ( | const QImage & | image | ) |
Constructs a shallow copy of the given image.
For more information about shallow copies, see the Implicit Data Sharing documentation.
Definition at line 1097 of file qimage.cpp.
QImage::~QImage | ( | ) |
bool QImage::allGray | ( | ) | const |
Returns true if all the colors in the image are shades of gray (i.e.
their red, green and blue components are equal); otherwise false.
Note that this function is slow for images without color table.
Definition at line 4435 of file qimage.cpp.
Referenced by QPSPrintEnginePrivate::drawImage(), and isGrayscale().
QImage QImage::alphaChannel | ( | ) | const |
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 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.
Definition at line 6430 of file qimage.cpp.
Referenced by QX11PixmapData::alphaChannel(), QPixmapColorizeFilter::draw(), QImageTextureGlyphCache::fillTexture(), and QGLPixmapDropShadowFilter::processGL().
int QImage::bitPlaneCount | ( | ) | const |
Returns the number of bit planes in the image.
The number of bit planes is the number of bits of color and transparency information for each pixel. This is different from (i.e. smaller than) the depth when the image format contains unused bits.
Definition at line 6523 of file qimage.cpp.
uchar * QImage::bits | ( | ) |
Returns a pointer to the first pixel data.
This is equivalent to scanLine(0).
Note that QImage uses Implicit Data Sharing {implicit data sharing}. This function performs a deep copy of the shared pixel data, thus ensuring that this QImage is the only one using the current return value.
Definition at line 1946 of file qimage.cpp.
Referenced by QFontEngine::addBitmapFontToPath(), QFontEngineXLFD::addOutlineToPath(), allGray(), QAlphaWidget::alphaBlend(), QProxyFontEngine::alphaMapForGlyph(), QFontEngineFT::alphaRGBMapForGlyph(), QVNCScreen::base(), QGLPixmapData::bind(), QVolatileImage::bits(), QAhiScreen::blit(), QProxyFontEngine::canRender(), checkForAlphaPixels(), copy(), QVolatileImage::copyFrom(), QX11PixmapData::createBitmapFromImage(), QXlibCursor::createCursorBitmap(), QDirectFBScreen::createDFBSurface(), createMaskFromColor(), QGIFFormat::decode(), QWSDisplay::defineCursor(), QGIFFormat::disposePrevious(), QRasterPaintEngine::drawCachedGlyphs(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), QRasterPaintEngine::drawTextItem(), QGLPixmapData::ensureCreated(), expblur(), QGLTextureGlyphCache::fillTexture(), QBlittablePixmapData::fromImage(), QX11PixmapData::fromImage(), QGtkPainter::getIcon(), grayscale(), QFontEngineMac::imageForGlyph(), QMeeGoPixmapData::imageToEGLSharedImage(), QBBBuffer::invalidateInCache(), QFontEngineQPF::loadGlyph(), operator==(), QRasterBuffer::prepare(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), QTestLiteStaticInfoPrivate::qimageFromXImage(), QMacCGContext::QMacCGContext(), qt_mac_cg_context(), qt_mac_create_iconref(), qt_mac_image_to_cgimage(), qt_read_dibv5(), qt_x11_drawImage(), QVNCDirtyMap::QVNCDirtyMap(), QPixmap::qwsBits(), QTiffHandler::read(), read_dib_body(), QPngHandlerPrivate::readPngImage(), rotate_right_mirror_horizontal(), rotate_right_mirror_vertical(), rotated270(), rotated90(), QAhiScreenCursor::set(), QMacStyle::styleHint(), QWaylandReadbackGlxContext::swapBuffers(), QWaylandReadbackEglContext::swapBuffers(), swapPixel01(), QNativeImage::systemFormat(), QX11PixmapData::takeQImageFromXImage(), transformed(), QRfbRawEncoder::write(), and QRfbHextileEncoder< SRC >::write().
const uchar * QImage::bits | ( | ) | const |
Note that QImage uses Implicit Data Sharing {implicit data sharing}, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1969 of file qimage.cpp.
int QImage::byteCount | ( | ) | const |
Returns the number of bytes occupied by the image data.
Definition at line 1800 of file qimage.cpp.
Referenced by QVolatileImage::byteCount(), QDirectFBScreen::createDFBSurface(), QGIFFormat::decode(), QVGPaintEngine::drawImage(), QBlittablePixmapData::fromImage(), QX11PixmapData::fromImage(), QFontEngineQPF::loadGlyph(), qstring_to_xtp(), qt_mac_createCGImageFromQImage(), QItemDelegate::selected(), swapPixel01(), transformed(), and QWaylandShmBuffer::~QWaylandShmBuffer().
int QImage::bytesPerLine | ( | ) | const |
Returns the number of bytes per image scanline.
This is equivalent to byteCount() / height().
Definition at line 1812 of file qimage.cpp.
Referenced by QFontEngine::addBitmapFontToPath(), QFontEngineXLFD::addOutlineToPath(), QAlphaWidget::alphaBlend(), QProxyFontEngine::alphaMapForGlyph(), QAhiScreen::blit(), blit180(), blit270(), blit90(), blit_template(), QWindowSurface::buffer(), QVolatileImage::bytesPerLine(), QProxyFontEngine::canRender(), checkForAlphaPixels(), convolute(), copy(), QVolatileImage::copyFrom(), QX11PixmapData::createBitmapFromImage(), QXlibCursor::createCursorBitmap(), QDirectFBScreen::createDFBSurface(), createMaskFromColor(), QGIFFormat::decode(), QWSDisplay::defineCursor(), QRasterPaintEngine::drawCachedGlyphs(), QVGCompositionHelper::drawCursorPixmap(), QPSPrintEnginePrivate::drawImage(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), drawImageTiled(), QRasterPaintEngine::drawTextItem(), expblur(), QGLTextureGlyphCache::fillTexture(), QXlibWindowSurface::flush(), QRasterWindowSurface::flush(), QVGFontEngineCleaner::fontEngineDestroyed(), QBlittablePixmapData::fromImage(), QMacPixmapData::fromImage(), QWindowSurface::grabWidget(), QVNCIntegration::grabWindow(), QFontEngineMac::imageForGlyph(), QMeeGoPixmapData::imageToEGLSharedImage(), QBBBuffer::invalidateInCache(), QVNCScreen::linestep(), QFontEngineQPF::loadGlyph(), QPixmapData::mask(), QRasterBuffer::prepare(), QRasterWindowSurface::prepareBuffer(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), QImageScale::qimageCalcScaleInfo(), QMacCGContext::QMacCGContext(), qSmoothScaleImage(), qt_halfScaled(), qt_mac_cg_context(), qt_mac_create_iconref(), qt_mac_createCGImageFromQImage(), qt_mac_image_to_cgimage(), qt_mac_read_fontsmoothing_settings(), qt_read_dibv5(), qt_scrollRectInImage(), qt_write_dib(), qt_x11_drawImage(), QVNCDirtyMap::QVNCDirtyMap(), QPixmap::qwsBytesPerLine(), ICOReader::read16_24_32BMP(), ICOReader::read1BitBMP(), ICOReader::read8BitBMP(), read_dib_body(), QPngHandlerPrivate::readPngImage(), rotated270(), rotated90(), QAhiScreenCursor::set(), QRasterPixmapData::setMask(), QPixmapData::setMask(), QMacStyle::styleHint(), QNativeImage::systemFormat(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), toVGImage(), toVGImageSubRect(), QPixmap::toWinHICON(), transformed(), QBmpHandler::write(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), and write_pbm_image().
qint64 QImage::cacheKey | ( | ) | const |
Returns a number that identifies the contents of this QImage object.
Distinct QImage objects can only have the same key if they refer to the same contents.
The key will change when the image is altered.
Definition at line 6282 of file qimage.cpp.
Referenced by detach(), QPdfEngine::drawImage(), QTextHtmlExporter::emitBackgroundAttribute(), QDirectFBScreen::exposeRegion(), QDirectFBPaintEnginePrivate::getSurface(), operator<<(), and qt_image_id().
QRgb QImage::color | ( | int | i | ) | const |
Returns the color in the color table at index i.
The first color is at index 0.
The colors in an image's color table are specified as ARGB quadruplets (QRgb). Use the qAlpha(), qRed(), qGreen(), and qBlue() functions to get the color value components.
Definition at line 1829 of file qimage.cpp.
Referenced by compressHelper(), create32BitCursor(), QX11PixmapData::createBitmapFromImage(), QRasterPixmapData::fill(), QVGPixmapData::fill(), QMacPixmapData::fromImage(), QBitmap::fromImage(), QX11PixmapData::fromImage(), get_index(), QDirectFBScreen::getSurfaceDescription(), makeBitmapCompliantIfNeeded(), read_dib_body(), QGtkStyle::standardPixmap(), swapPixel01(), write_pbm_image(), write_xbm_image(), and QPNGImageWriter::writeImage().
int QImage::colorCount | ( | ) | const |
Returns the size of the color table for the image.
Notice that colorCount() returns 0 for 32-bpp images because these images do not use color tables, but instead encode pixel values as ARGB quadruplets.
Definition at line 1656 of file qimage.cpp.
Referenced by allGray(), color(), QPixmap::colorCount(), create32BitCursor(), QDirectFBScreen::createDFBSurface(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), get_index(), QDirectFBScreen::getSurfaceDescription(), isGrayscale(), QDirectFBPaintDevice::metric(), QImage(), qt_write_dib(), QPngHandlerPrivate::readPngImage(), rotated270(), rotated90(), setColorCount(), swapPixel01(), QBmpHandler::write(), write_jpeg_image(), write_pbm_image(), and QPNGImageWriter::writeImage().
Returns a list of the colors contained in the image's color table, or an empty list if the image does not have a color table.
Definition at line 1770 of file qimage.cpp.
Referenced by QPdfEnginePrivate::addImage(), QFontEngine::alphaRGBMapForGlyph(), QPixmap::clut(), convert_Indexed8_to_X32(), convert_Mono_to_X32(), fix_color_table(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), QRasterBuffer::prepare(), QGLPixmapDropShadowFilter::processGL(), qt_write_dib(), rotated270(), rotated90(), QTiffHandler::write(), write_jpeg_image(), and write_pbm_image().
const uchar * QImage::constBits | ( | ) | const |
Returns a pointer to the first pixel data.
Note that QImage uses Implicit Data Sharing {implicit data sharing}, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.
Definition at line 1985 of file qimage.cpp.
Referenced by QVolatileImage::constBits(), QVGCompositionHelper::drawCursorPixmap(), QVGPaintEngine::drawImage(), drawImageTiled(), QGLTextureGlyphCache::fillTexture(), QVGFontEngineCleaner::fontEngineDestroyed(), toVGImage(), toVGImageSubRect(), and QWaylandShmBuffer::~QWaylandShmBuffer().
const uchar * QImage::constScanLine | ( | int | i | ) | const |
Returns a pointer to the pixel data at the scanline with index i.
The first scanline is at index 0.
The scanline data is aligned on a 32-bit boundary.
Note that QImage uses Implicit Data Sharing {implicit data sharing}, but this function does not perform a deep copy of the shared pixel data, because the returned data is const.
Definition at line 1926 of file qimage.cpp.
Referenced by colorizeBitmap(), rgbSwapped(), write_jpeg_image(), and QPNGImageWriter::writeImage().
QImage QImage::convertToFormat | ( | Format | format, |
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) | const |
Returns a copy of the image in the given format.
The specified image conversion flags control how the image data is handled during the conversion process.
Definition at line 3966 of file qimage.cpp.
Referenced by QPdfEnginePrivate::addImage(), QFontEngineXLFD::addOutlineToPath(), alphaChannel(), QFontEngineXLFD::alphaMapForGlyph(), QFontEngine::alphaMapForGlyph(), QFontEngineDirectWrite::alphaRGBMapForGlyph(), QFontEngineWin::alphaRGBMapForGlyph(), QAhiScreen::blit(), QRasterBuffer::colorizeBitmap(), colorizeBitmap(), QWindowsMimeImage::convertFromMime(), convertToFormat(), convolute(), create32BitCursor(), createAlphaMask(), QX11PixmapData::createBitmapFromImage(), QXlibCursor::createCursorBitmap(), QDirectFBScreen::createDFBSurface(), createHeuristicMask(), createImageNode(), QPixmap::createMaskFromColor(), QRasterPixmapData::createPixmapForImage(), QVGPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), darkenPixmap(), QWSDisplay::defineCursor(), QPixmapColorizeFilter::draw(), QVGCompositionHelper::drawCursorPixmap(), QPSPrintEnginePrivate::drawImage(), QPSPrintEngine::drawImageInternal(), QGLPixmapData::ensureCreated(), QVolatileImageData::ensureFormat(), QGLTextureGlyphCache::fillTexture(), QImageTextureGlyphCache::fillTexture(), QVGFontEngineCleaner::fontEngineDestroyed(), QBlittablePixmapData::fromImage(), QDirectFBPixmapData::fromImage(), QMacPixmapData::fromImage(), QBitmap::fromImage(), QX11PixmapData::fromImage(), QWindowsMobileStyle::generatedIconPixmap(), QCommonStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), QFontEngineQPF::loadGlyph(), makeBitmapCompliantIfNeeded(), QPixmapData::mask(), operator>>(), QCursor::QCursor(), qstring_to_xtp(), qt_blurImage(), qt_createIconMask(), qt_halfScaled(), qt_mac_createCGImageFromQImage(), qt_write_dib(), qt_write_dibv5(), QItemDelegate::selected(), QVNCCursor::sendClientCursor(), QAhiScreenCursor::set(), QScreenCursor::set(), QDirectFBScreenCursor::set(), setAlphaChannel(), QRasterPixmapData::setMask(), QPixmapData::setMask(), QCursor::setPos(), smoothScaled(), QCommonStyle::standardPixmap(), toVGImage(), toVGImageSubRect(), QPixmap::toWinHBITMAP(), QTiffHandler::write(), QBmpHandler::write(), QVNCClientCursor::write(), ICOReader::write(), write_jpeg_image(), write_pbm_image(), write_xbm_image(), write_xpm_image(), QMngHandlerPrivate::writeImage(), QPNGImageWriter::writeImage(), and QX11Data::xdndMimeDataForAtom().
QImage QImage::convertToFormat | ( | Format | format, |
const QVector< QRgb > & | colorTable, | ||
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) | const |
Returns a copy of the image converted to the given format, using the specified colorTable.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Conversion from 32 bit to 8 bit indexed is a slow operation and will use a straightforward nearest color approach, with no dithering.
Definition at line 4095 of file qimage.cpp.
Returns a sub-area of the image as a new image.
The returned image is copied from the position ({rectangle}.x(), {rectangle}.y()) in this image, and will always have the size of the given rectangle.
In areas beyond this image, pixels are set to 0. For 32-bit RGB images, this means black; for 32-bit ARGB images, this means transparent black; for 8-bit images, this means the color with index 0 in the color table which can be anything; for 1-bit images, this means Qt::color0.
If the given rectangle is a null rectangle the entire image is copied.
Definition at line 1410 of file qimage.cpp.
Referenced by QGLWindowSurface::buffer(), QMeeGoRasterPixmapData::copy(), QRasterPixmapData::copy(), QX11PixmapData::copy(), create32BitCursor(), QWSCursor::createDropShadow(), detach(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QPSPrintEngine::drawImage(), QPdfEngine::drawImage(), QPaintEngine::drawImage(), QXlibScreen::grabWindow(), operator=(), QImage(), QTestLiteStaticInfoPrivate::qimageFromXImage(), qpaintbuffer_storable_image(), qt_x11_drawImage(), QVNCDirtyMap::QVNCDirtyMap(), QImageReader::read(), rgbSwapped(), QAlphaWidget::run(), QBlittablePixmapData::toImage(), QDirectFBPixmapData::toImage(), QRasterPixmapData::toImage(), QVolatileImage::toImage(), QPixmapData::toImage(), QX11PixmapData::toImage(), QGLPixmapData::toImage(), QTiffHandler::write(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), write_jpeg_image(), and QPNGImageWriter::writeImage().
|
inline |
The returned image is copied from the position (x, y) in this image, and will always have the given width and height.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
In areas beyond this image, pixels are set to 0.
Definition at line 160 of file qimage.h.
QImage QImage::createAlphaMask | ( | Qt::ImageConversionFlags | flags = Qt::AutoColor | ) | const |
Builds and returns a 1-bpp mask from the alpha buffer in this image.
Returns a null image if the image's format is QImage::Format_RGB32.
The flags argument is a bitwise-OR of the Qt::ImageConversionFlags, and controls the conversion process. Passing 0 for flags sets all the default options.
The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.
Definition at line 4720 of file qimage.cpp.
Referenced by createAlphaMask(), QPSPrintEngine::drawImageInternal(), QX11PixmapData::fromImage(), QFileSystemModel::headerData(), QCursor::QCursor(), QVNCCursor::sendClientCursor(), QVNCClientCursor::write(), and ICOReader::write().
QImage QImage::createHeuristicMask | ( | bool | clipTight = true | ) | const |
Creates and returns a 1-bpp heuristic mask for this image.
The function works by selecting a color from one of the corners, then chipping away pixels of that color starting at all the edges. The four corners vote for which color is to be masked away. In case of a draw (this generally means that this function is not applicable to the image), the result is arbitrary.
The returned image has little-endian bit order (i.e. the image's format is QImage::Format_MonoLSB), which you can convert to big-endian (QImage::Format_Mono) using the convertToFormat() function.
If clipTight is true (the default) the mask is just large enough to cover the pixels; otherwise, the mask is larger than the data pixels.
Note that this function disregards the alpha buffer.
Definition at line 4762 of file qimage.cpp.
Referenced by createHeuristicMask().
QImage QImage::createMaskFromColor | ( | QRgb | color, |
Qt::MaskMode | mode = Qt::MaskInColor |
||
) | const |
Creates and returns a mask for this image based on the given color value.
If the mode is MaskInColor (the default value), all pixels matching color will be opaque pixels in the mask. If mode is MaskOutColor, all pixels matching the given color will be transparent.
Definition at line 4865 of file qimage.cpp.
Referenced by QPixmap::createMaskFromColor().
|
inline |
Definition at line 346 of file qimage.h.
Referenced by QMeeGoGraphicsSystem::createPixmapData(), QVGPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), QVGPixmapData::idealFormat(), QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(), and QX11PixmapData::takeQImageFromXImage().
int QImage::depth | ( | ) | const |
Returns the depth of the image.
The image depth is the number of bits used to store a single pixel, also called bits per pixel (bpp).
The supported depths are 1, 8, 16, 24 and 32.
Definition at line 1620 of file qimage.cpp.
Referenced by QFontEngine::addBitmapFontToPath(), QPdfEnginePrivate::addImage(), QAlphaWidget::alphaBlend(), QFontEngine::alphaMapForGlyph(), QFontEngineDirectWrite::alphaRGBMapForGlyph(), QFontEngineWin::alphaRGBMapForGlyph(), QPainter::begin(), QTransformedScreen::blit(), QWindowSurface::buffer(), QVGPaintEngine::canVgWritePixels(), QRasterBuffer::colorizeBitmap(), compressHelper(), convert_indexed8_to_ARGB_PM_inplace(), convert_indexed8_to_RGB16_inplace(), convert_indexed8_to_RGB_inplace(), convert_RGB_to_RGB16_inplace(), convertToFormat(), QImageData::create(), QDirectFBScreen::createDFBSurface(), createMaskFromColor(), QRasterPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), QVolatileImage::depth(), QRasterPaintEngine::drawBitmap(), QRasterPaintEngine::drawCachedGlyphs(), QX11PaintEngine::drawImage(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), QPSPrintEnginePrivate::drawImageHelper(), QPSPrintEngine::drawImageInternal(), drawImageTiled(), QRasterPaintEngine::drawPixmap(), QRasterPaintEngine::drawTextItem(), QRasterPaintEngine::drawTiledPixmap(), expblur(), QRasterPixmapData::fill(), QGLPixmapData::fill(), QImageTextureGlyphCache::fillTexture(), QRasterWindowSurface::flush(), format(), QDirectFBPixmapData::fromImage(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), QWindowSurface::grabWidget(), QVNCIntegration::grabWindow(), QDirectFBPixmapData::hasAlphaChannel(), QVGPixmapData::idealFormat(), invertPixels(), is_brush_transparent(), isGrayscale(), QFontEngineQPF::loadGlyph(), QPixmapData::mask(), mirrored(), QRasterBuffer::prepare(), QRasterWindowSurface::prepareBuffer(), QImage(), qt_blurrow(), qt_mac_createCGImageFromQImage(), qt_mac_image_to_cgimage(), qt_scrollRectInImage(), qt_toRasterPixmap(), qt_toX11Pixmap(), qt_write_dib(), qt_x11_drawImage(), QVNCDirtyMap::QVNCDirtyMap(), read_xpm_body(), QPngHandlerPrivate::readPngImage(), QRasterPixmapData::resize(), QVNCCursor::sendClientCursor(), setColor(), QRasterPixmapData::setMask(), QPixmapData::setMask(), smoothScaled(), swapPixel01(), transformed(), QBmpHandler::write(), QVNCClientCursor::write(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), write_pbm_image(), write_xpm_image(), and QPNGImageWriter::writeImage().
void QImage::detach | ( | ) |
If multiple images share common data, this image makes a copy of the data and detaches itself from the sharing mechanism, making sure that this image is the only one referring to the data.
Nothing is done if there is just a single reference.
Definition at line 1359 of file qimage.cpp.
Referenced by bits(), colorCount(), QRasterPixmapData::createPixmapForImage(), QVGPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), QGIFFormat::decode(), QPixmap::detach(), QRasterPixmapData::fill(), fill(), format(), QWindowSurface::grabWidget(), invertPixels(), QVolatileImageData::QVolatileImageData(), scanLine(), setAlphaChannel(), setColor(), setColorCount(), setColorTable(), setDotsPerMeterX(), setDotsPerMeterY(), setOffset(), setText(), and write_pbm_image().
|
virtual |
Reimplemented from QPaintDevice.
Definition at line 1332 of file qimage.cpp.
int QImage::dotsPerMeterX | ( | ) | const |
Returns the number of pixels that fit horizontally in a physical meter.
Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image.
Definition at line 5615 of file qimage.cpp.
Referenced by convertToFormat(), copy(), qt_write_dib(), setPixel(), transformed(), QTiffHandler::write(), write_jpeg_image(), and QPNGImageWriter::writeImage().
int QImage::dotsPerMeterY | ( | ) | const |
Returns the number of pixels that fit vertically in a physical meter.
Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image.
Definition at line 5628 of file qimage.cpp.
Referenced by convertToFormat(), copy(), qt_write_dib(), setPixel(), transformed(), QTiffHandler::write(), write_jpeg_image(), and QPNGImageWriter::writeImage().
void QImage::fill | ( | uint | pixelValue | ) |
Fills the entire image with the given pixelValue.
If the depth of this image is 1, only the lowest bit is used. If you say fill(0), fill(2), etc., the image is filled with 0s. If you say fill(1), fill(3), etc., the image is filled with 1s. If the depth is 8, the lowest 8 bits are used and if the depth is 16 the lowest 16 bits are used.
Note: QImage::pixel() returns the color of the pixel at the given coordinates while QColor::pixel() returns the pixel value of the underlying window system (essentially an index value), so normally you will want to use QImage::pixel() to use a color from an existing image or QColor::rgb() to use a specific color.
Definition at line 2032 of file qimage.cpp.
Referenced by alphaChannel(), QFontEngine::alphaMapForGlyph(), QFontEngineBox::alphaMapForGlyph(), alphaMapFromPath(), QGLPixmapData::bind(), copy(), create32BitCursor(), createHeuristicMask(), createMaskFromColor(), QPixmapDropShadowFilter::draw(), QPainterPrivate::draw_helper(), QAlphaPaintEnginePrivate::drawAlphaImage(), QWindowsVistaStyle::drawControl(), drawEllipse_midpoint_i(), QFontEngineWin::drawGDIGlyph(), QWindowsStyle::drawPrimitive(), QBlittablePixmapData::fill(), QRasterPixmapData::fill(), QX11PixmapData::fill(), QVolatileImage::fill(), QGLPixmapData::fill(), fill(), QGLPixmapData::fillImage(), QX11PaintEnginePrivate::fillPolygon_dev(), QFileSystemModel::headerData(), QFontEngineMac::imageForGlyph(), QFontEngineDirectWrite::imageForGlyph(), QGLPixmapData::paintEngine(), QSvgIconEngine::pixmap(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), QMngHandlerPrivate::processHeader(), qt_mac_read_fontsmoothing_settings(), qt_patternForAlpha(), QSvgIOHandler::read(), QWSYellowSurface::setPermanentState(), QMacPixmapData::toImage(), toVGImageWithOpacity(), toVGImageWithOpacitySubRect(), and ICOReader::write().
void QImage::fill | ( | const QColor & | color | ) |
Fills the entire image with the given color.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
If the depth of the image is 1, the image will be filled with 1 if color equals Qt::color1; it will otherwise be filled with 0.
If the depth of the image is 8, the image will be filled with the index corresponding the color in the color table if present; it will otherwise be filled with 0.
Definition at line 2114 of file qimage.cpp.
void QImage::fill | ( | Qt::GlobalColor | color | ) |
Fills the image with the given color, described as a standard global color.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 2087 of file qimage.cpp.
QImage::Format QImage::format | ( | ) | const |
Returns the format of the image.
Definition at line 2305 of file qimage.cpp.
Referenced by QPdfEnginePrivate::addBrushPattern(), QPdfEnginePrivate::addImage(), QFontEngineWin::alphaMapForGlyph(), QPainter::begin(), QRasterWindowSurface::beginPaint(), QAhiScreen::blit(), QTransformedScreen::blit(), blit_template(), QWindowSurface::buffer(), QProxyFontEngine::canRender(), QVGPaintEngine::canVgWritePixels(), checkForAlphaPixels(), compressHelper(), QWindowsMimeImage::convertFromMime(), QImageData::convertInPlace(), convertToFormat(), convertWithPalette(), convolute(), QImageData::create(), QDirectFBScreen::createDFBSurface(), createImageNode(), QRasterPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), QPixmapColorizeFilter::draw(), QRasterPaintEngine::drawBitmap(), QDirectFBPaintEngine::drawImage(), QPSPrintEnginePrivate::drawImage(), QX11PaintEngine::drawImage(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QPSPrintEngine::drawImageInternal(), drawImageTiled(), QVolatileImageData::ensureFormat(), ensureValidImage(), expblur(), QDirectFBScreen::exposeRegion(), QRasterPixmapData::fill(), QGLTextureGlyphCache::fillTexture(), QRasterWindowSurface::flush(), QVGFontEngineCleaner::fontEngineDestroyed(), QVolatileImage::format(), QBlittablePixmapData::fromImage(), QDirectFBPixmapData::fromImage(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), QDirectFBPaintEnginePrivate::getSurface(), QWindowSurface::grabWidget(), QVNCIntegration::grabWindow(), QWSMemorySurface::isValid(), QFontEngineQPF::loadGlyph(), mirrored(), QWSLocalMemSurface::permanentState(), QWSSharedMemSurface::permanentState(), QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(), QRasterBuffer::prepare(), qSmoothScaleImage(), qt_bitmapToRegion(), qt_blurImage(), qt_blurrow(), qt_halfScaled(), qt_mac_createCGImageFromQImage(), qt_read_dibv5(), qt_write_dib(), qt_write_dibv5(), qt_x11_drawImage(), QTiffHandler::read(), read_dib_body(), read_pbm_body(), read_xbm_body(), read_xpm_body(), QPngHandlerPrivate::readPngImage(), QMeeGoPixmapData::registerSharedImage(), rotate_right_mirror_horizontal(), rotate_right_mirror_vertical(), rotated270(), rotated90(), QAhiScreenCursor::set(), QRasterPixmapData::setMask(), QPixmapData::setMask(), setPixel(), setup_qt(), smoothScaled(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), toVGImage(), toVGImageSubRect(), transformed(), QTiffHandler::write(), QBmpHandler::write(), write_jpeg_image(), write_pbm_image(), write_xbm_image(), write_xpm_image(), and QPNGImageWriter::writeImage().
Constructs a QImage from the first size bytes of the given binary data.
The loader attempts to read the image using the specified format. If format is not specified (which is the default), the loader probes the file for a header to guess the file format. binary data. The loader attempts to read the image, either using the optional image format specified or by determining the image format from the data.
If format is not specified (which is the default), the loader probes the file for a header to determine the file format. If format is specified, it must be one of the values returned by QImageReader::supportedImageFormats().
If the loading of the image fails, the image returned will be a null image.
Definition at line 5313 of file qimage.cpp.
Referenced by createImageNode(), fromData(), ICOReader::iconAt(), loadFromData(), and QInternalMimeData::retrieveData().
|
inlinestatic |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads an image from the given QByteArray data.
Definition at line 258 of file qimage.h.
bool QImage::hasAlphaChannel | ( | ) | const |
Returns true if the image has a format that respects the alpha channel, otherwise returns false.
Definition at line 6495 of file qimage.cpp.
Referenced by alphaChannel(), QXcbWindowSurface::beginPaint(), QXlibWindowSurface::beginPaint(), QWindowsMimeImage::canConvertFromMime(), QRasterPaintEnginePrivate::canUseFastImageBlending(), QVGPaintEngine::canVgWritePixels(), checkForAlphaPixels(), QRasterPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), QPixmapColorizeFilter::draw(), QDirectFBPaintEngine::drawImage(), QAlphaPaintEngine::drawImage(), QGL2PaintEngineEx::drawImage(), QPSPrintEngine::drawImageInternal(), QRasterPixmapData::fill(), QWindowsMimeImage::formatsForMime(), QMeeGoPixmapData::fromEGLSharedImage(), QBlittablePixmapData::fromImage(), QMacPixmapData::fromImage(), QBlittablePixmapData::hasAlphaChannel(), QVolatileImage::hasAlphaChannel(), QRasterPixmapData::hasAlphaChannel(), QDirectFBPixmapData::hasAlphaChannel(), QVGPixmapData::idealFormat(), QMeeGoPixmapData::imageToEGLSharedImage(), QSpanData::initTexture(), QBrush::isOpaque(), smoothScaled(), transformed(), QPainterPrivate::updateEmulationSpecifier(), QVNCClientCursor::write(), and QPNGImageWriter::writeImage().
int QImage::height | ( | ) | const |
Returns the height of the image.
Definition at line 1572 of file qimage.cpp.
Referenced by QFontEngine::addBitmapFontToPath(), QPdfEnginePrivate::addBrushPattern(), QPdfEnginePrivate::addImage(), QFontEngineXLFD::addOutlineToPath(), allGray(), QAlphaWidget::alphaBlend(), QProxyFontEngine::alphaMapForGlyph(), QFontEngineMac::alphaMapForGlyph(), QFontEngineDirectWrite::alphaMapForGlyph(), QFontEngineXLFD::alphaMapForGlyph(), QFontEngine::alphaMapForGlyph(), alphaMapFromPath(), QFontEngine::alphaRGBMapForGlyph(), QX11PixmapData::bitmapFromImage(), QAhiScreen::blit(), QProxyFontEngine::canRender(), checkForAlphaPixels(), colorCount(), colorizeBitmap(), compressHelper(), constScanLine(), QMacPasteboardMimeTiff::convertFromMime(), convertWithPalette(), convolute(), copy(), QImageData::create(), create32BitCursor(), QX11PixmapData::createBitmapFromImage(), QDirectFBScreen::createDFBSurface(), createHeuristicMask(), QVGPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), darkenPixmap(), QGIFFormat::decode(), QRasterPaintEngine::drawBitmap(), QCleanlooksStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QVGCompositionHelper::drawCursorPixmap(), QPdfEngine::drawImage(), QCoreGraphicsPaintEngine::drawImage(), QPSPrintEnginePrivate::drawImage(), QGL2PaintEngineEx::drawImage(), QOpenGLPaintEngine::drawImage(), QVGPaintEngine::drawImage(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), QPainter::drawImage(), QPSPrintEnginePrivate::drawImageHelper(), QPSPrintEngine::drawImageInternal(), drawImageTiled(), QPdfEngine::drawPixmap(), QPlastiqueStyle::drawPrimitive(), QRasterPaintEngine::drawTextItem(), QOpenGLPaintEngine::drawTiledPixmap(), expblur(), QRasterPixmapData::fill(), QGLTextureGlyphCache::fillTexture(), QImageTextureGlyphCache::fillTexture(), QXlibWindowSurface::flush(), QRasterBuffer::flushToARGBImage(), QVGFontEngineCleaner::fontEngineDestroyed(), format(), QBlittablePixmapData::fromImage(), QDirectFBPixmapData::fromImage(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), QWindowsMobileStyle::generatedIconPixmap(), QCommonStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), getImageSize(), QVNCIntegration::grabWindow(), grayscale(), QVolatileImage::height(), QNativeImage::height(), ICOReader::iconAt(), QFontEngineMac::imageForGlyph(), QMeeGoPixmapData::imageToEGLSharedImage(), QBBBuffer::invalidateInCache(), QFontEngineQPF::loadGlyph(), QPixmapData::mask(), operator==(), QWSLocalMemSurface::permanentState(), QWSSharedMemSurface::permanentState(), pixel(), pixelIndex(), QRasterBuffer::prepare(), QRasterWindowSurface::prepareBuffer(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), qGamma_correct_back_to_linear_cs(), qgl_byteSwapImage(), QImageScale::qimageCalcScaleInfo(), QTestLiteStaticInfoPrivate::qimageFromXImage(), QMacCGContext::QMacCGContext(), qSmoothScaleImage(), qstring_to_xtp(), QSvgImage::QSvgImage(), qt_bitmapToRegion(), qt_blurImage(), qt_createIconMask(), qt_halfScaled(), qt_mac_cg_context(), qt_mac_createCGImageFromQImage(), qt_mac_image_to_cgimage(), qt_scrollRectInImage(), qt_write_dib(), qt_write_dibv5(), ICOReader::read1BitBMP(), rotate_right_mirror_horizontal(), rotate_right_mirror_vertical(), rotated270(), rotated90(), scaled(), scaledToHeight(), scanLine(), QItemDelegate::selected(), QVNCCursor::sendClientCursor(), QAhiScreenCursor::set(), QRasterPixmapData::setMask(), QPixmapData::setMask(), setPixel(), QMacStyle::styleHint(), QX11PixmapData::takeQImageFromXImage(), toVGImage(), QPixmap::toWinHBITMAP(), transformed(), QMeeGoPixmapData::updateFromSoftImage(), QTiffHandler::write(), QBmpHandler::write(), QVNCClientCursor::write(), ICOReader::write(), write_jpeg_image(), write_pbm_image(), write_xbm_image(), write_xpm_image(), QMngHandlerPrivate::writeImage(), QPNGImageWriter::writeImage(), and QTextOdfWriter::writeInlineCharacter().
void QImage::invertPixels | ( | InvertMode | mode = InvertRgb | ) |
Inverts all pixel values in the image.
Use the invertPixels() function that takes a QImage::InvertMode parameter instead.
The given invert mode only have a meaning when the image's depth is 32. The default mode is InvertRgb, which leaves the alpha channel unchanged. If the mode is InvertRgba, the alpha bits are also inverted.
Inverting an 8-bit image means to replace all pixels using color index i with a pixel using color index 255 minus i. The same is the case for a 1-bit image. Note that the color table is not changed.
Definition at line 2179 of file qimage.cpp.
Referenced by QX11PixmapData::createBitmapFromImage(), createMaskFromColor(), QImageTextureGlyphCache::fillTexture(), QBitmap::fromImage(), makeBitmapCompliantIfNeeded(), qt_createIconMask(), and toVGImage().
bool QImage::isDetached | ( | ) | const |
Returns true if the image is detached; otherwise returns false.
Definition at line 6301 of file qimage.cpp.
bool QImage::isGrayscale | ( | ) | const |
For 32-bit images, this function is equivalent to allGray().
For 8-bpp images, this function returns true if color(i) is QRgb(i, i, i) for all indexes of the color table; otherwise returns false.
Definition at line 4477 of file qimage.cpp.
Referenced by setAlphaChannel().
bool QImage::isNull | ( | ) | const |
Returns true if it is a null image, otherwise returns false.
A null image has all parameters set to zero and no allocated data.
Definition at line 1542 of file qimage.cpp.
Referenced by QPdfEnginePrivate::addImage(), QFontEngineXLFD::addOutlineToPath(), QPainter::begin(), QScreen::blit(), QDirectFBPixmapData::buffer(), QGLWindowSurface::buffer(), QWindowsMimeImage::canConvertFromMime(), QProxyFontEngine::canRender(), QPixmap::convertFromImage(), QWindowsMimeImage::convertFromMime(), copy(), QVolatileImage::copyFrom(), createAlphaMask(), QDirectFBScreen::createDFBSurface(), createImageNode(), createPixmapDataSync(), QVGPixmapData::createPixmapForImage(), QGIFFormat::decode(), QPdfEngine::drawImage(), QCoreGraphicsPaintEngine::drawImage(), QPSPrintEnginePrivate::drawImage(), QVGPaintEngine::drawImage(), QPainter::drawImage(), QPSPrintEnginePrivate::drawImageHelper(), QCleanlooksStyle::drawPrimitive(), QOpenGLPaintEngine::drawTiledPixmap(), QGLPixmapData::ensureCreated(), ensureValidImage(), QScreen::exposeRegion(), QRasterPixmapData::fill(), QGLPixmapData::fill(), QXlibWindowSurface::flush(), QVGFontEngineCleaner::fontEngineDestroyed(), QWindowsMimeImage::formatsForMime(), QRasterPixmapData::fromData(), QVGPixmapData::fromData(), QGLPixmapData::fromData(), QMeeGoPixmapData::fromEGLSharedImage(), QVGPixmapData::fromFile(), QPixmapData::fromFile(), QGLPixmapData::fromFile(), QBitmap::fromImage(), QVGPixmapData::fromImage(), QPixmap::fromImage(), QRasterPixmapData::fromImageReader(), QVGPixmapData::fromImageReader(), QGLPixmapData::fromImageReader(), QPixmap::fromWinHBITMAP(), QPixmap::fromWinHICON(), getImage(), getImageSize(), getPixmap(), QWindowSurface::grabWidget(), ICOReader::iconAt(), QTextCursor::insertImage(), QVolatileImage::isNull(), QWSMemorySurface::isValid(), QWSOnScreenSurface::isValid(), load(), loadFromData(), QTextDocument::loadResource(), QPixmapData::mask(), QDirectFBPaintDevice::metric(), operator<<(), operator>>(), QDeclarativePixmapReader::processJob(), QPixmap::QPixmap(), QPixmapCacheEntry::QPixmapCacheEntry(), qSmoothScaleImage(), qt_read_dibv5(), QTiffHandler::read(), QtIcoHandler::read(), QTgaHandler::read(), read_dib_body(), read_pbm_body(), read_xbm_body(), read_xpm_body(), QPngHandlerPrivate::readPngImage(), QRasterPixmapData::resize(), rgbSwapped(), QAlphaWidget::run(), save(), QMeeGoLivePixmapData::scroll(), QXcbWindowSurface::scroll(), QXlibWindowSurface::scroll(), QRasterPixmapData::scroll(), QVNCCursor::sendClientCursor(), QAhiScreenCursor::set(), QDirectFBScreenCursor::set(), setAlphaChannel(), QWSServer::setBackground(), setPixel(), QBrush::setTextureImage(), setup_qt(), QMacPixmapData::toImage(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), QGLPixmapData::toImage(), QPixmap::toWinHICON(), QVNCClientCursor::write(), and QTextOdfWriter::writeInlineCharacter().
bool QImage::load | ( | QIODevice * | device, |
const char * | format | ||
) |
This function reads a QImage from the given device.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This can, for example, be used to load an image directly into a QByteArray.
Definition at line 5251 of file qimage.cpp.
Referenced by getImage(), getPixmap(), QImage(), and QTextOdfWriter::writeInlineCharacter().
bool QImage::load | ( | const QString & | fileName, |
const char * | format = 0 |
||
) |
Loads an image from the file with the given fileName.
Returns true if the image was successfully loaded; otherwise returns false.
The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.
The file name can either refer to an actual file on disk or to one of the application's embedded resources. See the Resource System overview for details on how to embed images and other resource files in the application's executable.
Definition at line 5228 of file qimage.cpp.
bool QImage::loadFromData | ( | const uchar * | data, |
int | len, | ||
const char * | format = 0 |
||
) |
Loads an image from the first len bytes of the given binary data.
Returns true if the image was successfully loaded; otherwise returns false.
The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.
Definition at line 5275 of file qimage.cpp.
Referenced by QTextHtmlParserNode::applyBackgroundImage(), QWindowsMimeImage::convertToMime(), getImage(), QTextDocument::loadResource(), and QTextOdfWriter::writeInlineCharacter().
|
inline |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads an image from the given QByteArray data.
Definition at line 251 of file qimage.h.
|
protectedvirtual |
Returns the size for the specified metric on the device.
Reimplemented from QPaintDevice.
Definition at line 5995 of file qimage.cpp.
QImage QImage::mirrored | ( | bool | horizontal = false , |
bool | vertical = true |
||
) | const |
Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on whether horizontal and vertical are set to true or false.
Note that the original image is not changed.
Definition at line 4922 of file qimage.cpp.
Referenced by QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QGLPixmapData::ensureCreated(), QWindowsMobileStylePrivate::QWindowsMobileStylePrivate(), QTiffHandler::read(), rotated180(), QCommonStyle::standardPixmap(), QWaylandReadbackEglContext::swapBuffers(), QWaylandReadbackGlxContext::swapBuffers(), and transformed().
int QImage::numBytes | ( | ) | const |
Returns the number of bytes occupied by the image data.
Definition at line 1785 of file qimage.cpp.
int QImage::numColors | ( | ) | const |
Returns the size of the color table for the image.
Definition at line 1636 of file qimage.cpp.
Referenced by convert_RGB_to_Indexed8(), format(), QMacPixmapData::fromImage(), and QImage().
QPoint QImage::offset | ( | ) | const |
Returns the number of pixels by which the image is intended to be offset by when positioning relative to other images.
Definition at line 5688 of file qimage.cpp.
Referenced by copy(), and QPNGImageWriter::writeImage().
QImage::operator QVariant | ( | ) | const |
Returns the image as a QVariant.
Definition at line 1340 of file qimage.cpp.
bool QImage::operator!= | ( | const QImage & | image | ) | const |
Returns true if this image and the given image have different contents; otherwise returns false.
The comparison can be slow, unless there is some obvious difference, such as different widths, in which case the function will return quickly.
Definition at line 5599 of file qimage.cpp.
Assigns a shallow copy of the given image to this image and returns a reference to this image.
For more information about shallow copies, see the Implicit Data Sharing documentation.
Definition at line 1304 of file qimage.cpp.
Referenced by load(), loadFromData(), and QImage().
bool QImage::operator== | ( | const QImage & | image | ) | const |
Returns true if this image and the given image have the same contents; otherwise returns false.
The comparison can be slow, unless there is some obvious difference (e.g. different size or format), in which case the function will return quickly.
Definition at line 5531 of file qimage.cpp.
|
virtual |
Used by QPainter to retrieve a paint engine for the image.
Implements QPaintDevice.
Definition at line 5970 of file qimage.cpp.
Referenced by QRasterPixmapData::paintEngine(), QGLPixmapData::paintEngine(), QNativeImage::QNativeImage(), and QNativeImage::systemFormat().
QRgb QImage::pixel | ( | int | x, |
int | y | ||
) | const |
Returns the color of the pixel at coordinates (x, y).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4240 of file qimage.cpp.
Referenced by createMaskFromColor(), darkenPixmap(), QRasterPaintEngine::drawImage(), fill(), QWindowsMobileStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), qcolorForThemeTextColor(), rotated270(), and rotated90().
Q_GUI_EXPORT_INLINE QRgb QImage::pixel | ( | const QPoint & | position | ) | const |
Returns the color of the pixel at the given position.
If the position is not valid, the results are undefined.
Definition at line 356 of file qimage.h.
int QImage::pixelIndex | ( | int | x, |
int | y | ||
) | const |
Returns the pixel index at (x, y).
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4194 of file qimage.cpp.
Referenced by QWSCursor::createDropShadow(), operator==(), rotated270(), and rotated90().
Q_GUI_EXPORT_INLINE int QImage::pixelIndex | ( | const QPoint & | position | ) | const |
Returns the pixel index at the given position.
If position is not valid, or if the image is not a paletted image (depth() > 8), the results are undefined.
Definition at line 355 of file qimage.h.
QRect QImage::rect | ( | ) | const |
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
Definition at line 1603 of file qimage.cpp.
Referenced by convolute(), QPixmapColorizeFilter::draw(), QWindowsVistaStyle::drawControl(), QDirectFBPaintEngine::drawImage(), QBlitterPaintEngine::drawImage(), QPdfEngine::drawImage(), QRasterPaintEngine::drawImage(), QPaintEngineEx::drawImage(), QPainter::drawImage(), QTextImageHandler::drawObject(), fill(), QRasterWindowSurface::flush(), QPlatformSoftwareCursor::getCurrentRect(), grayscale(), QGLPixmapDropShadowFilter::processGL(), QBBBuffer::rect(), and trueMatrix().
QImage QImage::rgbSwapped | ( | ) | const |
Returns a QImage in which the values of the red and blue components of all pixels have been swapped, effectively converting an RGB image to an BGR image.
The original QImage is not changed.
Definition at line 5052 of file qimage.cpp.
bool QImage::save | ( | const QString & | fileName, |
const char * | format = 0 , |
||
int | quality = -1 |
||
) | const |
Saves the image to the file with the given fileName, using the given image file format and quality factor.
If format is 0, QImage will attempt to guess the format by looking at fileName's suffix.
The quality factor must be in the range 0 to 100 or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 (the default) to use the default settings.
Returns true if the image was successfully saved; otherwise returns false.
Definition at line 5346 of file qimage.cpp.
Referenced by drawEllipse_midpoint_i(), QSvgPaintEngine::drawImage(), QMimeDataWrapper::encodedData(), QMinimalWindowSurface::flush(), QInternalMimeData::renderDataHelper(), and xdndObtainData().
bool QImage::save | ( | QIODevice * | device, |
const char * | format = 0 , |
||
int | quality = -1 |
||
) | const |
This function writes a QImage to the given device.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This can, for example, be used to save an image directly into a QByteArray:
Definition at line 5368 of file qimage.cpp.
|
inline |
Definition at line 232 of file qimage.h.
Referenced by QGL2PaintEngineEx::drawImage(), QOpenGLPaintEngine::drawImage(), QPSPrintEngine::drawImageInternal(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QOpenGLPaintEngine::drawTiledPixmap(), QMoviePrivate::next(), qt_mac_create_iconref(), QImageReader::read(), and ICOReader::write().
QImage QImage::scaled | ( | const QSize & | s, |
Qt::AspectRatioMode | aspectMode = Qt::IgnoreAspectRatio , |
||
Qt::TransformationMode | mode = Qt::FastTransformation |
||
) | const |
Definition at line 4577 of file qimage.cpp.
QImage QImage::scaledToHeight | ( | int | height, |
Qt::TransformationMode | mode = Qt::FastTransformation |
||
) | const |
Returns a scaled copy of the image.
The returned image is scaled to the given height using the specified transformation mode.
This function automatically calculates the width of the image so that the ratio of the image is preserved.
If the given height is 0 or negative, a null image is returned.
Definition at line 4646 of file qimage.cpp.
QImage QImage::scaledToWidth | ( | int | width, |
Qt::TransformationMode | mode = Qt::FastTransformation |
||
) | const |
Returns a scaled copy of the image.
The returned image is scaled to the given width using the specified transformation mode.
This function automatically calculates the height of the image so that its aspect ratio is preserved.
If the given width is 0 or negative, a null image is returned.
Definition at line 4615 of file qimage.cpp.
uchar * QImage::scanLine | ( | int | i | ) |
Returns a pointer to the pixel data at the scanline with index i.
The first scanline is at index 0.
The scanline data is aligned on a 32-bit boundary.
QRgb*
(QRgb has a 32-bit size) and use it to read/write the pixel value. You cannot use the uchar*
pointer directly, because the pixel format depends on the byte order on the underlying platform. Use qRed(), qGreen(), qBlue(), and qAlpha() to access the pixels.Definition at line 1886 of file qimage.cpp.
Referenced by QPdfEnginePrivate::addImage(), QFontEngineMac::alphaMapForGlyph(), QFontEngineDirectWrite::alphaMapForGlyph(), QFontEngineXLFD::alphaMapForGlyph(), QFontEngineQPF::alphaMapForGlyph(), QFontEngine::alphaMapForGlyph(), QFontEngineQPF1::alphaMapForGlyph(), alphaMapFromPath(), QFontEngineWin::alphaRGBMapForGlyph(), QFontEngine::alphaRGBMapForGlyph(), blit180(), blit270(), blit90(), blit_template(), QWindowSurface::buffer(), QRasterBuffer::colorizeBitmap(), colorizeBitmap(), compressHelper(), convertWithPalette(), convolute(), copy(), create32BitCursor(), QX11PixmapData::createBitmapFromImage(), QDirectFBScreen::createDFBSurface(), createHeuristicMask(), createMaskFromColor(), QGIFFormat::disposePrevious(), QRasterPaintEngine::drawBitmap(), QMacStylePrivate::drawColorlessButton(), QPSPrintEnginePrivate::drawImage(), QGIFFormat::fillRect(), QGLTextureGlyphCache::fillTexture(), QImageTextureGlyphCache::fillTexture(), QXlibWindowSurface::flush(), QRasterWindowSurface::flush(), QRasterBuffer::flushToARGBImage(), QBitmap::fromData(), QX11PixmapData::fromImage(), QPixmap::fromWinHBITMAP(), QPixmap::fromWinHICON(), QCommonStyle::generatedIconPixmap(), QWindowSurface::grabWidget(), QVNCIntegration::grabWindow(), grayscale(), QFontEngineDirectWrite::imageForGlyph(), QPixmapData::mask(), mygetcanvasline(), operator==(), QColorLuminancePicker::paintEvent(), pixel(), pixelIndex(), qGamma_correct_back_to_linear_cs(), qgl_byteSwapImage(), QImageScale::qimageCalcScaleInfo(), QTestLiteStaticInfoPrivate::qimageFromXImage(), qSmoothScaleImage(), qstring_to_xtp(), qt_bitmapToRegion(), qt_blurrow(), qt_createIconMask(), qt_write_dib(), qt_write_dibv5(), qt_x11_drawImage(), QVNCDirtyMap::QVNCDirtyMap(), QTiffHandler::read(), ICOReader::read16_24_32BMP(), ICOReader::read1BitBMP(), ICOReader::read4BitBMP(), ICOReader::read8BitBMP(), read_pbm_body(), read_xbm_body(), read_xpm_body(), QColorPicker::resizeEvent(), rgbSwapped(), QVNCCursor::sendClientCursor(), QRasterPixmapData::setMask(), QPixmapData::setMask(), setPixel(), QCursor::setPos(), QX11PixmapData::takeQImageFromXImage(), QMacPixmapData::toImage(), QRasterPixmapData::toImage(), QX11PixmapData::toImage(), QPixmap::toWinHBITMAP(), QPixmap::toWinHICON(), QTiffHandler::write(), QVNCClientCursor::write(), QRfbRawEncoder::write(), QRfbHextileEncoder< SRC >::write(), write_pbm_image(), write_xbm_image(), and write_xpm_image().
const uchar * QImage::scanLine | ( | int | i | ) | const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 1903 of file qimage.cpp.
int QImage::serialNumber | ( | ) | const |
Returns a number that identifies the contents of this QImage object.
Use cacheKey() instead.
Definition at line 6267 of file qimage.cpp.
Referenced by QRasterPixmapData::createPixmapForImage(), QTextCursor::insertImage(), QRasterPixmapData::resize(), and QAhiScreenCursor::set().
void QImage::setAlphaChannel | ( | const QImage & | alphaChannel | ) |
Sets the alpha channel of this image to the given alphaChannel.
If alphaChannel is an 8 bit grayscale image, the intensity values are written into this buffer directly. Otherwise, alphaChannel is converted to 32 bit and the intensity of the RGB pixel values is used.
Note that the image will be converted to the Format_ARGB32_Premultiplied format if the function succeeds.
Use one of the composition modes in QPainter::CompositionMode instead.
Definition at line 6329 of file qimage.cpp.
Referenced by QPixmapColorizeFilter::draw(), QFileSystemModel::headerData(), ICOReader::iconAt(), QRasterPixmapData::setAlphaChannel(), QX11PixmapData::setAlphaChannel(), QVolatileImage::setAlphaChannel(), and QPixmapData::setAlphaChannel().
void QImage::setColor | ( | int | index, |
QRgb | colorValue | ||
) |
Sets the color at the given index in the color table, to the given to colorValue.
The color value is an ARGB quadruplet.
If index is outside the current size of the color table, it is expanded with setColorCount().
Definition at line 1850 of file qimage.cpp.
Referenced by alphaChannel(), QFontEngineQPF::alphaMapForGlyph(), QFontEngineQPF1::alphaMapForGlyph(), QX11PixmapData::createBitmapFromImage(), QWSCursor::createDropShadow(), createHeuristicMask(), QPlastiqueStyle::drawComplexControl(), QCleanlooksStyle::drawComplexControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QWindowsMobileStyle::drawPrimitive(), QPlastiqueStyle::drawPrimitive(), QCleanlooksStyle::drawPrimitive(), QWindowsMobileStylePrivate::drawScrollbarGroove(), ensureValidImage(), QGLPixmapData::fillImage(), QBitmap::fromData(), QBitmap::fromImage(), QMacPixmapData::fromImage(), get_index(), makeBitmapCompliantIfNeeded(), QPixmapData::mask(), read_dib_body(), read_pbm_body(), read_xbm_body(), read_xpm_body(), ICOReader::readColorTable(), QRasterPixmapData::resize(), setup_qt(), QWindowsMobileStyle::standardPixmap(), QMotifStyle::standardPixmap(), QGtkStyle::standardPixmap(), swapPixel01(), QMacPixmapData::toImage(), and QX11PixmapData::toImage().
void QImage::setColorCount | ( | int | colorCount | ) |
Resizes the color table to contain colorCount entries.
If the color table is expanded, all the extra colors will be set to transparent (i.e qRgba(0, 0, 0, 0)).
When the image is used, the color table must be large enough to have entries for all the pixel/index values present in the image, otherwise the results are undefined.
Definition at line 2275 of file qimage.cpp.
Referenced by alphaChannel(), createHeuristicMask(), ensureValidImage(), QGLPixmapData::fillImage(), QX11PixmapData::fromImage(), get_index(), ICOReader::iconAt(), QPixmapData::mask(), QImage(), read_dib_body(), read_pbm_body(), read_xbm_body(), read_xpm_body(), ICOReader::readColorTable(), QRasterPixmapData::resize(), setColor(), setNumColors(), setup_qt(), QMacPixmapData::toImage(), and QX11PixmapData::toImage().
Sets the color table used to translate color indexes to QRgb values, to the specified colors.
When the image is used, the color table must be large enough to have entries for all the pixel/index values present in the image, otherwise the results are undefined.
Definition at line 1744 of file qimage.cpp.
Referenced by QProxyFontEngine::alphaMapForGlyph(), QFontEngineXLFD::alphaMapForGlyph(), QFontEngineBox::alphaMapForGlyph(), QGLPixmapDropShadowFilter::processGL(), and QTiffHandler::read().
void QImage::setDotsPerMeterX | ( | int | x | ) |
Sets the number of pixels that fit horizontally in a physical meter, to x.
Together with dotsPerMeterY(), this number defines the intended scale and aspect ratio of the image, and determines the scale at which QPainter will draw graphics on the image. It does not change the scale or aspect ratio of the image when it is rendered on other paint devices.
Definition at line 5645 of file qimage.cpp.
Referenced by convertToFormat(), qt_read_dibv5(), QTiffHandler::read(), read_dib_body(), QPngHandlerPrivate::readPngImage(), setImageMetrics(), and setPixel().
void QImage::setDotsPerMeterY | ( | int | y | ) |
Sets the number of pixels that fit vertically in a physical meter, to y.
Together with dotsPerMeterX(), this number defines the intended scale and aspect ratio of the image, and determines the scale at which QPainter will draw graphics on the image. It does not change the scale or aspect ratio of the image when it is rendered on other paint devices.
Definition at line 5667 of file qimage.cpp.
Referenced by convertToFormat(), qt_read_dibv5(), QTiffHandler::read(), read_dib_body(), QPngHandlerPrivate::readPngImage(), setImageMetrics(), and setPixel().
void QImage::setNumColors | ( | int | numColors | ) |
Resizes the color table to contain numColors entries.
Definition at line 2252 of file qimage.cpp.
void QImage::setOffset | ( | const QPoint & | offset | ) |
Sets the number of pixels by which the image is intended to be offset by when positioning relative to other images, to offset.
Definition at line 5705 of file qimage.cpp.
Referenced by QPngHandlerPrivate::readPngImage().
void QImage::setPixel | ( | int | x, |
int | y, | ||
uint | index_or_rgb | ||
) |
Sets the pixel index or color at (x, y) to index_or_rgb.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4311 of file qimage.cpp.
Referenced by QGLGlyphCache::allocTexture(), QFontEngineBox::alphaMapForGlyph(), QRasterBuffer::bufferImage(), QWSCursor::createDropShadow(), darkenPixmap(), drawEllipse_midpoint_i(), QWindowsMobileStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), qt_patternForAlpha(), and QTgaFile::readImage().
Q_GUI_EXPORT_INLINE void QImage::setPixel | ( | const QPoint & | position, |
uint | index_or_rgb | ||
) |
Sets the pixel index or color at the given position to index_or_rgb.
If the image's format is either monochrome or 8-bit, the given index_or_rgb value must be an index in the image's color table, otherwise the parameter must be a QRgb value.
If position is not a valid coordinate pair in the image, or if index_or_rgb >= colorCount() in the case of monochrome and 8-bit images, the result is undefined.
detach()
function called within; if performance is a concern, we recommend the use of QImage::scanLine() to access pixel data directly.Definition at line 357 of file qimage.h.
Sets the image text to the given text and associate it with the given key.
If you just want to store a single text block (i.e., a "comment" or just a description), you can either pass an empty key, or use a generic key like "Description".
The image text is embedded into the image data when you call save() or QImageWriter::write().
Not all image formats support embedded text. You can find out if a specific image or format supports embedding text by using QImageWriter::supportsOption(). We give an example:
You can use QImageWriter::supportedImageFormats() to find out which image formats are available to you.
Definition at line 5780 of file qimage.cpp.
Referenced by QPngHandlerPrivate::readPngImage().
void QImage::setText | ( | const char * | key, |
const char * | language, | ||
const QString & | text | ||
) |
Sets the image text to the given text and associate it with the given key. The text is recorded in the specified language, or in a default language if language is 0.
Use setText() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Definition at line 5920 of file qimage.cpp.
QSize QImage::size | ( | ) | const |
Returns the size of the image, i.
\sa {QImage#Image Information}{Image Information}
Definition at line 1587 of file qimage.cpp.
Referenced by blendCursor(), QTransformedScreen::blit(), QScreen::blit(), QWindowSurface::buffer(), colorizeBitmap(), QPaintBuffer::commandDescription(), convertWithPalette(), createMaskFromColor(), QGLPixmapData::createPixmapForImage(), QPixmapColorizeFilter::draw(), QDirectFBPaintEngine::drawImage(), QBlitterPaintEngine::drawImage(), QGL2PaintEngineEx::drawImage(), QVGPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QPaintEngineEx::drawImage(), QPaintBufferEngine::drawImage(), QCleanlooksStyle::drawPrimitive(), ensureValidImage(), QWindowSurface::grabWidget(), grayscale(), QStyledItemDelegate::initStyleOption(), QGLPixmapData::paintEngine(), QGLPixmapDropShadowFilter::processGL(), QImage(), qt_read_dibv5(), QTiffHandler::read(), read_dib_body(), read_pbm_body(), read_xbm_body(), read_xpm_body(), readImage(), QMinimalWindowSurface::resize(), QFbWindowSurface::resize(), scaled(), QVNCCursor::sendClientCursor(), QProxyScreenCursor::set(), QScreenCursor::set(), QDirectFBScreenCursor::set(), QWSLocalMemSurface::setGeometry(), QWSSharedMemSurface::setGeometry(), setup_qt(), QWaylandShmBuffer::size(), toVGImageWithOpacity(), QGL2PaintEngineExPrivate::updateBrushTexture(), and QVNCClientCursor::write().
|
inline |
Returns the image text associated with the given key.
If the specified key is an empty string, the whole image text is returned, with each key-text pair separated by a newline.
Definition at line 5736 of file qimage.cpp.
Referenced by convertWithPalette(), and set_text().
QString QImage::text | ( | const char * | key, |
const char * | language = 0 |
||
) | const |
Returns the text recorded for the given key in the given language, or in a default language if language is 0.
Use text() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Definition at line 5802 of file qimage.cpp.
QString QImage::text | ( | const QImageTextKeyLang & | keywordAndLanguage | ) | const |
Returns the text recorded for the given keywordAndLanguage.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Use text() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Definition at line 5827 of file qimage.cpp.
QStringList QImage::textKeys | ( | ) | const |
Returns the text keys for this image.
You can use these keys with text() to list the image text for a certain key.
Definition at line 5724 of file qimage.cpp.
Referenced by set_text(), textLanguages(), and textList().
QStringList QImage::textLanguages | ( | ) | const |
Returns the language identifiers for which some texts are recorded.
Note that if you want to iterate over the list, you should iterate over a copy.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Definition at line 5850 of file qimage.cpp.
QList< QImageTextKeyLang > QImage::textList | ( | ) | const |
Returns a list of QImageTextKeyLang objects that enumerate all the texts key/language pairs set for this image.
Use textKeys() instead.
The language the text is recorded in is no longer relevant since the text is always set using QString and UTF-8 representation.
Definition at line 5879 of file qimage.cpp.
QImage QImage::transformed | ( | const QMatrix & | matrix, |
Qt::TransformationMode | mode = Qt::FastTransformation |
||
) | const |
Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.
The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.
Definition at line 4698 of file qimage.cpp.
Referenced by QFontEngine::alphaMapForGlyph(), QFontEngineMac::alphaRGBMapForGlyph(), QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QTiffHandler::read(), scaled(), scaledToHeight(), scaledToWidth(), QDirectFBPixmapData::transformed(), and QX11PixmapData::transformed().
QImage QImage::transformed | ( | const QTransform & | matrix, |
Qt::TransformationMode | mode = Qt::FastTransformation |
||
) | const |
Returns a copy of the image that is transformed using the given transformation matrix and transformation mode.
The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.
Unlike the other overload, this function can be used to perform perspective transformations on images.
Definition at line 6757 of file qimage.cpp.
Returns the actual matrix used for transforming an image with the given width, height and matrix.
When transforming an image using the transformed() function, the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest image containing all transformed points of the original image. This function returns the modified matrix, which maps points correctly from the original image into the new image.
Definition at line 4680 of file qimage.cpp.
Referenced by transformed(), and QPixmap::trueMatrix().
|
static |
Returns the actual matrix used for transforming an image with the given width, height and matrix.
When transforming an image using the transformed() function, the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest image containing all transformed points of the original image. This function returns the modified matrix, which maps points correctly from the original image into the new image.
Unlike the other overload, this function creates transformation matrices that can be used to perform perspective transformations on images.
Definition at line 6927 of file qimage.cpp.
bool QImage::valid | ( | int | x, |
int | y | ||
) | const |
Returns true if QPoint(x, y) is a valid coordinate pair within the image; otherwise returns false.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 4165 of file qimage.cpp.
Q_GUI_EXPORT_INLINE bool QImage::valid | ( | const QPoint & | pos | ) | const |
Returns true if pos is a valid coordinate pair within the image; otherwise returns false.
Definition at line 354 of file qimage.h.
int QImage::width | ( | ) | const |
Returns the width of the image.
Definition at line 1557 of file qimage.cpp.
Referenced by QFontEngine::addBitmapFontToPath(), QPdfEnginePrivate::addBrushPattern(), QPdfEnginePrivate::addImage(), QFontEngineXLFD::addOutlineToPath(), allGray(), QAlphaWidget::alphaBlend(), QFontEngineMac::alphaMapForGlyph(), QFontEngineDirectWrite::alphaMapForGlyph(), QFontEngineXLFD::alphaMapForGlyph(), QFontEngine::alphaMapForGlyph(), alphaMapFromPath(), QFontEngine::alphaRGBMapForGlyph(), QX11PixmapData::bitmapFromImage(), QAhiScreen::blit(), QGLGlyphCache::cacheGlyphs(), QProxyFontEngine::canRender(), checkForAlphaPixels(), colorizeBitmap(), compressHelper(), convert_indexed8_to_ARGB_PM_inplace(), convert_indexed8_to_RGB16_inplace(), convert_indexed8_to_RGB_inplace(), QMacPasteboardMimeTiff::convertFromMime(), convertWithPalette(), convolute(), QImageData::create(), create32BitCursor(), QX11PixmapData::createBitmapFromImage(), QDirectFBScreen::createDFBSurface(), createHeuristicMask(), QVGPixmapData::createPixmapForImage(), QGLPixmapData::createPixmapForImage(), darkenPixmap(), QGIFFormat::decode(), QRasterPaintEngine::drawBitmap(), QCleanlooksStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QPlastiqueStyle::drawControl(), QCleanlooksStyle::drawControl(), QVGCompositionHelper::drawCursorPixmap(), QPdfEngine::drawImage(), QCoreGraphicsPaintEngine::drawImage(), QPSPrintEnginePrivate::drawImage(), QGL2PaintEngineEx::drawImage(), QOpenGLPaintEngine::drawImage(), QVGPaintEngine::drawImage(), QPaintEngine::drawImage(), QRasterPaintEngine::drawImage(), QRasterPaintEnginePrivate::drawImage(), QPainter::drawImage(), QPSPrintEnginePrivate::drawImageHelper(), QPSPrintEngine::drawImageInternal(), drawImageTiled(), QWindowsMobileStylePrivate::drawPanelItemViewSelected(), QPdfEngine::drawPixmap(), QPlastiqueStyle::drawPrimitive(), QRasterPaintEngine::drawTextItem(), QOpenGLPaintEngine::drawTiledPixmap(), expblur(), QRasterPixmapData::fill(), QGLTextureGlyphCache::fillTexture(), QImageTextureGlyphCache::fillTexture(), QXlibWindowSurface::flush(), QRasterBuffer::flushToARGBImage(), QVGFontEngineCleaner::fontEngineDestroyed(), format(), QBlittablePixmapData::fromImage(), QDirectFBPixmapData::fromImage(), QMacPixmapData::fromImage(), QX11PixmapData::fromImage(), QWindowsMobileStyle::generatedIconPixmap(), QCommonStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), getImageSize(), QVNCIntegration::grabWindow(), grayscale(), ICOReader::iconAt(), QFontEngineMac::imageForGlyph(), QMeeGoPixmapData::imageToEGLSharedImage(), QFontEngineQPF::loadGlyph(), QPixmapData::mask(), mirrored(), operator==(), QWSLocalMemSurface::permanentState(), QWSSharedMemSurface::permanentState(), QRasterBuffer::prepare(), QRasterWindowSurface::prepareBuffer(), QGLPixmapBlurFilter::processGL(), QGLPixmapDropShadowFilter::processGL(), qBrushDark(), qBrushLight(), qBrushSetAlphaF(), qGamma_correct_back_to_linear_cs(), qgl_byteSwapImage(), QImageScale::qimageCalcScaleInfo(), QTestLiteStaticInfoPrivate::qimageFromXImage(), QMacCGContext::QMacCGContext(), qSmoothScaleImage(), qstring_to_xtp(), QSvgImage::QSvgImage(), qt_bitmapToRegion(), qt_blurImage(), qt_blurrow(), qt_createIconMask(), qt_halfScaled(), qt_mac_cg_context(), qt_mac_createCGImageFromQImage(), qt_mac_image_to_cgimage(), qt_scrollRectInImage(), qt_write_dib(), qt_write_dibv5(), rotate_right_mirror_horizontal(), rotate_right_mirror_vertical(), rotated270(), rotated90(), scaled(), scaledToWidth(), QItemDelegate::selected(), QVNCCursor::sendClientCursor(), QAhiScreenCursor::set(), QRasterPixmapData::setMask(), QPixmapData::setMask(), setPixel(), QMacStyle::styleHint(), QX11PixmapData::takeQImageFromXImage(), toVGImage(), QPixmap::toWinHBITMAP(), transformed(), QMeeGoPixmapData::updateFromSoftImage(), QVolatileImage::width(), QNativeImage::width(), QTiffHandler::write(), QBmpHandler::write(), QVNCClientCursor::write(), ICOReader::write(), write_jpeg_image(), write_pbm_image(), write_xbm_image(), write_xpm_image(), QMngHandlerPrivate::writeImage(), QPNGImageWriter::writeImage(), and QTextOdfWriter::writeInlineCharacter().
|
related |
Writes the given image to the given stream as a PNG image, or as a BMP image if the stream's version is 1.
Note that writing the stream to a file will not produce a valid image file.
Definition at line 5406 of file qimage.cpp.
|
related |
Reads an image from the given stream and stores it in the given image.
Definition at line 5435 of file qimage.cpp.
|
friend |
|
friend |
|
friend |
Definition at line 122 of file qimage.cpp.
|
friend |
Definition at line 117 of file qimage.cpp.
|
friend |
|
private |
Definition at line 336 of file qimage.h.
Referenced by allGray(), alphaChannel(), bits(), byteCount(), bytesPerLine(), color(), colorCount(), colorTable(), constBits(), constScanLine(), convert_RGB_to_Indexed8(), convertToFormat(), copy(), QImageData::create(), createAlphaMask(), createHeuristicMask(), createMaskFromColor(), QRasterPixmapData::createPixmapForImage(), depth(), detach(), dither_to_Mono(), QRasterPixmapData::fill(), fill(), format(), height(), invertPixels(), isGrayscale(), isNull(), QRasterPixmapData::metric(), mirrored(), numBytes(), numColors(), operator=(), operator==(), operator>>(), pixel(), pixelIndex(), QImage(), QPixmapCacheEntry::QPixmapCacheEntry(), qt_image_colortable(), rect(), rgbSwapped(), save(), scaled(), scaledToHeight(), scaledToWidth(), scanLine(), setAlphaChannel(), setColor(), setColorCount(), setColorTable(), setPixel(), size(), swap(), transformed(), valid(), width(), and ~QImage().