Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQBitmap Class Reference

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

#include <qbitmap.h>

Inherits TQPixmap.

List of all member functions.

Public Members


Detailed Description

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

The TQBitmap class is a monochrome off-screen paint device used mainly for creating custom TQCursor and TQBrush objects, in TQPixmap::setMask() and for TQRegion.

A TQBitmap is a TQPixmap 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 TQBitmap is guaranteed to always have the depth 1, unless it is TQPixmap::isNull() which has depth 0.

When drawing in a TQBitmap (or TQPixmap with depth 1), we recommend using the TQColor objects TQt::color0 and TQt::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 TQColor objects make no sense because the TQColor::pixel() value is not necessarily 0 for black and 1 for white.

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

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

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


Member Function Documentation

TQBitmap::TQBitmap ()

Constructs a null bitmap.

See also TQPixmap::isNull().

TQBitmap::TQBitmap ( int w, int h, bool clear = FALSE, TQPixmap::Optimization optimization = TQPixmap::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 TQColor TQt::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 TQPixmap::Optimization.

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

TQBitmap::TQBitmap ( const TQSize & size, bool clear = FALSE, TQPixmap::Optimization optimization = TQPixmap::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 TQColor TQt::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 TQPixmap::Optimization.

TQBitmap::TQBitmap ( 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 TQImage documentation discusses bit order of monochrome images.

Example (creates an arrow bitmap):

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

TQBitmap::TQBitmap ( const TQSize & 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 TQImage documentation discusses bit order of monochrome images.

TQBitmap::TQBitmap ( const TQBitmap & bitmap )

Constructs a bitmap that is a copy of bitmap.

TQBitmap::TQBitmap ( const TQString & 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 TQPixmap::load(). Dithering will be performed if the file format uses more than 1 bit per pixel.

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

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

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

TQBitmap & TQBitmap::operator= ( const TQPixmap & 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 TQPixmap::depth() greater than 1.

TQBitmap & TQBitmap::operator= ( const TQImage & 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 TQImage::depth() greater than 1.

TQBitmap TQBitmap::xForm ( const TQWMatrix & matrix ) const

Returns a transformed copy of this bitmap by using matrix.

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

See also TQPixmap::xForm().


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


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8