Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QPixmap

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QPixmap

All Implemented Interfaces:
  QPaintDeviceInterface, QtJambiInterface, java.lang.Cloneable

Direct Known Subclasses:
  QBitmap

    public class QPixmap

extends QtJambiObject
implements QPaintDeviceInterface, java.lang.Cloneable

The QPixmap class is an off-screen image representation that 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. The `isQBitmap()` function returns true if a QPixmap object is really a bitmap, otherwise returns false. Finally, the `QPicture` class is a paint device that records and replays `QPainter` commands.

A QPixmap can easily be displayed on the screen using `QLabel` or one of `QAbstractButton`'s subclasses (such as `QPushButton` and `QToolButton`). `QLabel` has a pixmap property, whereas `QAbstractButton` has an icon property. And because QPixmap is a `QPaintDevice` subclass, `QPainter` can be used to draw directly onto pixmaps.

In addition to the ordinary constructors, a QPixmap can be constructed using the static `grabWidget()` and `grabWindow()` functions which creates a QPixmap and paints the given widget, or window, in it.

Note that the pixel data in a pixmap is internal and is managed by the underlying window system. Pixels can only be accessed through `QPainter` functions or by converting the QPixmap to a `QImage`. Depending on the system, QPixmap is stored using a RGB32 or a premultiplied alpha format. If the image has an alpha channel, and if the system allows, the preferred format is premultiplied alpha. Note also that QPixmap, unlike `QImage`, may be hardware dependent. On X11 and Mac, a QPixmap is stored on the server side while a `QImage` is stored on the client side (on Windows, these two classes have an equivalent internal representation, i.e. both `QImage` and QPixmap are stored on the client side and don't use any GDI resources).

There are functions to convert between `QImage` and QPixmap. Typically, the `QImage` class is used to load an image file, optionally manipulating the image data, before the `QImage` 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 functions that can be used to obtain a variety of information about the pixmap. In addition, there are several functions that enables transformation of the pixmap.

QPixmap objects can be passed around by value since the QPixmap class uses implicit data sharing. For more information, see the Implicit Data Sharing documentation. QPixmap objects can also be streamed.

- Reading and Writing Image Files
- Pixmap Information
- Pixmap Conversion
- Pixmap Transformations

## Reading and Writing Image Files

QPixmap provides several ways of reading an image file: The file can be loaded when constructing the QPixmap object, or by using the `load()` or `loadFromData()` functions later on. 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 QPixmap 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
XBM | X11 Bitmap | Read/write
XPM | X11 Pixmap | Read/write

(To configure Qt with GIF support, pass `-qt-gif` to the `configure` script or check the appropriate option in the graphical installer.)

## Pixmap Information

QPixmap provides a collection of functions that can be used to obtain a variety of information about the pixmap:

| Available Functions
--- | ---
Geometry | The `size()`, `width()` and `height()` functions provide information about the pixmap's size. The `rect()` function 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, while the `hasAlpha()` function returns true if the pixmap has an alpha channel or a mask (otherwise false). The `alphaChannel()` function returns the alpha channel as a new QPixmap object, while the `mask()` function returns the mask as a `QBitmap` object. The alpha channel and mask can be set using the `setAlphaChannel()` and `setMask()` functions, respectively.
Low-level information | The `depth()` function returns the depth of the pixmap. The `defaultDepth()` function returns the default depth, i.e. the depth used by the application on the given screen. The `cacheKey()` function returns a number that uniquely identifies the contents of the QPixmap object. The x11Info() function returns information about the configuration of the X display used to display the widget. The x11PictureHandle() function returns the X11 Picture handle of the pixmap for XRender support. Note that the two latter functions are only available on x11.

## Pixmap Conversion

A QPixmap object can be converted into a `QImage` using the `toImage()` function. Likewise, a `QImage` can be converted into a QPixmap using the `fromImage()`. If this is too expensive an operation, you can use `QBitmap::fromImage()` instead.

In addition, on Windows, the QPixmap class supports conversion to and from HBitmap: the toWinHBITMAP() function creates a HBITMAP equivalent to the QPixmap, based on the given `HBitmapFormat` , and returns the HBITMAP handle. The fromWinHBITMAP() function returns a QPixmap that is equivalent to the given bitmap which has the specified format.

## Pixmap Transformations

QPixmap supports a number of functions for creating a new pixmap that is a transformed version of the original: The `createHeuristicMask()` function creates and returns a 1-bpp heuristic mask (i.e. a `QBitmap`) for this pixmap. It works by selecting a color from one of the corners and then chipping away pixels of that color, starting at all the edges. The `createMaskFromColor()` function creates and returns a mask (i.e. a `QBitmap`) for the pixmap based on a given color.

The `scaled()`, `scaledToWidth()` and `scaledToHeight()` functions return scaled copies of the pixmap, while the `copy()` function creates a QPixmap that is a plain copy of the original one.

The `transformed()` function 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()` function returns the actual matrix used for transforming the pixmap.

There are also functions for changing attributes of a pixmap. in-place: The `fill()` function fills the entire image with the given color, the `setMask()` function sets a mask bitmap, and the `setAlphaChannel()` function sets the pixmap's alpha channel.

See also:
  `QBitmap`, `QImage`, `QImageReader`, and `QImageWriter`.

Nested Class Summary

Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
`QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9`

Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal`

Field Summary

Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`currentSender`

Constructor Summary
`QPixmap()` Constructs a null pixmap.
`QPixmap(int w, int h)` Constructs a pixmap with the given `width` and `height`.
`QPixmap(QPixmap arg__1)` Constructs a pixmap that is a copy of the given `pixmap`.
`QPixmap(QSize arg__1)` Constructs a pixmap of the given `size`.
`QPixmap(java.lang.String fileName)` Constructs a pixmap from the given `xpm` data, which must be a valid XPM image.
`QPixmap(java.lang.String[] xpm)`
`QPixmap(java.lang.String fileName, java.lang.String format)` This is an overloaded constructor provided for convenience.
`QPixmap(java.lang.String fileName, java.lang.String format, Qt.ImageConversionFlag[] flags)` Constructs a pixmap from the file with the given `fileName`.
`QPixmap(java.lang.String fileName, java.lang.String format, Qt.ImageConversionFlags flags)` Constructs a pixmap from the file with the given `fileName`.

Method Summary
`QPixmap` | `alphaChannel()` Returns the alpha channel of the pixmap as a new grayscale QPixmap in which each pixel's red, green, and blue values are given the alpha value of the original pixmap.
`long` | `cacheKey()` Returns a number that identifies this QPixmap.
`QPixmap` | `clone()` This method is reimplemented for internal reasons
`QPixmap` | `copy()` Returns a deep copy of the subset of the pixmap that is specified by the given `rectangle`.
`QPixmap` | `copy(int x, int y, int width, int height)` Returns a deep copy of the subset of the pixmap that is specified by the rectangle `QRect`( `x`, `y`, `width`, `height`).
`QPixmap` | `copy(QRect rect)` Returns a deep copy of the subset of the pixmap that is specified by the given `rectangle`.
`QBitmap` | `createHeuristicMask()` Creates and returns a heuristic mask for this pixmap.
`QBitmap` | `createHeuristicMask(boolean clipTight)` Creates and returns a heuristic mask for this pixmap.
`QBitmap` | `createMaskFromColor(QColor maskColor)` Creates and returns a mask for this pixmap based on the given `maskColor`.
`QBitmap` | `createMaskFromColor(QColor maskColor, Qt.MaskMode mode)` Creates and returns a mask for this pixmap based on the given `maskColor`.
`static int` | `defaultDepth()` Returns the default pixmap depth used by the application.
`int` | `depth()` Returns the bit depth (number of bit planes) of the paint device.
`void` | `fill()` Fills the pixmap with the given `color`.
`void` | `fill(QColor fillColor)` Fills the pixmap with the given `color`.
`void` | `fill(QWidget widget, int xofs, int yofs)` Fills the pixmap with the `widget`'s background color or pixmap.
`void` | `fill(QWidget widget, QPoint ofs)` Fills the pixmap with the `widget`'s background color or pixmap according to the given offset.
`static QPixmap` | `fromImage(QImage image)` Converts the given `image` to a pixmap using the specified `flags` to control the conversion.
`static QPixmap` | `fromImage(QImage image, Qt.ImageConversionFlag[] flags)`
`static QPixmap` | `fromImage(QImage image, Qt.ImageConversionFlags flags)` Converts the given `image` to a pixmap using the specified `flags` to control the conversion.
`static QPixmap` | `grabWidget(QWidget widget)` Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.
`static QPixmap` | `grabWidget(QWidget widget, int x)` Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.
`static QPixmap` | `grabWidget(QWidget widget, int x, int y)` Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.
`static QPixmap` | `grabWidget(QWidget widget, int x, int y, int w)` Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.
`static QPixmap` | `grabWidget(QWidget widget, int x, int y, int w, int h)` Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.
`static QPixmap` | `grabWidget(QWidget widget, QRect rect)` Creates a pixmap and paints the given `widget`, restricted by the given `rectangle`, in it.
`static QPixmap` | `grabWindow(long arg__1)` Creates and returns a pixmap constructed by grabbing the contents of the given `window` restricted by `QRect`(`x`, `y`, `width`, `height`).
`static QPixmap` | `grabWindow(long arg__1, int x)` Creates and returns a pixmap constructed by grabbing the contents of the given `window` restricted by `QRect`(`x`, `y`, `width`, `height`).
`static QPixmap` | `grabWindow(long arg__1, int x, int y)` Creates and returns a pixmap constructed by grabbing the contents of the given `window` restricted by `QRect`(`x`, `y`, `width`, `height`).
`static QPixmap` | `grabWindow(long arg__1, int x, int y, int w)` Creates and returns a pixmap constructed by grabbing the contents of the given `window` restricted by `QRect`(`x`, `y`, `width`, `height`).
`static QPixmap` | `grabWindow(long arg__1, int x, int y, int w, int h)` Creates and returns a pixmap constructed by grabbing the contents of the given `window` restricted by `QRect`(`x`, `y`, `width`, `height`).
`boolean` | `hasAlpha()` Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false.
`boolean` | `hasAlphaChannel()` Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false.
`int` | `height()` Returns the height of the paint device in default coordinate system units (e.
`int` | `heightMM()` Returns the height of the paint device in millimeters.
`boolean` | `isNull()` Returns true if this is a null pixmap; otherwise returns false.
`boolean` | `isQBitmap()` Returns true if this is a `QBitmap`; otherwise returns false.
`boolean` | `load(java.lang.String fileName)` This is an overloaded method provided for convenience.
`boolean` | `load(java.lang.String fileName, java.lang.String format)` This is an overloaded method provided for convenience.
`boolean` | `load(java.lang.String fileName, java.lang.String format, Qt.ImageConversionFlag[] flags)` Constructs a pixmap from the file with the given `fileName`.
`boolean` | `load(java.lang.String fileName, java.lang.String format, Qt.ImageConversionFlags flags)` Constructs a pixmap from the file with the given `fileName`.
`boolean` | `loadFromData(byte[] data)` Loads a pixmap from the `len` first bytes of the given binary `data`.
`boolean` | `loadFromData(byte[] data, java.lang.String format)` Loads a pixmap from the `len` first bytes of the given binary `data`.
`boolean` | `loadFromData(byte[] data, java.lang.String format, Qt.ImageConversionFlag[] flags)` Loads a pixmap from the `len` first bytes of the given binary `data`.
`boolean` | `loadFromData(byte[] data, java.lang.String format, Qt.ImageConversionFlags flags)` Loads a pixmap from the `len` first bytes of the given binary `data`.
`boolean` | `loadFromData(QByteArray data)` This is an overloaded method provided for convenience.
`boolean` | `loadFromData(QByteArray data, java.lang.String format)` This is an overloaded method provided for convenience.
`boolean` | `loadFromData(QByteArray data, java.lang.String format, Qt.ImageConversionFlag[] flags)` Loads a pixmap from the binary `data` using the specified `format` and conversion `flags`.
`boolean` | `loadFromData(QByteArray data, java.lang.String format, Qt.ImageConversionFlags flags)` Loads a pixmap from the binary `data` using the specified `format` and conversion `flags`.
`int` | `logicalDpiX()` Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes.
`int` | `logicalDpiY()` Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes.
`QBitmap` | `mask()` Returns the mask, or a null bitmap if no mask has been set.
`int` | `metric(QPaintDevice.PaintDeviceMetric arg__1)` Returns the metric information for the given paint device `metric`.
`int` | `numColors()` Returns the number of different colors available for the paint device.
`QPaintEngine` | `paintEngine()` Returns a pointer to the paint engine used for drawing on the device.
`boolean` | `paintingActive()` Returns true if the device is currently being painted on, i.
`int` | `physicalDpiX()` Returns the horizontal resolution of the device in dots per inch.
`int` | `physicalDpiY()` Returns the horizontal resolution of the device in dots per inch.
`void` | `readFrom(QDataStream arg__1)` Reads a QPixmap
`QRect` | `rect()` Returns the pixmap's enclosing rectangle.
`boolean` | `save(QIODevice dev)` This is an overloaded method provided for convenience.
`boolean` | `save(QIODevice dev, java.lang.String format)` This is an overloaded method provided for convenience.
`boolean` | `save(QIODevice dev, java.lang.String format, int quality)` This function writes a QPixmap to the given `dev` using the specified image file `format` and `quality` factor.
`boolean` | `save(java.lang.String fileName)` This is an overloaded method provided for convenience.
`boolean` | `save(java.lang.String fileName, java.lang.String format)` This is an overloaded method provided for convenience.
`boolean` | `save(java.lang.String fileName, java.lang.String format, int quality)` Saves the pixmap to the file with the given `fileName` using the specified image file `format` and `quality` factor.
`QPixmap` | `scaled(int w, int h)` Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaled(int w, int h, Qt.AspectRatioMode aspectMode)` Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaled(int w, int h, Qt.AspectRatioMode aspectMode, Qt.TransformationMode mode)` Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaled(QSize s)` Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaled(QSize s, Qt.AspectRatioMode aspectMode)` Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaled(QSize s, Qt.AspectRatioMode aspectMode, Qt.TransformationMode mode)` Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
`QPixmap` | `scaledToHeight(int h)` Returns a scaled copy of the image.
`QPixmap` | `scaledToHeight(int h, Qt.TransformationMode mode)` Returns a scaled copy of the image.
`QPixmap` | `scaledToWidth(int w)` Returns a scaled copy of the image.
`QPixmap` | `scaledToWidth(int w, Qt.TransformationMode mode)` Returns a scaled copy of the image.
`void` | `setAlphaChannel(QPixmap arg__1)` Sets the alpha channel of this pixmap to the given `alphaChannel` by converting the `alphaChannel` into 32 bit and using the intensity of the RGB pixel values.
`void` | `setMask(QBitmap arg__1)` Sets a mask bitmap.
`QSize` | `size()` Returns the size of the pixmap.
`QImage` | `toImage()` Converts the pixmap to a `QImage`.
`QPixmap` | `transformed(QMatrix arg__1, Qt.TransformationMode mode)` This convenience function loads the `matrix` into a `QTransform` and calls the overloaded function.
`QPixmap` | `transformed(QTransform arg__1, Qt.TransformationMode mode)` Returns a copy of the pixmap that is transformed using the given transformation `transform` and transformation `mode`.
`static QMatrix` | `trueMatrix(QMatrix m, int w, int h)` This convenience function loads the matrix `m` into a `QTransform` and calls the overloaded function with the `QTransform` and the width `w` and the height `h`.
`static QTransform` | `trueMatrix(QTransform m, int w, int h)` Returns the actual matrix used for transforming a pixmap with the given `width`, `height` and `matrix`.
`int` | `width()` Returns the width of the paint device in default coordinate system units (e.
`int` | `widthMM()` Returns the width of the paint device in millimeters.
`void` | `writeTo(QDataStream arg__1)` Writes thisQPixmap

Methods inherited from class com.trolltech.qt.QtJambiObject
`dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr`

Methods inherited from class com.trolltech.qt.QSignalEmitter
`blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread`

Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
`__qt_signalInitialization`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.trolltech.qt.QtJambiInterface
`disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership`

Constructor Detail

### QPixmap

    public QPixmap()

  Constructs a null pixmap.

See also:
  `isNull()`.

### QPixmap

    public QPixmap(QPixmap arg__1)

  Constructs a pixmap that is a copy of the given `pixmap`.

See also:
  `copy()`.

### QPixmap

    public QPixmap(QSize arg__1)

  Constructs a pixmap of the given `size`.

  Warning: This will create a QPixmap with uninitialized data. Call `fill()` to fill the pixmap with an appropriate color before drawing onto it with `QPainter`.

### QPixmap

    public QPixmap(int w,
                   int h)

  Constructs a pixmap with the given `width` and `height`. If either `width` or `height` is zero, a null pixmap is constructed.

  Warning: This will create a QPixmap with uninitialized data. Call `fill()` to fill the pixmap with an appropriate color before drawing onto it with `QPainter`.

See also:
  `isNull()`.

### QPixmap

    public QPixmap(java.lang.String[] xpm)

### QPixmap

    public QPixmap(java.lang.String fileName,
                   java.lang.String format,
                   Qt.ImageConversionFlags flags)

  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. See 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.

See also:
  Reading and Writing Image Files.

### QPixmap

    public QPixmap(java.lang.String fileName,
                   java.lang.String format,
                   Qt.ImageConversionFlag[] flags)

  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. See 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.

See also:
  Reading and Writing Image Files.

### QPixmap

    public QPixmap(java.lang.String fileName,
                   java.lang.String format)

  This is an overloaded constructor provided for convenience.

### QPixmap

    public QPixmap(java.lang.String fileName)

  Constructs a pixmap from the given `xpm` data, which must be 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:

              String start_xpm[] = {
                  "16 15 8 1",
                  "a c #cec6bd",
                  // ...
                  };

  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.

Method Detail

### alphaChannel

    public final QPixmap alphaChannel()

  Returns the alpha channel of the pixmap as a new grayscale QPixmap in which each pixel's red, green, and blue values are given the alpha value of the original pixmap. The color depth of the returned pixmap is the system depth on X11 and 8-bit on Windows and Mac OS X.

  You can use this function while debugging to get a visible image of the alpha channel. If the pixmap doesn't have an alpha channel, i.e., the alpha channel's value for all pixels equals 0xff), a null pixmap is returned. You can check this with the `isNull()` function.

  We show an example:

          pixmap = QPixmap(100, 100);
          pixmap.fill(Qt::transparent);

          QRadialGradient gradient(50, 50, 50, 50, 50);
          gradient.setColorAt(0, QColor::fromRgbF(1, 0, 0, 1));
          gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0));
          QPainter painter(&pixmap);
          painter.fillRect(0, 0, 100, 100, gradient);

          channelImage = pixmap.alphaChannel();
          update();

See also:
  `setAlphaChannel()`, and Pixmap Information.

### cacheKey

    public final long cacheKey()

  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.

### copy

    public final QPixmap copy()

  Returns a deep copy of the subset of the pixmap that is specified by the given `rectangle`. For more information on deep copies, see the Implicit Data Sharing documentation.

  If the given `rectangle` is empty, the whole image is copied.

See also:
  operator=(), QPixmap(), and Pixmap Transformations.

### copy

    public final QPixmap copy(QRect rect)

  Returns a deep copy of the subset of the pixmap that is specified by the given `rectangle`. For more information on deep copies, see the Implicit Data Sharing documentation.

  If the given `rectangle` is empty, the whole image is copied.

See also:
  operator=(), QPixmap(), and Pixmap Transformations.

### copy

    public final QPixmap copy(int x,
                              int y,
                              int width,
                              int height)

  Returns a deep copy of the subset of the pixmap that is specified by the rectangle `QRect`( `x`, `y`, `width`, `height`).

### createHeuristicMask

    public final QBitmap createHeuristicMask()

  Creates and returns a heuristic mask for this pixmap.

  The function 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:

              QPixmap myPixmap = new QPixmap();
              myPixmap.setMask(myPixmap.createHeuristicMask());

  This function is slow because it involves converting to/from a `QImage`, and non-trivial computations.

See also:
  `QImage::createHeuristicMask()`, and `createMaskFromColor()`.

### createHeuristicMask

    public final QBitmap createHeuristicMask(boolean clipTight)

  Creates and returns a heuristic mask for this pixmap.

  The function 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:

              QPixmap myPixmap = new QPixmap();
              myPixmap.setMask(myPixmap.createHeuristicMask());

  This function is slow because it involves converting to/from a `QImage`, and non-trivial computations.

See also:
  `QImage::createHeuristicMask()`, and `createMaskFromColor()`.

### createMaskFromColor

    public final QBitmap createMaskFromColor(QColor maskColor)

  Creates and returns a mask for this pixmap based on the given `maskColor`. Same as calling createMaskFromColor(maskColor, `Qt::MaskInColor` )

See also:
  `createHeuristicMask()`, and `QImage::createMaskFromColor()`.

### createMaskFromColor

    public final QBitmap createMaskFromColor(QColor maskColor,
                                             Qt.MaskMode mode)

  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 opaque. If `mode` is `Qt::MaskOutColor` , all pixels matching the maskColor will be transparent.

  This function is slow because it involves converting to/from a `QImage`.

See also:
  `createHeuristicMask()`, and `QImage::createMaskFromColor()`.

### depth

    public final int depth()

  Returns the bit depth (number of bit planes) of the paint device.

  Specified by:
    `depth` in interface `QPaintDeviceInterface`

### fill

    public final void fill()

  Fills the pixmap with the given `color`.

See also:
  Pixmap Transformations.

### fill

    public final void fill(QColor fillColor)

  Fills the pixmap with the given `color`.

See also:
  Pixmap Transformations.

### fill

    public final void fill(QWidget widget,
                           QPoint ofs)

  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.

### fill

    public final void fill(QWidget widget,
                           int xofs,
                           int yofs)

  Fills the pixmap with the `widget`'s background color or pixmap. The given point, (`x`, `y`), defines an offset in widget coordinates to which the pixmap's top-left pixel will be mapped to.

### hasAlpha

    public final boolean hasAlpha()

  Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false.

See also:
  `hasAlphaChannel()`, `alphaChannel()`, and `mask()`.

### hasAlphaChannel

    public final boolean hasAlphaChannel()

  Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false.

See also:
  `alphaChannel()`, and `hasAlpha()`.

### height

    public final int height()

  Returns the height of the paint device in default coordinate system units (e. . pixels for QPixmap and `QWidget`).

See also:
  `heightMM()`.

  Specified by:
    `height` in interface `QPaintDeviceInterface`

### heightMM

    public final int heightMM()

  Returns the height of the paint device in millimeters.

See also:
  `height()`.

  Specified by:
    `heightMM` in interface `QPaintDeviceInterface`

### isNull

    public final boolean isNull()

  Returns true if this is a null pixmap; otherwise returns false.

  A null pixmap has zero width, zero height and no contents. You cannot draw in a null pixmap.

### isQBitmap

    public final boolean isQBitmap()

  Returns true if this is a `QBitmap`; otherwise returns false.

### logicalDpiX

    public final int logicalDpiX()

  Returns the horizontal resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `widthMM()`.

  Note that if the `logicalDpiX()` doesn't equal the `physicalDpiX()`, the corresponding `QPaintEngine` must handle the resolution mapping.

See also:
  `logicalDpiY()`, and `physicalDpiX()`.

  Specified by:
    `logicalDpiX` in interface `QPaintDeviceInterface`

### logicalDpiY

    public final int logicalDpiY()

  Returns the vertical resolution of the device in dots per inch, which is used when computing font sizes. For X11, this is usually the same as could be computed from `heightMM()`.

  Note that if the `logicalDpiY()` doesn't equal the `physicalDpiY()`, the corresponding `QPaintEngine` must handle the resolution mapping.

See also:
  `logicalDpiX()`, and `physicalDpiY()`.

  Specified by:
    `logicalDpiY` in interface `QPaintDeviceInterface`

### mask

    public final QBitmap mask()

  Returns the mask, or a null bitmap if no mask has been set.

See also:
  `setMask()`, and Pixmap Information.

### numColors

    public final int numColors()

  Returns the number of different colors available for the paint device. Since this value is an int, it will not be sufficient to represent the number of colors on 32 bit displays, in this case INT_MAX is returned instead.

  Specified by:
    `numColors` in interface `QPaintDeviceInterface`

### writeTo

    public final void writeTo(QDataStream arg__1)

  Writes thisQPixmap

### readFrom

    public final void readFrom(QDataStream arg__1)

  Reads a QPixmap

### paintingActive

    public final boolean paintingActive()

  Returns true if the device is currently being painted on, i. . someone has called `QPainter::begin()` but not yet called `QPainter::end()` for this device; otherwise returns false.

See also:
  `QPainter::isActive()`.

  Specified by:
    `paintingActive` in interface `QPaintDeviceInterface`

### physicalDpiX

    public final int physicalDpiX()

  Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

  Note that if the `physicalDpiX()` doesn't equal the `logicalDpiX()`, the corresponding `QPaintEngine` must handle the resolution mapping.

See also:
  `physicalDpiY()`, and `logicalDpiX()`.

  Specified by:
    `physicalDpiX` in interface `QPaintDeviceInterface`

### physicalDpiY

    public final int physicalDpiY()

  Returns the horizontal resolution of the device in dots per inch. For example, when printing, this resolution refers to the physical printer's resolution. The logical DPI on the other hand, refers to the resolution used by the actual paint engine.

  Note that if the `physicalDpiY()` doesn't equal the `logicalDpiY()`, the corresponding `QPaintEngine` must handle the resolution mapping.

See also:
  `physicalDpiX()`, and `logicalDpiY()`.

  Specified by:
    `physicalDpiY` in interface `QPaintDeviceInterface`

### rect

    public final QRect rect()

  Returns the pixmap's enclosing rectangle.

See also:
  Pixmap Information.

### scaled

    public final QPixmap scaled(QSize s,
                                Qt.AspectRatioMode aspectMode)

  Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
  - If `aspectRatioMode` is `Qt::IgnoreAspectRatio` , the pixmap is scaled to `size`.
  - If `aspectRatioMode` is `Qt::KeepAspectRatio` , the pixmap is scaled to a rectangle as large as possible inside `size`, preserving the aspect ratio.
  - If `aspectRatioMode` is `Qt::KeepAspectRatioByExpanding` , the pixmap is scaled to a rectangle as small as possible outside `size`, preserving the aspect ratio.
  If the given `size` is empty, this function returns a null pixmap.

See also:
  `isNull()`, and Pixmap Transformations.

### scaled

    public final QPixmap scaled(QSize s)

  Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
  - If `aspectRatioMode` is `Qt::IgnoreAspectRatio` , the pixmap is scaled to `size`.
  - If `aspectRatioMode` is `Qt::KeepAspectRatio` , the pixmap is scaled to a rectangle as large as possible inside `size`, preserving the aspect ratio.
  - If `aspectRatioMode` is `Qt::KeepAspectRatioByExpanding` , the pixmap is scaled to a rectangle as small as possible outside `size`, preserving the aspect ratio.
  If the given `size` is empty, this function returns a null pixmap.

See also:
  `isNull()`, and Pixmap Transformations.

### scaled

    public final QPixmap scaled(QSize s,
                                Qt.AspectRatioMode aspectMode,
                                Qt.TransformationMode mode)

  Scales the pixmap to the given `size`, using the aspect ratio and transformation modes specified by `aspectRatioMode` and `transformMode`.
  - If `aspectRatioMode` is `Qt::IgnoreAspectRatio` , the pixmap is scaled to `size`.
  - If `aspectRatioMode` is `Qt::KeepAspectRatio` , the pixmap is scaled to a rectangle as large as possible inside `size`, preserving the aspect ratio.
  - If `aspectRatioMode` is `Qt::KeepAspectRatioByExpanding` , the pixmap is scaled to a rectangle as small as possible outside `size`, preserving the aspect ratio.
  If the given `size` is empty, this function returns a null pixmap.

See also:
  `isNull()`, and Pixmap Transformations.

### scaled

    public final QPixmap scaled(int w,
                                int h,
                                Qt.AspectRatioMode aspectMode)

  Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.

  If either the `width` or the `height` is zero or negative, this function returns a null pixmap.

### scaled

    public final QPixmap scaled(int w,
                                int h)

  Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.

  If either the `width` or the `height` is zero or negative, this function returns a null pixmap.

### scaled

    public final QPixmap scaled(int w,
                                int h,
                                Qt.AspectRatioMode aspectMode,
                                Qt.TransformationMode mode)

  Returns a copy of the pixmap scaled to a rectangle with the given `width` and `height` according to the given `aspectRatioMode` and `transformMode`.

  If either the `width` or the `height` is zero or negative, this function returns a null pixmap.

### scaledToHeight

    public final QPixmap scaledToHeight(int h)

  Returns a scaled copy of the image. The returned image is scaled to the given `height` using the specified transformation `mode`. 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.

See also:
  `isNull()`, and Pixmap Transformations.

### scaledToHeight

    public final QPixmap scaledToHeight(int h,
                                        Qt.TransformationMode mode)

  Returns a scaled copy of the image. The returned image is scaled to the given `height` using the specified transformation `mode`. 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.

See also:
  `isNull()`, and Pixmap Transformations.

### scaledToWidth

    public final QPixmap scaledToWidth(int w)

  Returns a scaled copy of the image. The returned image is scaled to the given `width` using the specified transformation `mode`. 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.

See also:
  `isNull()`, and Pixmap Transformations.

### scaledToWidth

    public final QPixmap scaledToWidth(int w,
                                       Qt.TransformationMode mode)

  Returns a scaled copy of the image. The returned image is scaled to the given `width` using the specified transformation `mode`. 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.

See also:
  `isNull()`, and Pixmap Transformations.

### setAlphaChannel

    public final void setAlphaChannel(QPixmap arg__1)

  Sets the alpha channel of this pixmap to the given `alphaChannel` by converting the `alphaChannel` into 32 bit and using the intensity of the RGB pixel values.

  The effect of this function is undefined when the pixmap is being painted on.

See also:
  `alphaChannel()`, and Pixmap Transformations.

### setMask

    public final void setMask(QBitmap arg__1)

  Sets a mask bitmap.

  The `mask` bitmap defines the clip mask for this pixmap. Every pixel in `mask` corresponds to a pixel in this pixmap. Pixel value 1 means opaque and pixel value 0 means transparent. The mask must have the same size as this pixmap.

  Warning: Setting the mask on a pixmap will cause any alpha channel data to be cleared. For example:snippets/image/image.cppMASKQPixmapsetMask Now, alpha and alphacopy are visually different.

  Setting a null mask resets the mask.

  The effect of this function is undefined when the pixmap is being painted on.

See also:
  `mask()`, Pixmap Transformations, and `QBitmap`.

### size

    public final QSize size()

  Returns the size of the pixmap.

See also:
  `width()`, `height()`, and Pixmap Information.

### toImage

    public final QImage toImage()

  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. If the pixmap has 2- to 8-bit depth, the returned image has 8-bit depth. If the pixmap has greater than 8-bit depth, the returned image has 32-bit depth.

  Note that for the moment, alpha masks on monochrome images are ignored.

See also:
  `fromImage()`, and `Image Formats`.

### transformed

    public final QPixmap transformed(QMatrix arg__1,
                                     Qt.TransformationMode mode)

  This convenience function loads the `matrix` into a `QTransform` and calls the overloaded function.

### transformed

    public final QPixmap transformed(QTransform arg__1,
                                     Qt.TransformationMode mode)

  Returns a copy of the pixmap that is transformed using the given transformation `transform` and transformation `mode`. The original pixmap is not changed.

  The transformation `transform` 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()` function to retrieve the actual matrix used for transforming the pixmap.

  This function is slow because it involves transformation to a `QImage`, non-trivial computations and a transformation back to a QPixmap.

See also:
  `trueMatrix()`, and Pixmap Transformations.

### width

    public final int width()

  Returns the width of the paint device in default coordinate system units (e. . pixels for QPixmap and `QWidget`).

See also:
  `widthMM()`.

  Specified by:
    `width` in interface `QPaintDeviceInterface`

### widthMM

    public final int widthMM()

  Returns the width of the paint device in millimeters.

See also:
  `width()`.

  Specified by:
    `widthMM` in interface `QPaintDeviceInterface`

### metric

    public int metric(QPaintDevice.PaintDeviceMetric arg__1)

  Returns the metric information for the given paint device `metric`.

See also:
  `PaintDeviceMetric` .

  Specified by:
    `metric` in interface `QPaintDeviceInterface`

### paintEngine

    public QPaintEngine paintEngine()

  Returns a pointer to the paint engine used for drawing on the device.

  Specified by:
    `paintEngine` in interface `QPaintDeviceInterface`

### defaultDepth

    public static int defaultDepth()

  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 function.

See also:
  `depth()`, `QColormap::depth()`, and Pixmap Information.

### fromImage

    public static QPixmap fromImage(QImage image,
                                    Qt.ImageConversionFlag[] flags)

### fromImage

    public static QPixmap fromImage(QImage image)

  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.

See also:
  `toImage()`, and Pixmap Conversion.

### fromImage

    public static QPixmap fromImage(QImage image,
                                    Qt.ImageConversionFlags flags)

  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.

See also:
  `toImage()`, and Pixmap Conversion.

### grabWidget

    public static QPixmap grabWidget(QWidget widget,
                                     QRect rect)

  Creates a pixmap and paints the given `widget`, restricted by the given `rectangle`, in it. 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 0, the specified rectangle doesn't overlap the widget's rectangle, or an error occurs, the function 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 function 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()` function 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.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

See also:
  `grabWindow()`.

### grabWidget

    public static QPixmap grabWidget(QWidget widget,
                                     int x,
                                     int y,
                                     int w)

  Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

### grabWidget

    public static QPixmap grabWidget(QWidget widget,
                                     int x,
                                     int y)

  Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

### grabWidget

    public static QPixmap grabWidget(QWidget widget,
                                     int x)

  Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

### grabWidget

    public static QPixmap grabWidget(QWidget widget)

  Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

### grabWidget

    public static QPixmap grabWidget(QWidget widget,
                                     int x,
                                     int y,
                                     int w,
                                     int h)

  Creates a pixmap and paints the given `widget`, restricted by `QRect`(`x`, `y`, `width`, `height`), in it.

  Warning: Do not grab a widget from its `QWidget::paintEvent()`. However, it is safe to grab a widget from another widget's `paintEvent()`.

### grabWindow

    public static QPixmap grabWindow(long arg__1,
                                     int x,
                                     int y,
                                     int w)

  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, the function copies everything to the right border of the window. If `height` is negative, the function copies everything to the bottom of the window.

  The window system identifier (`WId`) can be retrieved using the `QWidget::winId()` function. 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()` function 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 X11that if the given `window` doesn't 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.

  Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

See also:
  `grabWidget()`, and Screenshot Example.

### grabWindow

    public static QPixmap grabWindow(long arg__1,
                                     int x,
                                     int y)

  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, the function copies everything to the right border of the window. If `height` is negative, the function copies everything to the bottom of the window.

  The window system identifier (`WId`) can be retrieved using the `QWidget::winId()` function. 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()` function 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 X11that if the given `window` doesn't 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.

  Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

See also:
  `grabWidget()`, and Screenshot Example.

### grabWindow

    public static QPixmap grabWindow(long arg__1,
                                     int x)

  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, the function copies everything to the right border of the window. If `height` is negative, the function copies everything to the bottom of the window.

  The window system identifier (`WId`) can be retrieved using the `QWidget::winId()` function. 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()` function 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 X11that if the given `window` doesn't 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.

  Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

See also:
  `grabWidget()`, and Screenshot Example.

### grabWindow

    public static QPixmap grabWindow(long arg__1)

  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, the function copies everything to the right border of the window. If `height` is negative, the function copies everything to the bottom of the window.

  The window system identifier (`WId`) can be retrieved using the `QWidget::winId()` function. 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()` function 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 X11that if the given `window` doesn't 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.

  Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

See also:
  `grabWidget()`, and Screenshot Example.

### grabWindow

    public static QPixmap grabWindow(long arg__1,
                                     int x,
                                     int y,
                                     int w,
                                     int h)

  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, the function copies everything to the right border of the window. If `height` is negative, the function copies everything to the bottom of the window.

  The window system identifier (`WId`) can be retrieved using the `QWidget::winId()` function. 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()` function 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 X11that if the given `window` doesn't 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.

  Warning: In general, grabbing an area outside the screen is not safe. This depends on the underlying window system.

See also:
  `grabWidget()`, and Screenshot Example.

### trueMatrix

    public static QMatrix trueMatrix(QMatrix m,
                                     int w,
                                     int h)

  This convenience function loads the matrix `m` into a `QTransform` and calls the overloaded function with the `QTransform` and the width `w` and the height `h`.

### trueMatrix

    public static QTransform trueMatrix(QTransform m,
                                        int w,
                                        int h)

  Returns the actual matrix used for transforming a pixmap with the given `width`, `height` and `matrix`.

  When transforming a pixmap using the `transformed()` function, 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 function returns the modified matrix, which maps points correctly from the original pixmap into the new pixmap.

See also:
  `transformed()`, and Pixmap Transformations.

### save

    public final boolean save(QIODevice dev,
                              java.lang.String format,
                              int quality)

  This function writes a QPixmap to the given `dev` using the specified image file `format` and `quality` factor. This can be used, for example, to save a pixmap directly into a QByteArray:

### save

    public final boolean save(QIODevice dev,
                              java.lang.String format)

  This is an overloaded method provided for convenience.

### save

    public final boolean save(QIODevice dev)

  This is an overloaded method provided for convenience.

### save

    public final boolean save(java.lang.String fileName,
                              java.lang.String format,
                              int quality)

  Saves the pixmap to the file with the given `fileName` using the specified image file `format` and `quality` factor. 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.

  If `format` is 0, an image format will be chosen from `fileName`'s suffix.

### save

    public final boolean save(java.lang.String fileName,
                              java.lang.String format)

  This is an overloaded method provided for convenience.

### save

    public final boolean save(java.lang.String fileName)

  This is an overloaded method provided for convenience.

### load

    public final boolean load(java.lang.String fileName,
                              java.lang.String format,
                              Qt.ImageConversionFlags flags)

  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. See 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.

See also:
  Reading and Writing Image Files.

### load

    public final boolean load(java.lang.String fileName,
                              java.lang.String format,
                              Qt.ImageConversionFlag[] flags)

  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. See 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.

See also:
  Reading and Writing Image Files.

### load

    public final boolean load(java.lang.String fileName,
                              java.lang.String format)

  This is an overloaded method provided for convenience.

### load

    public final boolean load(java.lang.String fileName)

  This is an overloaded method provided for convenience.

### loadFromData

    public final boolean loadFromData(byte[] data,
                                      java.lang.String format,
                                      Qt.ImageConversionFlags flags)

  Loads a pixmap from the `len` first bytes of the given binary `data`. 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.

See also:
  `load()`, and Reading and Writing Image Files.

### loadFromData

    public final boolean loadFromData(byte[] data,
                                      java.lang.String format,
                                      Qt.ImageConversionFlag[] flags)

  Loads a pixmap from the `len` first bytes of the given binary `data`. 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.

See also:
  `load()`, and Reading and Writing Image Files.

### loadFromData

    public final boolean loadFromData(byte[] data,
                                      java.lang.String format)

  Loads a pixmap from the `len` first bytes of the given binary `data`. 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.

See also:
  `load()`, and Reading and Writing Image Files.

### loadFromData

    public final boolean loadFromData(byte[] data)

  Loads a pixmap from the `len` first bytes of the given binary `data`. 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.

See also:
  `load()`, and Reading and Writing Image Files.

### loadFromData

    public final boolean loadFromData(QByteArray data,
                                      java.lang.String format,
                                      Qt.ImageConversionFlags flags)

  Loads a pixmap from the binary `data` using the specified `format` and conversion `flags`.

### loadFromData

    public final boolean loadFromData(QByteArray data,
                                      java.lang.String format,
                                      Qt.ImageConversionFlag[] flags)

  Loads a pixmap from the binary `data` using the specified `format` and conversion `flags`.

### loadFromData

    public final boolean loadFromData(QByteArray data,
                                      java.lang.String format)

  This is an overloaded method provided for convenience.

### loadFromData

    public final boolean loadFromData(QByteArray data)

  This is an overloaded method provided for convenience.

### clone

    public QPixmap clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD