Qt Jambi Home

com.trolltech.qt.gui
Class QBitmap

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.gui.QPixmap
              extended by com.trolltech.qt.gui.QBitmap
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QBitmap
extends QPixmap

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, QImageWriter

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Constructor Summary
QBitmap()
          Constructs a null bitmap.
QBitmap(int w, int h)
          Constructs a bitmap with the given w and h.
QBitmap(QPixmap arg__1)
          Constructs a bitmap that is a copy of the given arg__1.
QBitmap(QSize arg__1)
          Constructs a bitmap with the given arg__1.
QBitmap(java.lang.String fileName)
          This is an overloaded constructor provided for convenience.
QBitmap(java.lang.String fileName, java.lang.String format)
          Constructs a bitmap from the file specified by the given fileName.
 
Method Summary
 void clear()
          Clears the bitmap, setting all its bits to Qt::color0.
static QBitmap fromData(QSize size, byte[] bits)
          This is an overloaded constructor provided for convenience.
static QBitmap fromData(QSize size, byte[] bits, QImage.Format monoFormat)
          Constructs a bitmap with the given size, and sets the contents to the bits supplied.
static QBitmap fromImage(QImage image, Qt.ImageConversionFlags flags)
          Returns a copy of the given image converted to a bitmap using the specified image conversion flags.
static QBitmap fromNativePointer(QNativePointer nativePointer)
          This function returns the QBitmap instance pointed to by nativePointer
static QNativePointer nativePointerArray(QBitmap[] array)
          This function returns a QNativePointer that is pointing to the specified QBitmap array.
 QBitmap transformed(QMatrix arg__1)
          This convenience function converts the arg__1 to a QTransform and calls the overloaded function.
 QBitmap transformed(QTransform matrix)
          Returns a copy of this bitmap, transformed according to the given matrix.
 
Methods inherited from class com.trolltech.qt.gui.QPixmap
alphaChannel, cacheKey, copy, copy, copy, createHeuristicMask, createHeuristicMask, createMaskFromColor, createMaskFromColor, defaultDepth, depth, devType, fill, fill, fill, fill, fromImage, fromImage, grabWidget, grabWidget, grabWidget, grabWidget, grabWidget, grabWidget, grabWindow, grabWindow, grabWindow, grabWindow, grabWindow, hasAlpha, hasAlphaChannel, height, heightMM, isNull, isQBitmap, load, load, load, load, loadFromData, loadFromData, loadFromData, loadFromData, loadFromData, loadFromData, loadFromData, loadFromData, logicalDpiX, logicalDpiY, mask, metric, nativePointerArray, numColors, paintEngine, paintingActive, physicalDpiX, physicalDpiY, readFrom, rect, save, save, save, save, save, save, scaled, scaled, scaled, scaled, scaled, scaled, scaledToHeight, scaledToHeight, scaledToWidth, scaledToWidth, setAlphaChannel, setMask, size, toImage, transformed, transformed, trueMatrix, trueMatrix, width, widthMM, writeTo
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QBitmap

public QBitmap(QPixmap arg__1)

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

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

See Also:
QPixmap::depth, fromImage, fromData

QBitmap

public QBitmap(QSize arg__1)

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

See Also:
clear

QBitmap

public QBitmap(int w,
               int h)

Constructs a bitmap with the given w and h. The pixels inside are uninitialized.

See Also:
clear

QBitmap

public QBitmap()

Constructs a null bitmap.

See Also:
QPixmap::isNull

QBitmap

public QBitmap(java.lang.String fileName,
               java.lang.String format)
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.


QBitmap

public QBitmap(java.lang.String fileName)
This is an overloaded constructor provided for convenience.

Method Detail

clear

public final void clear()

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


transformed

public final QBitmap transformed(QMatrix arg__1)

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


transformed

public final QBitmap transformed(QTransform matrix)

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

See Also:
QPixmap::transformed

fromImage

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

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

See Also:
fromData

fromNativePointer

public static QBitmap fromNativePointer(QNativePointer nativePointer)
This function returns the QBitmap instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

public static QNativePointer nativePointerArray(QBitmap[] array)
This function returns a QNativePointer that is pointing to the specified QBitmap array.

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

fromData

public static QBitmap fromData(QSize size,
                               byte[] bits,
                               QImage.Format monoFormat)
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.


fromData

public static QBitmap fromData(QSize size,
                               byte[] bits)
This is an overloaded constructor provided for convenience.


Qt Jambi Home