5 * Created by Alyssa Milburn on Sat May 22 2004.
6 * Copyright (c) 2004-2008 Alyssa Milburn. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef _CREATURESIMAGE_H
21 #define _CREATURESIMAGE_H
26 #include <boost/shared_ptr.hpp>
28 enum imageformat
{ if_paletted
, if_16bit
, if_16bitcompressed
, if_32bit
};
30 unsigned int bitDepthOf(imageformat f
);
32 class creaturesImage
{
33 friend class fileSwapper
;
36 unsigned int m_numframes
;
37 unsigned short *widths
, *heights
;
40 imageformat imgformat
;
43 std::ifstream
*stream
;
47 creaturesImage(std::string n
= std::string()) { stream
= 0; name
= n
; }
48 virtual ~creaturesImage() { if (stream
) delete stream
; }
49 bool is565() { return is_565
; }
50 imageformat
format() { return imgformat
; }
51 unsigned int numframes() { return m_numframes
; }
52 unsigned int width(unsigned int frame
) { return widths
[frame
]; }
53 unsigned int height(unsigned int frame
) { return heights
[frame
]; }
54 void *data(unsigned int frame
) { return buffers
[frame
]; }
55 std::string
getName() { return name
; }
57 virtual bool transparentAt(unsigned int frame
, unsigned int x
, unsigned int y
);
58 virtual boost::shared_ptr
<creaturesImage
> mutableCopy();
59 virtual void tint(unsigned char r
, unsigned char g
, unsigned char b
, unsigned char rotation
, unsigned char swap
);