1
/****************************************************************************
2
** anim.cpp - handles animations
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
24
Anim::Anim(const QPixmap &pix)
26
QImage image = pix.convertToImage();
28
seq.setAutoDelete(TRUE);
29
qim_seq.setAutoDelete(TRUE);
32
for(n = 0; ((n+1) * 16) <= image.width(); ++n) {
36
qim_seq.insert(n, new QImage(image.copy(n * 16, 0, 16, 16)) );
37
seq.insert(n, new QPixmap);
38
seq[n]->convertFromImage(*qim_seq[n]);
41
// hopefully this never happens
46
seq.insert(0, new QPixmap(16,16));
47
seq[0]->fill(Qt::black);
48
qim_seq.insert(0, new QImage(seq[0]->convertToImage()) );
64
QPixmap & Anim::frame(int x)
66
// if we don't have the frame, just return the base
73
QPixmap & Anim::base()
78
QImage & Anim::qim_frame(int x)
86
QImage & Anim::qim_base()