7 // ****************************************************************************
9 // WINIMAGE.H : Generic classes for raster images (MSWindows specialization)
11 // Content: Class declarations of:
12 // - class CAnimatedGif : Storage class for single images
13 // - class CAnimatedGifSet : Storage class for sets of images
14 // - class C_AnimationWindow : Window Class to display animations
16 // (Includes declarations of routines to Load and Save BMP files and to load
17 // GIF files into these classes).
19 // --------------------------------------------------------------------------
21 // Copyright (c) 2000, Juan Soulie <jsoulie@cplusplus.com>
23 // Permission to use, copy, modify, distribute and sell this software or any
24 // part thereof and/or its documentation for any purpose is granted without fee
25 // provided that the above copyright notice and this permission notice appear
28 // This software is provided "as is" without express or implied warranty of
29 // any kind. The author shall have no liability with respect to the
30 // infringement of copyrights or patents that any modification to the content
31 // of this file or this file itself may incur.
33 // ****************************************************************************
36 #include "Texture.h" // for COLOR
44 typedef struct tagGUIRGBQUAD
57 typedef struct tagGUIBITMAPINFOHEADER
77 typedef struct tagGUIBITMAPINFO
79 GUIBITMAPINFOHEADER bmiHeader;
80 GUIRGBQUAD bmiColors[1];
86 // ****************************************************************************
88 // * Storage class for single images *
89 // ****************************************************************************
92 \brief Storage class for single images
98 virtual ~CAnimatedGif();
101 int Width, Height; ///< Dimensions in pixels
102 int BPP; // Bits Per Pixel
103 char* Raster; ///< Bits of Raster Data (Byte Aligned)
104 COLOR* Palette; ///< Color Map
105 int BytesPerRow; ///< Width (in bytes) including alignment!
106 int Transparent; ///< Index of Transparent color (-1 for none)
108 // Extra members for animations:
110 int xPos, yPos; ///< Relative Position
111 int Delay; ///< Delay after image in 1/1000 seconds.
112 int Transparency; ///< Animation Transparency.
113 // Windows GDI specific:
114 GUIBITMAPINFO* pbmi; ///< BITMAPINFO structure
116 // constructor and destructor:
118 // operator= (object copy)
119 CAnimatedGif& operator= (CAnimatedGif& rhs);
121 /// \brief Image initializer (allocates space for raster and palette):
122 void Init (int iWidth, int iHeight, int iBPP, int iLoops = 0);
124 inline char& Pixel (int x, int y) { return Raster[y*BytesPerRow + x];}
128 // ****************************************************************************
129 // * CAnimatedGifSet *
130 // * Storage class for sets of images *
131 // ****************************************************************************
134 \brief Storage class for sets of images
136 class CAnimatedGifSet
140 // constructor and destructor:
142 virtual ~CAnimatedGifSet();
144 int FrameWidth, FrameHeight; ///< Dimensions of ImageSet in pixels.
145 int nLoops; // Number of Loops (0 = infinite)
147 std::vector<CAnimatedGif*> m_vecimg; ///< Images' Vector.
149 void AddImage (CAnimatedGif*); ///< Append new image to vector (push_back)
151 int GetImageCount() const;
153 int LoadGIF (const char* szFile);
157 static unsigned char getbyte(FILE *fd);