• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List
  • File Members

GnashImageGif.h

Go to the documentation of this file.
00001 // GnashImageGif.h: gif_lib wrapper for Gnash.
00002 // 
00003 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00004 //   Foundation, Inc
00005 // 
00006 // This program is free software; you can redistribute it and/or modify
00007 // it under the terms of the GNU General Public License as published by
00008 // the Free Software Foundation; either version 3 of the License, or
00009 // (at your option) any later version.
00010 // 
00011 // This program is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 // GNU General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU General Public License
00017 // along with this program; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 
00021 #ifndef GNASH_IMAGE_GIF_H
00022 #define GNASH_IMAGE_GIF_H
00023 
00024 #include <memory>
00025 
00026 #include "dsodefs.h"
00027 #include "GnashImage.h"
00028 #include <boost/scoped_array.hpp>
00029 #include <boost/shared_ptr.hpp>
00030 
00031 extern "C" {
00032 #include <gif_lib.h>
00033 }
00034 
00035 // Forward declarations
00036 namespace gnash { class IOChannel; }
00037 
00038 namespace gnash {
00039 
00040 class GifImageInput : public ImageInput
00041 {
00042 
00043 public:
00044 
00046     //
00050     GifImageInput(boost::shared_ptr<IOChannel> in);
00051     
00052     ~GifImageInput();
00053 
00055     void read();
00056 
00058     //
00060     size_t getHeight() const;
00061 
00063     //
00065     size_t getWidth() const;
00066 
00068     //
00070     size_t getComponents() const { return 3; }
00071 
00073     //
00077     void readScanline(unsigned char* rgb_data);
00078 
00079 
00081     //
00083     DSOEXPORT static std::auto_ptr<ImageInput> create(
00084             boost::shared_ptr<IOChannel> in)
00085     {
00086         std::auto_ptr<ImageInput> ret ( new GifImageInput(in) );
00087         if ( ret.get() ) ret->read();
00088         return ret;
00089     }
00090 
00091 private:
00092     
00094     void init();
00095 
00096     // State needed for input.
00097     GifFileType* _gif;
00098     
00099     // A counter for keeping track of the last row copied.
00100     size_t _currentRow;
00101     
00102     typedef boost::scoped_array<GifPixelType> PixelRow;
00103 
00104     // A 2-dimensional scoped array holding the unpacked pixel data.
00105     boost::scoped_array<PixelRow> _gifData;
00106 
00107 
00108 
00109 };
00110 
00111 } // namespace gnash
00112 
00113 
00114 #endif

Generated on Fri Mar 16 2012 15:46:10 for Gnash by  doxygen 1.7.1