Classes - Annotated - Tree - Functions - Home - Structure Qte

QCanvasPixmap Class Reference
[ canvas module ]

The QCanvasPixmap class provides a pixmap with an offset. More...

#include <qcanvas.h>

Inherits QPixmap.

List of all member functions.

Public Members

Detailed Description

The QCanvasPixmap class provides a pixmap with an offset.

QImage has an offset or "hot spot", but QPixmap does not. This class adds the notion of an offset to QPixmap as this is very useful for the canvas sprites where QCanvasPixmap is used. It also keeps a copy of the display mask for use in collision detection.

Note that PNG format files already have support for an offset.

See also QCanvasPixmapArray, QCanvasItem and QCanvasSprite.

Member Function Documentation

QCanvasPixmap::QCanvasPixmap ( const QImage & image )

Constructs a QCanvasPixmap from an image.

QCanvasPixmap::QCanvasPixmap ( const QPixmap & pm, QPoint offset )

Constructs a QCanvasPixmap from a pixmap and an offset.

QCanvasPixmap::QCanvasPixmap ( const QString & datafilename )

Constructs a QCanvasPixmap from an image file by loading it.

QCanvasPixmap::~QCanvasPixmap ()

Destructs the pixmap.

int QCanvasPixmap::offsetX () const

Returns the X-offset of the pixmap.

See also setOffset().

int QCanvasPixmap::offsetY () const

Returns the Y-offset of the pixmap.

See also setOffset().

void QCanvasPixmap::setOffset ( int x, int y )

Sets the offset to (x, y).

The offset position or "hot spot" defines the origin pixel in the image For example, if the offset is (10,5), it will be displayed drawn 10 pixels to the left of and 5 pixels above the actual (x,y) coordinate of the sprite.

Search the documentation, FAQ, qt-interest archive and more (uses www.trolltech.com):

This file is part of the Qt toolkit, copyright © 1995-2005 Trolltech, all rights reserved.

Copyright © 2005 TrolltechTrademarks
Qt version 2.3.10