The color table is a QVector, and the QRgb typedef is equivalent to an unsigned int containing an ARGB quadruplet on the format 0xAARRGGBB.ģ2-bit images have no color table instead, each pixel contains an QRgb value. There are two different types of monochrome images: big endian (MSB first) or little endian (LSB first) bit order.Ĩ-bit images are stored using 8-bit indexes into a color table, i.e. Monochrome images are stored using 1-bit indexes into a color table with at most two colors. supports several image formats described by the QImage.Format enum. The size of the integer varies depending on the format. For more information see the Image Formats section.Įach pixel stored in a is represented by an integer. The () function tells how many of those bits that are used. The supported depths are 1 (monochrome), 8, 16, 24 and 32 bits. The () function returns the depth of the image. Use the () function to alter an image’s text. An image’s text keys can be retrieved using the () function. The () function returns the image text associated with the given text key. See also the Pixel Manipulation and Image Transformations sections. The () and () functions tell whether an image’s colors are all shades of gray. The () function tells if the image’s format respects the alpha channel, or not. Note that if you create an 8-bit image manually, you have to set a valid color table on the image as well. To obtain a single entry, use the () function to retrieve the pixel index for a given pair of coordinates, then use the () function to retrieve the color. In case of monochrome and 8-bit images, the () and () functions provide information about the color components used to store the image data: The () function returns the image’s entire color table. By default, Qt supports the following formats: Format New file formats can be added as plugins. The complete list of supported file formats are available through the QImageReader.supportedImageFormats() and QImageWriter.supportedImageFormats() functions. Simply call the () function to save a object. See The Qt Resource System overview for details on how to embed images and other resource files in the application’s executable. 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. also provides the static () function, constructing a from the given data. provides several ways of loading an image file: The file can be loaded when constructing the object, or by using the () or () functions later on. objects can also be streamed and compared. objects can be passed around by value since the class uses implicit data sharing. There are also several functions that enables transformation of the image. provides a collection of functions that can be used to obtain a variety of information about the image. These include monochrome, 8-bit, 32-bit and alpha-blended images which are available in all versions of Qt 4.x. The class supports several image formats described by the QImage.Format enum. When using on a, the painting can be performed in another thread than the current GUI thread. Finally, the class is a paint device that records and replays commands.īecause is a subclass, can be used to draw directly onto images. is only a convenience class that inherits, ensuring a depth of 1. is designed and optimized for I/O, and for direct pixel access and manipulation, while is designed and optimized for showing images on screen. Qt provides four classes for handling image data:, , and. The class provides a hardware-independent image representation that allows direct access to the pixel data, and can be used as a paint device.
0 Comments
Leave a Reply. |