anim_bitmap.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * anim_bitmap.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2005 the VideoLAN team
00005  * $Id: 6667ce118c51b2dd39db824ad985e233231bfb75 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License along
00020  * with this program; if not, write to the Free Software Foundation, Inc.,
00021  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef ANIM_BITMAP_HPP
00025 #define ANIM_BITMAP_HPP
00026 
00027 #include "../commands/cmd_generic.hpp"
00028 #include "../utils/observer.hpp"
00029 #include "../utils/position.hpp"
00030 
00031 class GenericBitmap;
00032 class OSGraphics;
00033 class OSTimer;
00034 
00035 
00036 /// Animated bitmap
00037 class AnimBitmap: public SkinObject, public Box,
00038                   public Subject<AnimBitmap>
00039 {
00040 public:
00041     AnimBitmap( intf_thread_t *pIntf, const GenericBitmap &rBitmap );
00042 
00043     virtual ~AnimBitmap();
00044 
00045     /// Start the animation
00046     void startAnim();
00047 
00048     /// Stop the animation
00049     void stopAnim();
00050 
00051     /// Draw the current frame on another graphics
00052     void draw( OSGraphics &rImage, int xDest, int yDest );
00053 
00054     /// Tell whether the pixel at the given position is visible
00055     bool hit( int x, int y ) const;
00056 
00057     /// Get the size of the current frame
00058     virtual int getWidth() const;
00059     virtual int getHeight() const;
00060 
00061 private:
00062     /// Bitmap stored
00063     const GenericBitmap &m_rBitmap;
00064     /// Graphics to store the bitmap
00065     OSGraphics *m_pImage;
00066     /// Number of frames
00067     int m_nbFrames;
00068     /// Frame rate
00069     int m_frameRate;
00070     /// Number of Loops
00071     int m_nbLoops;
00072     /// Curent frame
00073     int m_curFrame;
00074     /// Current loop
00075     int m_curLoop;
00076      /// Timer for the animation
00077     OSTimer *m_pTimer;
00078 
00079     /// Callback for the timer
00080     DEFINE_CALLBACK( AnimBitmap, NextFrame );
00081 };
00082 
00083 
00084 #endif
00085 

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6