• 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 namespace image {
00040 
00041 class GifInput : public Input
00042 {
00043 
00044 public:
00045 
00047     //
00051     GifInput(boost::shared_ptr<IOChannel> in);
00052     
00053     ~GifInput();
00054 
00056     void read();
00057 
00059     //
00061     size_t getHeight() const;
00062 
00064     //
00066     size_t getWidth() const;
00067 
00069     //
00071     size_t getComponents() const { return 3; }
00072 
00074     //
00078     void readScanline(unsigned char* rgb_data);
00079 
00080 
00082     //
00084     DSOEXPORT static std::auto_ptr<Input> create(
00085             boost::shared_ptr<IOChannel> in)
00086     {
00087         std::auto_ptr<Input> ret ( new GifInput(in) );
00088         if ( ret.get() ) ret->read();
00089         return ret;
00090     }
00091 
00092 private:
00093     
00095     void init();
00096 
00097     // State needed for input.
00098     GifFileType* _gif;
00099     
00100     // A counter for keeping track of the last row copied.
00101     size_t _currentRow;
00102     
00103     typedef boost::scoped_array<GifPixelType> PixelRow;
00104 
00105     // A 2-dimensional scoped array holding the unpacked pixel data.
00106     boost::scoped_array<PixelRow> _gifData;
00107 
00108 
00109 
00110 };
00111 
00112 } // namespace image
00113 } // namespace gnash
00114 
00115 
00116 #endif

Generated on Thu Sep 2 2010 for Gnash by  doxygen 1.7.1