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

Renderer_agg.h

Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
00003 //   Foundation, Inc
00004 // 
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or
00008 // (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 
00019 
00020 #ifndef BACKEND_RENDER_HANDLER_AGG_H
00021 #define BACKEND_RENDER_HANDLER_AGG_H
00022 
00023 #include "dsodefs.h"
00024 
00025 namespace gnash {
00026 
00027 // Base class to shield GUIs from AGG's pixelformat classes 
00028 class Renderer_agg_base : public Renderer
00029 {
00030 private:
00031 
00032   unsigned char *_testBuffer; // buffer used by initTestBuffer() only
00033   
00034 public:
00035   
00036   Renderer_agg_base() : _testBuffer(0) { }  
00037 
00038   // virtual classes should have virtual destructors
00039   virtual ~Renderer_agg_base() {}
00040   
00041   // these methods need to be accessed from outside:
00042   virtual void init_buffer(unsigned char *mem, int size, int x, int y, int rowstride)=0;
00043 
00044   virtual unsigned int getBytesPerPixel() const=0;
00045 
00046   unsigned int getBitsPerPixel() const { return getBytesPerPixel()*8; }
00047   
00048   virtual bool initTestBuffer(unsigned width, unsigned height) {
00049     int size = width * height * getBytesPerPixel();
00050     
00051     _testBuffer = static_cast<unsigned char *>( realloc(_testBuffer, size) );
00052     
00053     init_buffer(_testBuffer, size, width, height, width * getBytesPerPixel());
00054     
00055     return true;
00056   }
00057   
00058   
00059 };
00060 
00061 
00063 //
00067 DSOEXPORT Renderer_agg_base*
00068   create_Renderer_agg(const char *pixelformat);
00069   
00074 DSOEXPORT const char* agg_detect_pixel_format(unsigned int rofs, unsigned int rsize,
00075   unsigned int gofs, unsigned int gsize,
00076   unsigned int bofs, unsigned int bsize,
00077   unsigned int bpp);
00078   
00079 
00080 } // namespace gnash
00081 
00082 
00083 #endif // BACKEND_RENDER_HANDLER_CAIRO_H

Generated on Thu Sep 30 2010 14:35:02 for Gnash by  doxygen 1.7.1