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

TQCanvasPixmap Class Reference
[canvas module]

The TQCanvasPixmap class provides pixmaps for TQCanvasSprites. More...

#include <tqcanvas.h>

Inherits TQPixmap.

List of all member functions.

Public Members


Detailed Description

The TQCanvasPixmap class provides pixmaps for TQCanvasSprites.

If you want to show a single pixmap on a TQCanvas use a TQCanvasSprite with just one pixmap.

When pixmaps are inserted into a TQCanvasPixmapArray they are held as TQCanvasPixmaps. TQCanvasSprites are used to show pixmaps on TQCanvases and hold their pixmaps in a TQCanvasPixmapArray. If you retrieve a frame (pixmap) from a TQCanvasSprite it will be returned as a TQCanvasPixmap.

The pixmap is a TQPixmap and can only be set in the constructor. There are three different constructors, one taking a TQPixmap, one a TQImage and one a file name that refers to a file in any supported file format (see TQImageIO).

TQCanvasPixmap can have a hotspot which is defined in terms of an (x, y) offset. When you create a TQCanvasPixmap from a PNG file or from a TQImage that has a TQImage::offset(), the offset() is initialized appropriately, otherwise the constructor leaves it at (0, 0). You can set it later using setOffset(). When the TQCanvasPixmap is used in a TQCanvasSprite, the offset position is the point at TQCanvasItem::x() and TQCanvasItem::y(), not the top-left corner of the pixmap.

Note that for TQCanvasPixmap objects created by a TQCanvasSprite, the position of each TQCanvasPixmap object is set so that the hotspot stays in the same position.

See also TQCanvasPixmapArray, TQCanvasItem, TQCanvasSprite, Graphics Classes, and Image Processing Classes.


Member Function Documentation

TQCanvasPixmap::TQCanvasPixmap ( const TQString & datafilename )

Constructs a TQCanvasPixmap that uses the image stored in datafilename.

TQCanvasPixmap::TQCanvasPixmap ( const TQImage & image )

Constructs a TQCanvasPixmap from the image image.

TQCanvasPixmap::TQCanvasPixmap ( const TQPixmap & pm, const TQPoint & offset )

Constructs a TQCanvasPixmap from the pixmap pm using the offset offset.

TQCanvasPixmap::~TQCanvasPixmap ()

Destroys the pixmap.

int TQCanvasPixmap::offsetX () const

Returns the x-offset of the pixmap's hotspot.

See also setOffset().

int TQCanvasPixmap::offsetY () const

Returns the y-offset of the pixmap's hotspot.

See also setOffset().

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

Sets the offset of the pixmap's hotspot to (x, y).

Warning: Do not call this function if any TQCanvasSprites are currently showing this pixmap.


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


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8