How can I create a sprite sheet using qpixmap or qimage or whatever?
Hi dudes!
I have several small PNGs and I'd like to copy them into a new and large PNG, to create a sprite sheet (and a text file with coordinates...)
I've been reading QPixmap and QImage docs but I don't see any method like CopyThisImagePartToThisOneWithThisPosition()
Does anyone have any suggestion?
Thanks a lot for yout help.
Re: How can I create a sprite sheet using qpixmap or qimage or whatever?
I think you want this: http://doc.trolltech.com/4.5/qimage.html#copy you can use it like this:
Code:
QImage sprite
= sheet.
copy(0,
0,
48,
48);
Re: How can I create a sprite sheet using qpixmap or qimage or whatever?
Re: How can I create a sprite sheet using qpixmap or qimage or whatever?
Quote:
Originally Posted by
arturo182
I'd like just the opposite, something like:
-Create a large QImage
-Open a small PNG or QImage an copy it to a specific position on that big QImage
What you said is the opposite, is how to extract sprites from sprite sheet.
Any idea?
Re: How can I create a sprite sheet using qpixmap or qimage or whatever?
wysota already answered your query..elaborating it a bit more..create a big pixmap of the size that can contain all other images..use drawPixmap of painter to draw the images to respective positions..u can always find size of each pixmap you have, thus you can find out where to draw the next image in the big pixmap..should be a pretty straightforward task
Re: How can I create a sprite sheet using qpixmap or qimage or whatever?
OK, I'll try it out.
Thanks!