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  ·  Fonctions  · 

QBitmap Class Reference

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

#include <qbitmap.h>

Inherits QPixmap.

List of all member functions.

Public Members

  • QBitmap ( int w, int h, bool clear = FALSE, QPixmap::Optimization optimization = QPixmap::DefaultOptim )
  • QBitmap ( const QSize & size, bool clear = FALSE, QPixmap::Optimization optimization = QPixmap::DefaultOptim )
  • QBitmap ( int w, int h, const uchar * bits, bool isXbitmap = FALSE )
  • QBitmap ( const QSize & size, const uchar * bits, bool isXbitmap = FALSE )
  • QBitmap ( const QBitmap & bitmap )
  • QBitmap ( const QString & fileName, const char * format = 0 )
  • QBitmap & operator= ( const QBitmap & bitmap )
  • QBitmap & operator= ( const QPixmap & pixmap )
  • QBitmap & operator= ( const QImage & image )
  • QBitmap xForm ( const QWMatrix & matrix ) const

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, in QPixmap::setMask() and for QRegion.

A QBitmap is a QPixmap with a depth of 1. If a pixmap with a depth greater than 1 is assigned to a bitmap, the bitmap will be dithered automatically. A QBitmap is guaranteed to always have the depth 1, unless it is QPixmap::isNull() which has depth 0.

When drawing in a QBitmap (or QPixmap with depth 1), we recommend using the QColor objects Qt::color0 and Qt::color1. Painting with color0 sets the bitmap bits to 0, and painting with color1 sets the bits to 1. For a bitmap, 0-bits indicate background (or transparent) and 1-bits indicate foreground (or opaque). Using the black and white QColor objects make no sense because the QColor::pixel() value is not necessarily 0 for black and 1 for white.

The QBitmap can be transformed (translated, scaled, sheared or rotated) using xForm().

Just like the QPixmap class, QBitmap is optimized by the use of implicit sharing, so it is very efficient to pass QBitmap objects as arguments.

See also QPixmap, QPainter::drawPixmap(), bitBlt(), Shared Classes, Graphics Classes, Image Processing Classes, and Implicitly and Explicitly Shared Classes.


Member Function Documentation

QBitmap::QBitmap ()

Constructs a null bitmap.

See also QPixmap::isNull().

QBitmap::QBitmap ( int w, int h, bool clear = FALSE, QPixmap::Optimization optimization = QPixmap::DefaultOptim )

Constructs a bitmap with width w and height h.

The contents of the bitmap is uninitialized if clear is FALSE; otherwise it is filled with pixel value 0 (the QColor Qt::color0).

The optional optimization argument specifies the optimization setting for the bitmap. The default optimization should be used in most cases. Games and other pixmap-intensive applications may benefit from setting this argument; see QPixmap::Optimization.

See also QPixmap::setOptimization() and QPixmap::setDefaultOptimization().

QBitmap::QBitmap ( const QSize & size, bool clear = FALSE, QPixmap::Optimization optimization = QPixmap::DefaultOptim )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Constructs a bitmap with the size size.

The contents of the bitmap is uninitialized if clear is FALSE; otherwise it is filled with pixel value 0 (the QColor Qt::color0).

The optional optimization argument specifies the optimization setting for the bitmap. The default optimization should be used in most cases. Games and other pixmap-intensive applications may benefit from setting this argument; see QPixmap::Optimization.

QBitmap::QBitmap ( int w, int h, const uchar * bits, bool isXbitmap = FALSE )

Constructs a bitmap with width w and height h and sets the contents to bits.

The isXbitmap flag should be TRUE if bits was generated by the X11 bitmap program. The X bitmap bit order is little endian. The QImage documentation discusses bit order of monochrome images.

Example (creates an arrow bitmap):

        uchar arrow_bits[] = { 0x3f, 0x1f, 0x0f, 0x1f, 0x3b, 0x71, 0xe0, 0xc0 };
        QBitmap bm( 8, 8, arrow_bits, TRUE );
    

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

The isXbitmap flag should be TRUE if bits was generated by the X11 bitmap program. The X bitmap bit order is little endian. The QImage documentation discusses bit order of monochrome images.

QBitmap::QBitmap ( const QBitmap & bitmap )

Constructs a bitmap that is a copy of bitmap.

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

Constructs a bitmap from the file fileName. If the file does not exist or is of an unknown format, the bitmap becomes a null bitmap.

The parameters fileName and format are passed on to QPixmap::load(). Dithering will be performed if the file format uses more than 1 bit per pixel.

See also QPixmap::isNull(), QPixmap::load(), QPixmap::loadFromData(), QPixmap::save(), and QPixmap::imageFormat().

QBitmap & QBitmap::operator= ( const QBitmap & bitmap )

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

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

Dithering will be performed if the pixmap has a QPixmap::depth() greater than 1.

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

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

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

Dithering will be performed if the image has a QImage::depth() greater than 1.

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

Returns a transformed copy of this bitmap by using matrix.

This function does exactly the same as QPixmap::xForm(), except that it returns a QBitmap instead of a QPixmap.

See also QPixmap::xForm().


This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.

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 94
  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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  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. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Le Qt Quarterly au hasard

Logo

Requête de données génériques avec QtXmlPatterns et XQuery

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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 3.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