CopperSpice API
1.9.2
|
Off-screen image representation which can be used as a paint device. More...
Public Methods | |
QPixmap () | |
QPixmap (const char *const xpm[]) | |
QPixmap (const QPixmap &pixmap) | |
QPixmap (const QSize &size) | |
QPixmap (const QString &fileName, const QString &format=QString (), Qt::ImageConversionFlags flags=Qt::AutoColor) | |
QPixmap (int width, int height) | |
~QPixmap () | |
qint64 | cacheKey () const |
bool | convertFromImage (const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor) |
QPixmap | copy (const QRect &rect=QRect ()) const |
QPixmap | copy (int x, int y, int width, int height) const |
QBitmap | createHeuristicMask (bool clipTight=true) const |
QBitmap | createMaskFromColor (const QColor &maskColor, Qt::MaskMode mode=Qt::MaskInColor) const |
int | depth () const |
void | detach () |
qreal | devicePixelRatio () const |
void | fill (const QColor &fillColor=Qt::white) |
void | fill (const QPaintDevice *device, const QPoint &offset) |
void | fill (const QPaintDevice *device, int xOffset, int yOffset) |
QPlatformPixmap * | handle () const |
bool | hasAlpha () const |
bool | hasAlphaChannel () const |
int | height () const |
bool | isNull () const |
bool | isQBitmap () const |
bool | load (const QString &fileName, const QString &format=QString (), Qt::ImageConversionFlags flags=Qt::AutoColor) |
bool | loadFromData (const QByteArray &imageData, const QString &format=QString (), Qt::ImageConversionFlags flags=Qt::AutoColor) |
bool | loadFromData (const uchar *imageData, uint len, const QString &format=QString (), Qt::ImageConversionFlags flags=Qt::AutoColor) |
QBitmap | mask () const |
operator QVariant () const | |
bool | operator! () const |
QPixmap & | operator= (const QPixmap &other) |
QPixmap & | operator= (QPixmap &&other) |
QPaintEngine * | paintEngine () const override |
QRect | rect () const |
bool | save (const QString &fileName, const QString &format=QString (), int quality=-1) const |
bool | save (QIODevice *device, const QString &format=QString (), int quality=-1) const |
QPixmap | scaled (const QSize &size, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
QPixmap | scaled (int width, int height, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
QPixmap | scaledToHeight (int height, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
QPixmap | scaledToWidth (int width, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
void | scroll (int dx, int dy, const QRect &rect, QRegion *exposed=nullptr) |
void | scroll (int dx, int dy, int x, int y, int width, int height, QRegion *exposed=nullptr) |
void | setDevicePixelRatio (qreal scaleFactor) |
void | setMask (const QBitmap &mask) |
QSize | size () const |
void | swap (QPixmap &other) |
QImage | toImage () const |
QPixmap | transformed (const QMatrix &matrix, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
QPixmap | transformed (const QTransform &transform, Qt::TransformationMode transformMode=Qt::FastTransformation) const |
int | width () const |
Public Methods inherited from QPaintDevice | |
virtual | ~QPaintDevice () |
int | colorCount () const |
int | depth () const |
int | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
Static Public Methods | |
static int | defaultDepth () |
static QPixmap | fromImage (const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor) |
static QPixmap | fromImage (QImage &&image, Qt::ImageConversionFlags flags=Qt::AutoColor) |
static QPixmap | fromImageReader (QImageReader *imageReader, Qt::ImageConversionFlags flags=Qt::AutoColor) |
static QPixmap | grabWidget (QObject *widget, const QRect &rect) |
static QPixmap | grabWidget (QObject *widget, int x=0, int y=0, int width=-1, int height=-1) |
static QPixmap | grabWindow (WId window, int x=0, int y=0, int width=-1, int height=-1) |
static QMatrix | trueMatrix (const QMatrix &matrix, int width, int height) |
static QTransform | trueMatrix (const QTransform &transform, int width, int height) |
Protected Methods | |
int | metric (PaintDeviceMetric) const override |
Protected Methods inherited from QPaintDevice | |
QPaintDevice () | |
Friends | |
QDataStream & | operator>> (QDataStream &stream, QPixmap &pixmap) |
class | QBitmap |
class | QOpenGLWidget |
class | QPaintDevice |
class | QPainter |
class | QPlatformPixmap |
Related Functions | |
These are not member functions | |
QDataStream & | operator<< (QDataStream &stream, const QPixmap &pixmap) |
Additional Inherited Members | |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric |
The QPixmap class is an off-screen image representation which can be used as a paint device. CopperSpice provides four different classes for handling image data.
A QPixmap can easily be displayed on the screen using QLabel or one of QAbstractButton's subclasses such as QPushButton and QToolButton. A QPixmap can be created using a constructor or the static grabWidget() and grabWindow() methods. Using the later approach creates a QPixmap and then paints the given widget or window, into the new QPixmap.
QPixmap objects can be passed by value since the QPixmap class uses implicit data sharing. For more information refer to the Implicit Data Sharing documentation. QPixmap objects can also be streamed.
The pixel data in a pixmap is internal and is managed by the underlying window system. Because QPixmap inherits form QPaintDevice a QPainter can be used to draw directly on a pixmap. Pixels can only be accessed through QPainter methods or by converting the QPixmap to a QImage. Use the fill() method to initialize the entire pixmap with a given color.
There are methods to convert between QImage and QPixmap. Typically, the QImage class is used to load an image file, optionally manipulating the image data, before the QImage object is converted into a QPixmap to be shown on screen. Alternatively, if no manipulation is desired, the image file can be loaded directly into a QPixmap. On Windows the QPixmap class also supports conversion between HBITMAP
and QPixmap.
QPixmap provides a collection of methods which can be used to obtain a variety of information about the pixmap. In addition, there are several methods which enable transformation of the pixmap.
QPixmap provides several ways to read an image file.
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. Refer to the Resource System overview for details on how to embed images and other resource files in the application's executable.
The complete list of supported file formats are available through the QImageReader::supportedImageFormats() and QImageWriter::supportedImageFormats() methods. New file formats can be added as plugins. By default CopperSpice supports the following formats.
Format | Description | CopperSpice 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 |
XBM | X11 Bitmap | Read/write |
XPM | X11 Pixmap | Read/write |
QPixmap provides a collection of methods that can be used to obtain a variety of information about the pixmap:
Available Functions | |
---|---|
Geometry | The size(), width() and height() methods provide information about the pixmap's size. The rect() method returns the image's enclosing rectangle. |
Alpha component | The hasAlphaChannel() returns true if the pixmap has a format that respects the alpha channel, otherwise returns false. The hasAlpha(), setMask() and mask() methods are legacy and should not be used. They are potentially very slow. The createHeuristicMask() method creates and returns a 1-bpp heuristic mask (i.e. a QBitmap) for this pixmap. It works by selecting a color from one of the corners and then chipping away pixels of that color, starting at all the edges. The createMaskFromColor() method creates and returns a mask (i.e. a QBitmap) for the pixmap based on a given color. |
Low-level information | The depth() method returns the depth of the pixmap. The defaultDepth() method returns the default depth, which is the depth used by the application on the given screen. The cacheKey() method returns a number that uniquely identifies the contents of the QPixmap object. |
A QPixmap object can be converted into a QImage using the toImage() method. Likewise, a QImage can be converted into a QPixmap using the fromImage(). If this is too expensive an operation use QBitmap::fromImage() instead.
QPixmap supports a number of methods for creating a new pixmap that is a transformed version of the original:
The scaled(), scaledToWidth() and scaledToHeight() methods return scaled copies of the pixmap, while the copy() method creates a QPixmap that is a plain copy of the original one.
The transformed() method returns a copy of the pixmap 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 pixmap containing all transformed points of the original pixmap. The static trueMatrix() method returns the actual matrix used for transforming the pixmap.
QPixmap::QPixmap | ( | ) |
Constructs a null pixmap.
QPixmap::QPixmap | ( | int | width, |
int | height | ||
) |
Constructs a pixmap with the given width and height. If either width or height is zero then a null QPixmap is constructed.
This constructor will create a QPixmap with uninitialized data. The fill() method can be used to initialize the pixmap with an appropriate color before drawing onto it with QPainter.
|
explicit |
QPixmap::QPixmap | ( | const QString & | fileName, |
const QString & | format = QString() , |
||
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) |
Constructs a pixmap from the file with the given fileName. If the file does not exist or is of an unknown format the pixmap becomes a null pixmap.
The loader attempts to read the pixmap 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.
The file name can either refer to an actual file on disk or to one of the application's embedded resources. Refer to the Resource System overview for details on how to embed images and other resource files in the application's executable.
If the image needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.
The fileName, format and flags parameters are passed on to load(). This means that the data in fileName is not compiled into the binary. If fileName contains a relative path (e.g. the filename only) the relevant file must be found relative to the runtime working directory.
|
explicit |
Constructs a pixmap from the given xpm data, which must be a valid XPM image. Errors are silently ignored.
It is possible to make the XPM variable a bit more efficient bit by using an unusual declaration like the following:
The extra const
makes the entire definition read-only, which is slightly more efficient (for example, when the code is in a shared library) and ROMable when the application is to be stored in ROM.
QPixmap::QPixmap | ( | const QPixmap & | pixmap | ) |
Constructs a pixmap that is a copy of the given pixmap.
QPixmap::~QPixmap | ( | ) |
Destroys the pixmap.
qint64 QPixmap::cacheKey | ( | ) | const |
Returns a number that identifies this QPixmap. Distinct QPixmap objects can only have the same cache key if they refer to the same contents.
The cacheKey() will change when the pixmap is altered.
bool QPixmap::convertFromImage | ( | const QImage & | image, |
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) |
Replaces this pixmap's data with the given image using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options.
Returns true if the result is that this pixmap is not null.
Returns a deep copy of the subset of the pixmap that is specified by the given rect. If the given rectangle is empty the whole image is copied. For more information refer to the Implicit Data Sharing documentation.
|
inline |
Returns a deep copy of the subset of the pixmap that is specified by the rectangle QRect( x, y, width, height).
QBitmap QPixmap::createHeuristicMask | ( | bool | clipTight = true | ) | const |
Creates and returns a heuristic mask for this pixmap.
The method works by selecting a color from one of the corners and then chipping away pixels of that color, starting at all the edges. 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.
The mask may not be perfect but it should be reasonable, so you can do things such as the following:
This method is slow because it involves converting to/from a QImage, and non-trivial computations.
QBitmap QPixmap::createMaskFromColor | ( | const QColor & | maskColor, |
Qt::MaskMode | mode = Qt::MaskInColor |
||
) | const |
Creates and returns a mask for this pixmap based on the given maskColor. If the mode is Qt::MaskInColor, all pixels matching the maskColor will be transparent. If mode is Qt::MaskOutColor, all pixels matching the maskColor will be opaque.
This method is slow because it involves converting to/from a QImage.
|
static |
Returns the default pixmap depth used by the application. On Windows and Mac, the default depth is always 32. On X11 and embedded, the depth of the screen will be returned by this method.
int QPixmap::depth | ( | ) | const |
Returns the depth of the pixmap. The pixmap depth is also called bits per pixel (bpp) or bit planes of a pixmap. A null pixmap has a depth 0.
void QPixmap::detach | ( | ) |
Detaches the pixmap from shared pixmap data.
A pixmap is automatically detached by CopperSpice whenever its contents are about to change. This is done in almost all QPixmap member methods that modify the pixmap (fill(), fromImage(), load(), etc.), and in QPainter::begin() on a pixmap.
There are two exceptions in which detach() must be called explicitly, that is when calling the handle() or the x11PictureHandle() method (only available on X11). Otherwise, any modifications done using system calls, will be performed on the shared data.
The detach() method returns immediately if there is just a single reference or if the pixmap has not been initialized yet.
qreal QPixmap::devicePixelRatio | ( | ) | const |
Returns the device pixel ratio for the pixmap. This is the ratio between "device pixels" and "device independent pixels". Use this method when calculating layout geometry based on the pixmap size. The default value is 1.0.
void QPixmap::fill | ( | const QColor & | fillColor = Qt::white | ) |
Fills the current pixmap with the given fillColor. The effect of this method is undefined if the pixmap is currently being used as the target of a QPainter.
void QPixmap::fill | ( | const QPaintDevice * | device, |
const QPoint & | offset | ||
) |
Fills the pixmap with the widget's background color or pixmap according to the given offset.
The QPoint offset defines a point in widget coordinates to which the pixmap's top-left pixel will be mapped to. This is only significant if the widget has a background pixmap, otherwise the pixmap will simply be filled with the background color of the widget.
|
inline |
Fills the pixmap with the widget's background color or pixmap. The given point, (xOffset, yOffset), defines an offset in widget coordinates to which the pixmap's top-left pixel will be mapped to.
|
static |
Converts the given image to a pixmap using the specified flags to control the conversion. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options.
In case of monochrome and 8-bit images, the image is first converted to a 32-bit pixmap and then filled with the colors in the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead.
|
inlinestatic |
Converts the given image to a pixmap without copying if possible.
|
static |
Create a QPixmap from an image read directly from an imageReader. The flags argument is a bitwise-OR of the Qt::ImageConversionFlags. Passing 0 for flags sets all the default options.
On some systems, reading an image directly to QPixmap can use less memory than reading a QImage to convert it to QPixmap.
Creates a pixmap and paints the given widget, restricted by the given rect. If the widget has any children, then they are also painted in the appropriate positions. If no rectangle is specified (the default) the entire widget is painted.
If widget is a nullptr, the specified rectangle does not overlap the widget's rectangle, or an error occurs, the method will return a null QPixmap. If the rectangle is a superset of the given widget, the areas outside the widget are covered with the widget's background.
This method actually asks widget to paint itself (and its children to paint themselves) by calling paintEvent() with painter redirection turned on. But QPixmap also provides the grabWindow() method which is a bit faster by grabbing pixels directly off the screen. In addition, if there are overlaying windows, grabWindow(), unlike grabWidget(), will see them.
|
inlinestatic |
Creates a pixmap and paints the given widget, restricted by QRect(x, y, width, height), in it.
|
static |
Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height).
The arguments (x, y) specify the offset in the window, whereas (width, height) specify the area to be copied. If width is negative this method copies everything to the right border of the window. If height is negative this method copies everything to the bottom of the window.
The window system identifier (WId
) can be retrieved using the QWidget::winId() method. The rationale for using a window identifier and not a QWidget, is to enable grabbing of windows that are not part of the application, window system frames, and so on.
The grabWindow() method grabs pixels from the screen, not from the window, i.e. if there is another window partially or entirely over the one you grab, you get pixels from the overlying window, too. The mouse cursor is generally not grabbed.
Note on X11 that if the given window does not have the same depth as the root window, and another window partially or entirely obscures the one you grab, you will not get pixels from the overlying window. The contents of the obscured areas in the pixmap will be undefined and uninitialized.
On Windows Vista and above grabbing a layered window, which is created by setting the Qt::WA_TranslucentBackground attribute, will not work. Instead grabbing the desktop widget should work.
QPlatformPixmap * QPixmap::handle | ( | ) | const |
Returns the pixmap's handle to the device context.
QPixmap uses implicit data sharing. The detach() metho must be called explicitly to ensure only this pixmap's data is modified if the pixmap data is shared. A pixmap does not have an X11 handle unless created with fromX11Pixmap(), or if the native graphics system is explicitly enabled.
This method is X11 specific and using it is non-portable.
bool QPixmap::hasAlpha | ( | ) | const |
Returns true if this pixmap has an alpha channel or has a mask, otherwise returns false.
bool QPixmap::hasAlphaChannel | ( | ) | const |
Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false.
int QPixmap::height | ( | ) | const |
Returns the height of the pixmap.
bool QPixmap::isNull | ( | ) | const |
Returns true if this is a null pixmap, otherwise returns false. A null pixmap has zero width, zero height and no contents. You can not draw in a null pixmap.
bool QPixmap::isQBitmap | ( | ) | const |
Returns true if this is a QBitmap, otherwise returns false.
bool QPixmap::load | ( | const QString & | fileName, |
const QString & | format = QString() , |
||
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) |
Loads a pixmap from the file with the given fileName. Returns true if the pixmap was successfully loaded, otherwise returns false.
The loader attempts to read the pixmap 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.
The file name can either refer to an actual file on disk or to one of the application's embedded resources. Refer to the Resource System overview for details on how to embed pixmaps and other resource files in the application's executable.
If the data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.
QPixmaps are automatically added to the QPixmapCache when loaded from a file, the key used is internal and can not be acquired.
|
inline |
Loads a pixmap from the binary imageData using the specified format and conversion flags.
bool QPixmap::loadFromData | ( | const uchar * | imageData, |
uint | len, | ||
const QString & | format = QString() , |
||
Qt::ImageConversionFlags | flags = Qt::AutoColor |
||
) |
Loads a pixmap from the len first bytes of the given binary imageData. Returns true if the pixmap was loaded successfully, otherwise returns false.
The loader attempts to read the pixmap 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 data needs to be modified to fit in a lower-resolution result (e.g. converting from 32-bit to 8-bit), use the flags to control the conversion.
QBitmap QPixmap::mask | ( | ) | const |
Extracts a bitmap mask from the pixmap's alpha channel. This can be an expensive operation.
|
overrideprotectedvirtual |
Returns the metric information for the given paint device metric.
Reimplemented from QPaintDevice::metric()
|
inline |
Returns true if this is a null pixmap, otherwise returns false.
QPixmap & QPixmap::operator= | ( | const QPixmap & | other | ) |
|
inline |
Move assigns from other and returns a reference to this object.
|
overridevirtual |
Returns a pointer to the paint engine used for drawing on the device.
Implements QPaintDevice::paintEngine()
QRect QPixmap::rect | ( | ) | const |
Returns the pixmap's enclosing rectangle.
bool QPixmap::save | ( | const QString & | fileName, |
const QString & | format = QString() , |
||
int | quality = -1 |
||
) | const |
Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. If format is empty then an image format will be chosen from fileName's suffix. Returns true if successful, otherwise returns false.
The quality factor must be in the range [0,100] or -1. Specify 0 to obtain small compressed files, 100 for large uncompressed files, and -1 to use the default settings.
bool QPixmap::save | ( | QIODevice * | device, |
const QString & | format = QString() , |
||
int | quality = -1 |
||
) | const |
This method writes a QPixmap to the given device using the specified image file format and the quality factor. This can be used to save a pixmap directly into a QByteArray.
QPixmap QPixmap::scaled | ( | const QSize & | size, |
Qt::AspectRatioMode | aspectMode = Qt::IgnoreAspectRatio , |
||
Qt::TransformationMode | transformMode = Qt::FastTransformation |
||
) | const |
Scales the pixmap to the given size, using the aspectMode and transformMode. If the given size is empty this method returns a null pixmap.
In some cases it can be more beneficial to draw the pixmap to a painter with a scale set rather than scaling the pixmap. This is the case when the painter is based on OpenGL or when the scale factor changes rapidly.
|
inline |
Returns a copy of the pixmap scaled to a rectangle with the given width and height according to the given aspectMode and transformMode. If either the width or the height is zero or negative, this method returns a null pixmap.
QPixmap QPixmap::scaledToHeight | ( | int | height, |
Qt::TransformationMode | transformMode = Qt::FastTransformation |
||
) | const |
Returns a scaled copy of the image. The returned image is scaled to the given height using the specified transformMode. The width of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.
If height is 0 or negative, a null pixmap is returned.
QPixmap QPixmap::scaledToWidth | ( | int | width, |
Qt::TransformationMode | transformMode = Qt::FastTransformation |
||
) | const |
Returns a scaled copy of the image. The returned image is scaled to the given width using the specified transformMode. The height of the pixmap is automatically calculated so that the aspect ratio of the pixmap is preserved.
If width is 0 or negative, a null pixmap is returned.
Scrolls the area rect of this pixmap by (dx, dy). The exposed region is left unchanged. You can optionally pass a pointer to an empty QRegion to get the region that is exposed by the scroll operation.
You can not scroll while there is an active painter on the pixmap.
|
inline |
Equivalent to calling QPixmap::scroll(dx, dy, QRect(x, y, width, height), exposed).
void QPixmap::setDevicePixelRatio | ( | qreal | scaleFactor | ) |
Sets the device pixel ratio for the pixmap. This is the ratio between image pixels and device-independent pixels. The default scaleFactor is 1.0.
Setting it to something else has two effects:
QPainters that are opened on the pixmap will be scaled. For example, painting on a 200x200 image if with a ratio of 2.0 will result in effective (device-independent) painting bounds of 100x100.
Methods in CopperSpice that calculate layout geometry based on the pixmap size will take the ratio into account. The net effect of this is that the pixmap is displayed as high DPI pixmap rather than a large pixmap.
void QPixmap::setMask | ( | const QBitmap & | mask | ) |
Sets a mask bitmap. This methods merges the mask with the pixmap's alpha channel. A pixel value of 1 on the mask means the pixmap's pixel is unchanged; a value of 0 means the pixel is transparent. The mask must have the same size as this pixmap. Setting a null mask resets the mask, leaving the previously transparent pixels black. The effect of this method is undefined when the pixmap is being painted on.
This can be an expensive operation.
|
inline |
Swaps pixmap other with this pixmap. This operation is very fast and never fails.
QImage QPixmap::toImage | ( | ) | const |
Converts the pixmap to a QImage. Returns a null image if the conversion fails.
If the pixmap has 1-bit depth, the returned image will also be 1 bit deep. Images with more bits will be returned in a format closely represents the underlying system. Usually this will be QImage::Format_ARGB32_Premultiplied for pixmaps with an alpha and QImage::Format_RGB32 or QImage::Format_RGB16 for pixmaps without alpha.
At this time the alpha masks on monochrome images are ignored.
QPixmap QPixmap::transformed | ( | const QMatrix & | matrix, |
Qt::TransformationMode | transformMode = Qt::FastTransformation |
||
) | const |
Converts the matrix into a QTransform and calls the overloaded method which takes a QTransform and a transformMode.
QPixmap QPixmap::transformed | ( | const QTransform & | transform, |
Qt::TransformationMode | transformMode = Qt::FastTransformation |
||
) | const |
Returns a copy of the pixmap that is transformed using the given transformation transform and transformMode. The original pixmap is not changed.
The transformation is internally adjusted to compensate for unwanted translation; i.e. the pixmap produced is the smallest pixmap that contains all the transformed points of the original pixmap. Use the trueMatrix() method to retrieve the actual matrix used for transforming the pixmap.
This methods is slow because it involves a transformation to a QImage, non-trivial computations, and a transformation back to a QPixmap.
Converts the matrix into a QTransform and calls the overloaded method which takes a QTransform, width, and height.
|
static |
Returns the actual matrix used for transforming a pixmap with the given width, height, and matrix.
When transforming a pixmap using the transformed() method, the transformation matrix is internally adjusted to compensate for unwanted translation, i.e. transformed() returns the smallest pixmap containing all transformed points of the original pixmap. This method returns the modified matrix, which maps points correctly from the original pixmap into the new pixmap.
int QPixmap::width | ( | ) | const |
Returns the width of the pixmap.
|
related |
Writes the pixmap to the stream and returns a reference to the stream. The image is written as a PNG image. Writing the stream to a file will not produce a valid image file.
Refer to Serializing Data Types for additional information.
|
friend |
Reads an image from the stream into the pixmap and returns a reference to the stream.
Refer to Serializing Data Types for additional information.