Qt 4.8
Public Types | Public Functions | Static Public Functions | List of all members
QBitmap Class Reference

The QBitmap class provides monochrome (1-bit depth) pixmaps. More...

#include <qbitmap.h>

Inheritance diagram for QBitmap:
QPixmap QPaintDevice

Public Types

typedef QExplicitlySharedDataPointer< QPixmapDataDataPtr
 
- Public Types inherited from QPixmap
typedef QExplicitlySharedDataPointer< QPixmapDataDataPtr
 
enum  HBitmapFormat { NoAlpha, PremultipliedAlpha, Alpha }
 HBITMAP and QPixmap is performed. More...
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 

Public Functions

void clear ()
 Clears the bitmap, setting all its bits to Qt::color0. More...
 
 operator QVariant () const
 Returns the bitmap as a QVariant. More...
 
QBitmapoperator= (const QPixmap &)
 Assigns the given pixmap to this bitmap and returns a reference to this bitmap. More...
 
 QBitmap ()
 Constructs a null bitmap. More...
 
 QBitmap (const QPixmap &)
 Constructs a bitmap that is a copy of the given pixmap. More...
 
 QBitmap (int w, int h)
 Constructs a bitmap with the given width and height. More...
 
 QBitmap (const QSize &)
 Constructs a bitmap with the given size. More...
 
 QBitmap (const QString &fileName, const char *format=0)
 Constructs a bitmap from the file specified by the given fileName. More...
 
void swap (QBitmap &other)
 Swaps bitmap other with this bitmap. More...
 
QBitmap transformed (const QMatrix &) const
 This convenience function converts the matrix to a QTransform and calls the overloaded function. More...
 
QBitmap transformed (const QTransform &matrix) const
 Returns a copy of this bitmap, transformed according to the given matrix. More...
 
 ~QBitmap ()
 Destroys the bitmap. More...
 
- Public Functions inherited from QPixmap
QT_DEPRECATED QPixmap alphaChannel () const
 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. More...
 
qint64 cacheKey () const
 Returns a number that identifies this QPixmap. More...
 
QRgbclut () const
 
int colorCount () const
 
