Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QBitmap Class Reference
[QtGui module]

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

 #include <QBitmap>

Inherits QPixmap.

Public Functions

Static Public Members

  • QBitmap fromData ( const QSize & size, const uchar * bits, QImage::Format monoFormat = QImage::Format_MonoLSB )
  • QBitmap fromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor )
  • 8 static public members inherited from QPixmap

Additional Inherited Members


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 QMatrix 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, and QImageWriter.


Member Function Documentation

QBitmap::QBitmap ()

Constructs a null bitmap.

See also QPixmap::isNull().

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(), and fromData().

QBitmap::QBitmap ( int width, int height )

Constructs a bitmap with the given width and height. The pixels inside are uninitialized.

See also clear().

QBitmap::QBitmap ( const QSize & size )

Constructs a bitmap with the given size. The pixels in the bitmap are uninitialized.

See also clear().

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

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() and QImageReader::imageFormat().

QBitmap::~QBitmap ()

Destroys the bitmap.

void QBitmap::clear ()

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

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().

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().

QBitmap QBitmap::transformed ( const QMatrix & matrix ) const

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

See also QPixmap::transformed().

QBitmap::operator QVariant () const

Returns the bitmap as a QVariant.

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

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

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

See also QPixmap::depth().


Member Function Documentation

QBitmap::QBitmap ( int width, int height, bool clear )

Constructs a bitmap with the given width and height. If clear is true, the bits are initialized to Qt::color0.

Use the corresponding QBitmap() constructor instead, and then call the clear() function if the clear parameter is true.

QBitmap::QBitmap ( const QSize & size, bool clear )

Constructs a bitmap with the given size. If clear is true, the bits are initialized to Qt::color0.

Use the corresponding QBitmap() constructor instead, and then call the clear() function if the clear parameter is true.

QBitmap::QBitmap ( int width, int height, const uchar * bits, bool isXbitmap = false )

Constructs a bitmap with the given width and height, and sets the contents to the bits supplied. The isXbitmap flag should be true if bits was generated by the X11 bitmap program.

Use the static fromData() function instead. If isXbitmap is true, use the default bit order(QImage_FormatMonoLSB) otherwise use QImage::Format_Mono.

QBitmap::QBitmap ( const QImage & image )

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

Use the static fromImage() function instead.

QBitmap::QBitmap ( const QSize & size, const uchar * bits, bool isXbitmap = false )

Constructs a bitmap with the given size, and sets the contents to the bits supplied. The isXbitmap flag should be true if bits was generated by the X11 bitmap program.

Use the static fromData() function instead. If isXbitmap is true, use the default bit order(QImage_FormatMonoLSB) otherwise use QImage::Format_Mono.

QBitmap QBitmap::xForm ( const QMatrix & matrix ) const

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

Use transformed() instead.

QBitmap & QBitmap::operator= ( const QImage & image )

This is an overloaded member function, provided for convenience.

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

Use the static fromImage() function instead.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web