QCanvasPixmapArray(3qt)

πŸ“¦ version 3.3.8b, in fedora 43, fedora 44

πŸ’– QCanvasPixmapArray β€” the qcanvaspixmaparray.3qt manual, but make it cute πŸ’–

okay bestie, gather round, because this one is literally the sprite-frame-holding queen of Qt 3 and she deserves her flowers. πŸ‘‘


✨ NAME ✨

QCanvasPixmapArray β€” an array of QCanvasPixmaps. that's it, that's the whole vibe. a little squad of pixmaps, all in a row, ready to be cycled through. πŸŽ€


✨ SYNOPSIS ✨

first things first, you gotta pull her in:

#include <qcanvas.h>

🌸 Public Members 🌸

  • QCanvasPixmapArray ()
  • QCanvasPixmapArray ( const QString & datafilenamepattern, int fc = 0 )
  • QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots ) β€” (obsolete, we'll get to it, don't @ me)
  • QCanvasPixmapArray ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )
  • ~QCanvasPixmapArray ()
  • bool readPixmaps ( const QString & filenamepattern, int fc = 0 )
  • bool readCollisionMasks ( const QString & filename )
  • bool operator! () β€” (obsolete, again, she's vintage)
  • bool isValid () const
  • QCanvasPixmap * image ( int i ) const
  • void setImage ( int i, QCanvasPixmap * p )
  • uint count () const

✨ DESCRIPTION ✨

so the QCanvasPixmapArray class is literally just: an array of QCanvasPixmaps. that's her job. she holds pixmaps. slay.

QCanvasSprite is the one who actually uses her β€” she's the backbone behind animated sprites, aka images that change over time, where each pixmap in the array is one frame of the animation. it's giving flipbook energy. πŸ¦‹

depending on which constructor you pick, you can load a bunch of pixmaps into the array two different ways:

  • from a directory (and you specify a wildcard pattern for the files), or
  • from a list of QPixmaps.

you can also read pixmaps in after you've already constructed her, using readPixmaps(). no cap, it's flexible like that.

individual pixmaps get set with setImage() and pulled back out with image(). and the number of pixmaps chilling in the array? that's count(). πŸ’…

here's a thing that matters: QCanvasSprite uses an image's mask for collision detection. if you wanna change that up, you read in a separate set of image masks using readCollisionMasks(). iconic behavior.

See also: Graphics Classes and Image Processing Classes.


✨ MEMBER FUNCTION DOCUMENTATION ✨

🫢 QCanvasPixmapArray::QCanvasPixmapArray ()

constructs an invalid array β€” meaning isValid() will return FALSE. 😭 you must call readPixmaps() before you can actually use this QCanvasPixmapArray. she's not ready yet, bestie, she needs to be fed.

🫢 QCanvasPixmapArray::QCanvasPixmapArray ( const QString & datafilenamepattern, int fc = 0 )

constructs a QCanvasPixmapArray from files. load 'em up. πŸ”₯

the fc parameter sets the number of frames to be loaded for this image.

if fc is not 0, datafilenamepattern should contain "%1", e.g. "foo%1.png". the actual filenames are formed by replacing the %1 with four-digit integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png, foo0002.png, etc. cute, right? it's giving numbered-frames-on-a-filmstrip.

if fc is 0, datafilenamepattern is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame. one and done. periodt.

⚠️ if datafilenamepattern does not exist, is not readable, isn't an image, or some other error occurs, the array ends up empty and isValid() returns FALSE. she's just a shell at that point. πŸ’€

🫢 QCanvasPixmapArray::QCanvasPixmapArray ( QPtrList<QPixmap> list, QPtrList<QPoint> hotspots )

🚨 This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

use QCanvasPixmapArray::QCanvasPixmapArray( QValueList<QPixmap>, QPointArray ) instead. the glow-up is right there, bestie.

constructs a QCanvasPixmapArray from the list of QPixmaps list. the hotspots list has to be of the same size as list. matching set or it doesn't work, iykyk.

🫢 QCanvasPixmapArray::QCanvasPixmapArray ( QValueList<QPixmap> list, QPointArray hotspots = QPointArray ( ) )

constructs a QCanvasPixmapArray from the list of QPixmaps in the list. each pixmap will get a hotspot according to the hotspots array. if no hotspots are specified, each one is set to be at position (0, 0). default behavior, no drama. ✨

if an error occurs, isValid() will return FALSE.

🫢 QCanvasPixmapArray::~QCanvasPixmapArray ()

destroys the pixmap array and all the pixmaps it contains. she takes everything with her. πŸ’… clean exit, no leftovers.

🫢 uint QCanvasPixmapArray::count () const

returns the number of pixmaps in the array. that's the headcount. 🌈

🫢 QCanvasPixmap * QCanvasPixmapArray::image ( int i ) const

returns pixmap i in the array, if i is non-negative and less than than count(), and returns an unspecified value otherwise.

πŸ’€ yes, that says "less than than". we're keeping it. don't come for me. and yes β€” if i is out of bounds, you get an unspecified value. so like. don't. πŸ™ˆ

🫢 bool QCanvasPixmapArray::isValid () const

returns TRUE if the pixmap array is valid; otherwise returns FALSE. simple. vibe check, essentially. βœ…

🫢 bool QCanvasPixmapArray::operator! ()

🚨 This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code.

use isValid() instead. okay? okay. πŸ’œ

this returns FALSE if the array is valid, and TRUE if it is not. yes, it's the opposite of what you'd expect. that's the bit. that's the joke. she's from 2007.

🫢 bool QCanvasPixmapArray::readCollisionMasks ( const QString & filename )

reads new collision masks for the array. 🎯

by default, QCanvasSprite uses the image mask of a sprite to detect collisions. use this function to set your own collision image masks.

  • if count() is 1, filename must specify a real filename to read the mask from.
  • if count() is greater than 1, the filename must contain a "%1" that will get replaced by the number of the mask to be loaded, just like QCanvasPixmapArray::readPixmaps().
⚠️ all collision masks must be 1-bit images or this function call will fail. no exceptions, bestie. 1-bit only. πŸ‘‘

if the file isn't readable, contains the wrong number of images, or there is some other error, this function will return FALSE, and the array will be flagged as invalid; otherwise this function returns TRUE.

See also: isValid().

🫢 bool QCanvasPixmapArray::readPixmaps ( const QString & filenamepattern, int fc = 0 )

reads one or more pixmaps into the pixmap array. load 'em in, bestie. 🧚

if fc is not 0, filenamepattern should contain "%1", e.g." foo%1.png". the actual filenames are formed by replacing the %1 with four-digit integers from 0 to (fc - 1), e.g. foo0000.png, foo0001.png, foo0002.png, etc.

if fc is 0, filenamepattern is asssumed to be a filename, and the image contained in this file will be loaded as the first (and only) frame.

if filenamepattern does not exist, is not readable, isn't an image, or some other error occurs, this function will return FALSE, and isValid() will return FALSE; otherwise this function will return TRUE.

See also: isValid().

🫢 void QCanvasPixmapArray::setImage ( int i, QCanvasPixmap * p )

replaces the pixmap at index i with pixmap p. swap in, swap out. πŸ”„

πŸ’– the array takes ownership of p and will delete p when the array itself is deleted. so don't you dare delete p yourself, that's her job now. she's the main character, she handles it.

if i is beyond the end of the array the array is extended to at least i+1 elements, with elements count() to i-1 being initialized to 0. she grows for you. 🌱


✨ SEE ALSO ✨


Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.


✨ AUTHOR ✨

Generated automatically from the source code. (no human author got a credit, she simply manifested. ✨)


✨ BUGS ✨

if you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. good bug reports help us to help you. thank you. 🫢

the definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. this man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. so like. keep that in mind. πŸ™ˆ

if you find errors in this manual page, please report them to qt-bugs@trolltech.com. please include the name of the manual page (qcanvaspixmaparray.3qt) and the Qt version (3.3.8).


and that's the whole page, bestie. πŸ’œ written by Trolltech AS on 2 February 2007, shipped with Qt 3.3.8 β€” yes she's a little vintage, yes she still ate, and yes, QCanvasPixmapArray(3qt) is lowkey iconic. no cap. πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from