bool convertFromImage (const QImage &img, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Replaces this pixmap's data with the given image using the specified flags to control the conversion. More...
 
QPixmap copy (int x, int y, int width, int height) const
 Returns a deep copy of the subset of the pixmap that is specified by the rectangle QRect( x, y, width, height). More...
 
QPixmap copy (const QRect &rect=QRect()) const
 Returns a deep copy of the subset of the pixmap that is specified by the given rectangle. More...
 
QBitmap createHeuristicMask (bool clipTight=true) const
 Creates and returns a heuristic mask for this pixmap. More...
 
QBitmap createMaskFromColor (const QColor &maskColor) const
 Creates and returns a mask for this pixmap based on the given maskColor. More...
 
QBitmap createMaskFromColor (const QColor &maskColor, Qt::MaskMode mode) const
 Creates and returns a mask for this pixmap based on the given maskColor. More...
 
DataPtrdata_ptr ()
 
int depth () const
 Returns the depth of the pixmap. More...
 
void detach ()
 Detaches the pixmap from shared pixmap data. More...
 
int devType () const
 
void fill (const QColor &fillColor=Qt::white)
 Fills the pixmap with the given color. More...
 
void fill (const QWidget *widget, const QPoint &ofs)
 Fills the pixmap with the widget's background color or pixmap according to the given offset. More...
 
void fill (const QWidget *widget, int xofs, int yofs)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Fills the pixmap with the widget's background color or pixmap. More...
 
Qt::HANDLE handle () const
 Returns the pixmap's handle to the device context. More...
 
bool hasAlpha () const
 Returns true if this pixmap has an alpha channel, or has a mask, otherwise returns false. More...
 
bool hasAlphaChannel () const
 Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false. More...
 
int height () const
 Returns the height of the pixmap. More...
 
bool isDetached () const
 
bool isNull () const
 Returns true if this is a null pixmap; otherwise returns false. More...
 
bool isQBitmap () const
 Returns true if this is a QBitmap; otherwise returns false. More...
 
bool load (const QString &fileName, const char *format=0, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Loads a pixmap from the file with the given fileName. More...
 
bool loadFromData (const uchar *buf, uint len, const char *format=0, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Loads a pixmap from the len first bytes of the given binary data. More...
 
bool loadFromData (const QByteArray &data, const char *format=0, Qt::ImageConversionFlags flags=Qt::AutoColor)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads a pixmap from the binary data using the specified format and conversion flags. More...
 
QBitmap mask () const
 Extracts a bitmap mask from the pixmap's alpha channel. More...
 
QT_DEPRECATED int numCols () const
 
 operator QVariant () const
 Returns the pixmap as a QVariant. More...
 
bool operator! () const
 Returns true if this is a null pixmap; otherwise returns false. More...
 
QPixmapoperator= (const QPixmap &)
 Assigns the given pixmap to this pixmap and returns a reference to this pixmap. More...
 
QPaintEnginepaintEngine () const
 
QPixmapDatapixmapData () const
 
 QPixmap ()
 Constructs a null pixmap. More...
 
 QPixmap (QPixmapData *data)
 
 QPixmap (int w, int h)
 Constructs a pixmap with the given width and height. More...
 
 QPixmap (const QSize &)
 Constructs a pixmap of the given size. More...
 
 QPixmap (const QString &fileName, const char *format=0, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Constructs a pixmap from the file with the given fileName. More...
 
 QPixmap (const char *const xpm[])
 Constructs a pixmap from the given xpm data, which must be a valid XPM image. More...
 
 QPixmap (const QPixmap &)
 Constructs a pixmap that is a copy of the given pixmap. More...
 
const ucharqwsBits () const
 
int qwsBytesPerLine () const
 
QRect rect () const
 Returns the pixmap's enclosing rectangle. More...
 
bool save (const QString &fileName, const char *format=0, int quality=-1) const
 Saves the pixmap to the file with the given fileName using the specified image file format and quality factor. More...
 
bool save (QIODevice *device, const char *format=0, int quality=-1) const
 This function writes a QPixmap to the given device using the specified image file format and quality factor. More...
 
QPixmap scaled (int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
 
QPixmap scaled (const QSize &s, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
 
QPixmap scaledToHeight (int h, Qt::TransformationMode mode=Qt::FastTransformation) const
 
QPixmap scaledToWidth (int w, Qt::TransformationMode mode=Qt::FastTransformation) const
 Returns a scaled copy of the image. More...
 
void scroll (int dx, int dy, int x, int y, int width, int height, QRegion *exposed=0)
 
void scroll (int dx, int dy, const QRect &rect, QRegion *exposed=0)
 Scrolls the area rect of this pixmap by (dx, dy). More...
 
QT_DEPRECATED int serialNumber () const
 Returns a number that identifies the contents of this QPixmap object. More...
 
QT_DEPRECATED void setAlphaChannel (const QPixmap &)
 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. More...
 
void setMask (const QBitmap &)
 Sets a mask bitmap. More...
 
QSize size () const
 Returns the size of the pixmap. More...
 
void swap (QPixmap &other)
 Swaps pixmap other with this pixmap. More...
 
QImage toImage () const
 Converts the pixmap to a QImage. More...
 
CGImageRef toMacCGImageRef () const
 Creates a CGImageRef equivalent to the QPixmap. More...
 
HBITMAP toWinHBITMAP (HBitmapFormat format=NoAlpha) const
 It is the caller's responsibility to free the HBITMAP data after use. More...
 
HICON toWinHICON () const
 Returns the HICON handle. More...
 
QPixmap transformed (const QMatrix &, Qt::TransformationMode mode=Qt::FastTransformation) const
 This convenience function loads the matrix into a QTransform and calls the overloaded function. More...
 
QPixmap transformed (const QTransform &, Qt::TransformationMode mode=Qt::FastTransformation) const
 Returns a copy of the pixmap that is transformed using the given transformation transform and transformation mode. More...
 
int width () const
 Returns the width of the pixmap. More...
 
 ~QPixmap ()
 Destroys the pixmap. More...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
virtual HDC getDC () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
virtual void releaseDC (HDC hdc) const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Static Public Functions

static QBitmap fromData (const QSize &size, const uchar *bits, QImage::Format monoFormat=QImage::Format_MonoLSB)
 Constructs a bitmap with the given size, and sets the contents to the bits supplied. More...
 
static QBitmap fromImage (const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Returns a copy of the given image converted to a bitmap using the specified image conversion flags. More...
 
- Static Public Functions inherited from QPixmap
static int defaultDepth ()
 Returns the default pixmap depth used by the application. More...
 
static QPixmap fromImage (const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Converts the given image to a pixmap using the specified flags to control the conversion. More...
 
static QPixmap fromImageReader (QImageReader *imageReader, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Create a QPixmap from an image read directly from an imageReader. More...
 
static QPixmap fromMacCGImageRef (CGImageRef image)
 Returns a QPixmap that is equivalent to the given image. More...
 
static QPixmap fromWinHBITMAP (HBITMAP hbitmap, HBitmapFormat format=NoAlpha)
 Win32 only: Returns a QPixmap that is equivalent to the given bitmap. More...
 
static QPixmap fromWinHICON (HICON hicon)
 
static QPixmap grabWidget (QWidget *widget, const QRect &rect)
 Creates a pixmap and paints the given widget, restricted by the given rectangle, in it. More...
 
static QPixmap grabWidget (QWidget *widget, int x=0, int y=0, int w=-1, int h=-1)
 
static QPixmap grabWindow (WId, int x=0, int y=0, int w=-1, int h=-1)
 Creates and returns a pixmap constructed by grabbing the contents of the given window restricted by QRect(x, y, width, height). More...
 
static QMatrix trueMatrix (const 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. More...
 
static QTransform trueMatrix (const QTransform &m, int w, int h)
 Returns the actual matrix used for transforming a pixmap with the given width, height and matrix. More...
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 

Additional Inherited Members

- Protected Functions inherited from QPixmap
int metric (PaintDeviceMetric) const
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Detailed Description

The QBitmap class provides monochrome (1-bit depth) pixmaps.

The QBitmap class is a monochrome off-screen paint device used mainly for creating custom QCursor and QBrush objects, constructing QRegion objects, and for setting masks for pixmaps and widgets.

QBitmap is a QPixmap subclass ensuring a depth of 1, except for null objects which have a depth of 0. If a pixmap with a depth greater than 1 is assigned to a bitmap, the bitmap will be dithered automatically.

Use the QColor objects Qt::color0 and Qt::color1 when drawing on a QBitmap object (or a QPixmap object with depth 1).

Painting with Qt::color0 sets the bitmap bits to 0, and painting with Qt::color1 sets the bits to 1. For a bitmap, 0-bits indicate background (or transparent pixels) and 1-bits indicate foreground (or opaque pixels). Use the clear() function to set all the bits to Qt::color0. Note that using the Qt::black and Qt::white colors make no sense because the QColor::pixel() value is not necessarily 0 for black and 1 for white.

The QBitmap class provides the transformed() function returning a transformed copy of the bitmap; use the QTransform argument to translate, scale, shear, and rotate the bitmap. In addition, QBitmap provides the static fromData() function which returns a bitmap constructed from the given uchar data, and the static fromImage() function returning a converted copy of a QImage object.

Just like the QPixmap class, QBitmap is optimized by the use of implicit data sharing. For more information, see the Implicit Data Sharing documentation.

See also
QPixmap, QImage, QImageReader, QImageWriter

Definition at line 55 of file qbitmap.h.

Typedefs

◆ DataPtr

Warning
This function is not part of the public interface.

Definition at line 87 of file qbitmap.h.

Constructors and Destructors

◆ QBitmap() [1/5]

QBitmap::QBitmap ( )

Constructs a null bitmap.

See also
QPixmap::isNull()

Definition at line 106 of file qbitmap.cpp.

Referenced by fromImage(), and operator=().

108 {
109 }
QPixmap()
Constructs a null pixmap.
Definition: qpixmap.cpp:174
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ QBitmap() [2/5]

QBitmap::QBitmap ( const QPixmap pixmap)

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

If the pixmap has a depth greater than 1, the resulting bitmap will be dithered automatically.

See also
QPixmap::depth(), fromImage(), fromData()

Definition at line 158 of file qbitmap.cpp.

159 {
160  QBitmap::operator=(pixmap);
161 }
QBitmap & operator=(const QPixmap &)
Assigns the given pixmap to this bitmap and returns a reference to this bitmap.
Definition: qbitmap.cpp:207

◆ QBitmap() [3/5]

QBitmap::QBitmap ( int  width,
int  height 
)

Constructs a bitmap with the given width and height.

The pixels inside are uninitialized.

See also
clear()

Definition at line 123 of file qbitmap.cpp.

125 {
126 }
QPixmap()
Constructs a null pixmap.
Definition: qpixmap.cpp:174
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ QBitmap() [4/5]

QBitmap::QBitmap ( const QSize size)
explicit

Constructs a bitmap with the given size.

The pixels in the bitmap are uninitialized.

See also
clear()

Definition at line 135 of file qbitmap.cpp.

137 {
138 }
QPixmap()
Constructs a null pixmap.
Definition: qpixmap.cpp:174

◆ QBitmap() [5/5]

QBitmap::QBitmap ( const QString fileName,
const char *  format = 0 
)
explicit

Constructs a bitmap from the file specified by the given fileName.

If the file does not exist, or has an unknown format, the bitmap becomes a null bitmap.

The fileName and format parameters are passed on to the QPixmap::load() function. If the file format uses more than 1 bit per pixel, the resulting bitmap will be dithered automatically.

See also
QPixmap::isNull(), QImageReader::imageFormat()

Definition at line 186 of file qbitmap.cpp.

188 {
189  load(fileName, format, Qt::MonoOnly);
190 }
QPixmap()
Constructs a null pixmap.
Definition: qpixmap.cpp:174
bool load(const QString &fileName, const char *format=0, Qt::ImageConversionFlags flags=Qt::AutoColor)
Loads a pixmap from the file with the given fileName.
Definition: qpixmap.cpp:930
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ ~QBitmap()

QBitmap::~QBitmap ( )

Destroys the bitmap.

Definition at line 239 of file qbitmap.cpp.

240 {
241 }

Functions

◆ clear()

QBitmap::clear ( )
inline

Clears the bitmap, setting all its bits to Qt::color0.

Definition at line 69 of file qbitmap.h.

Referenced by QWindowsStyle::drawComplexControl().

69 { fill(Qt::color0); }
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
Definition: qpixmap.cpp:1080

◆ fromData()

QBitmap QBitmap::fromData ( const QSize size,
const uchar bits,
QImage::Format  monoFormat = QImage::Format_MonoLSB 
)
static

Constructs a bitmap with the given size, and sets the contents to the bits supplied.

The bitmap data has to be byte aligned and provided in in the bit order specified by monoFormat. The mono format must be either QImage::Format_Mono or QImage::Format_MonoLSB. Use QImage::Format_Mono to specify data on the XBM format.

See also
fromImage()

Definition at line 318 of file qbitmap.cpp.

Referenced by create32BitCursor(), operator=(), qt_pixmapForBrush(), QX11PixmapData::transformed(), and QCursorData::update().

319 {
320  Q_ASSERT(monoFormat == QImage::Format_Mono || monoFormat == QImage::Format_MonoLSB);
321 
322  QImage image(size, monoFormat);
323  image.setColor(0, QColor(Qt::color0).rgb());
324  image.setColor(1, QColor(Qt::color1).rgb());
325 
326  // Need to memcpy each line separatly since QImage is 32bit aligned and
327  // this data is only byte aligned...
328  int bytesPerLine = (size.width() + 7) / 8;
329  for (int y = 0; y < size.height(); ++y)
330  memcpy(image.scanLine(y), bits + bytesPerLine * y, bytesPerLine);
331  return QBitmap::fromImage(image);
332 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int width() const
Returns the width.
Definition: qsize.h:126
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
#define rgb(r, g, b)
Definition: qcolor_p.cpp:130
int height() const
Returns the height.
Definition: qsize.h:129
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags...
Definition: qbitmap.cpp:281

◆ fromImage()

QBitmap QBitmap::fromImage ( const QImage image,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
)
static

Returns a copy of the given image converted to a bitmap using the specified image conversion flags.

See also
fromData()

Definition at line 281 of file qbitmap.cpp.

Referenced by QGraphicsItem::boundingRegion(), convert(), QMacPixmapData::copy(), QPixmap::createHeuristicMask(), QPixmap::createMaskFromColor(), fromData(), QX11PixmapData::fromImage(), QPixmap::handle(), QX11PixmapData::mask(), QPixmapData::mask(), operator=(), QCursor::QCursor(), QPixmap::QPixmap(), qt_patternForAlpha(), and QMacStyle::styleHint().

282 {
283  if (image.isNull())
284  return QBitmap();
285 
286  QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags);
287 
288  // make sure image.color(0) == Qt::color0 (white)
289  // and image.color(1) == Qt::color1 (black)
290  const QRgb c0 = QColor(Qt::black).rgb();
291  const QRgb c1 = QColor(Qt::white).rgb();
292  if (img.color(0) == c0 && img.color(1) == c1) {
293  img.invertPixels();
294  img.setColor(0, c1);
295  img.setColor(1, c0);
296  }
297 
301 
302  data->fromImage(img, flags | Qt::MonoOnly);
303  return QPixmap(data.take());
304 }
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
unsigned int QRgb
Definition: qrgb.h:53
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
Definition: qimage.cpp:1850
QPixmap()
Constructs a null pixmap.
Definition: qpixmap.cpp:174
QExplicitlySharedDataPointer< QPixmapData > data
Definition: qpixmap.h:252
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags)=0
QBitmap()
Constructs a null bitmap.
Definition: qbitmap.cpp:106
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
void invertPixels(InvertMode=InvertRgb)
Inverts all pixel values in the image.
Definition: qimage.cpp:2179
virtual QPixmapData * createPixmapData(QPixmapData::PixelType type) const =0
static QGraphicsSystem * graphicsSystem()
static QPixmapData * createDefaultPixmapData(QPixmapData::PixelType type)
QRgb color(int i) const
Returns the color in the color table at index i.
Definition: qimage.cpp:1829
QRgb rgb() const
Returns the RGB value of the color.
Definition: qcolor.cpp:1051

◆ operator QVariant()

QBitmap::operator QVariant ( ) const

Returns the bitmap as a QVariant.

Definition at line 257 of file qbitmap.cpp.

258 {
259  return QVariant(QVariant::Bitmap, this);
260 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92

◆ operator=()

QBitmap & QBitmap::operator= ( const QPixmap pixmap)

Assigns the given pixmap to this bitmap and returns a reference to this bitmap.

Converts the given image to a bitmap, and assigns the result to this bitmap.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

If the pixmap has a depth greater than 1, the resulting bitmap will be dithered automatically.

See also
QPixmap::depth()

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a reference to the bitmap.

Use the static fromImage() function instead.

Definition at line 207 of file qbitmap.cpp.

Referenced by QBitmap().

208 {
209  if (pixmap.isNull()) { // a null pixmap
210  QBitmap bm(0, 0);
211  QBitmap::operator=(bm);
212  } else if (pixmap.depth() == 1) { // 1-bit pixmap
213  QPixmap::operator=(pixmap); // shallow assignment
214  } else { // n-bit depth pixmap
215  QImage image;
216  image = pixmap.toImage(); // convert pixmap to image
217  *this = fromImage(image); // will dither image
218  }
219  return *this;
220 }
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
QPixmap & operator=(const QPixmap &)
Assigns the given pixmap to this pixmap and returns a reference to this pixmap.
Definition: qpixmap.cpp:471
QBitmap & operator=(const QPixmap &)
Assigns the given pixmap to this bitmap and returns a reference to this bitmap.
Definition: qbitmap.cpp:207
int depth() const
Returns the depth of the pixmap.
Definition: qpixmap.cpp:695
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static QBitmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Returns a copy of the given image converted to a bitmap using the specified image conversion flags...
Definition: qbitmap.cpp:281
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition: qpixmap.cpp:615

◆ swap()

void QBitmap::swap ( QBitmap other)
inline

Swaps bitmap other with this bitmap.

Since
4.8

This operation is very fast and never fails.

Definition at line 66 of file qbitmap.h.

66 { QPixmap::swap(other); } // prevent QBitmap<->QPixmap swaps
void swap(QPixmap &other)
Swaps pixmap other with this pixmap.
Definition: qpixmap.h:90

◆ transformed() [1/2]

QBitmap QBitmap::transformed ( const QMatrix matrix) const

This convenience function converts the matrix to a QTransform and calls the overloaded function.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 356 of file qbitmap.cpp.

Referenced by QX11PixmapData::transformed().

357 {
358  return transformed(QTransform(matrix));
359 }
QBitmap transformed(const QMatrix &) const
This convenience function converts the matrix to a QTransform and calls the overloaded function...
Definition: qbitmap.cpp:356
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ transformed() [2/2]

QBitmap QBitmap::transformed ( const QTransform matrix) const

Returns a copy of this bitmap, transformed according to the given matrix.

See also
QPixmap::transformed()

Definition at line 340 of file qbitmap.cpp.

341 {
342  QBitmap bm = QPixmap::transformed(matrix);
343  return bm;
344 }
QPixmap transformed(const QMatrix &, Qt::TransformationMode mode=Qt::FastTransformation) const
This convenience function loads the matrix into a QTransform and calls the overloaded function...
Definition: qpixmap.cpp:1723
The QBitmap class provides monochrome (1-bit depth) pixmaps.
Definition: qbitmap.h:55

The documentation for this class was generated from the following files: