core/vil1/vil1_memory_image.h

Go to the documentation of this file.
00001 // This is core/vil1/vil1_memory_image.h
00002 #ifndef vil1_memory_image_h_
00003 #define vil1_memory_image_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief vil1_image, stored entirely in RAM
00010 // \author awf@robots.ox.ac.uk
00011 // \date 16 Feb 00
00012 //
00013 //\verbatim
00014 //  Modifications
00015 //     010126 BJM (mccane@cs.otago.ac.nz) added constructor from
00016 //            previously allocated memory. This memory is not deallocated on
00017 //            destruction.
00018 //\endverbatim
00019 
00020 #include <vil1/vil1_pixel.h>
00021 #include <vil1/vil1_image.h>
00022 
00023 //: Description of image format in memory
00024 struct vil1_memory_image_format
00025 {
00026   int components;
00027   int bits_per_component;
00028   vil1_component_format component_format;
00029 };
00030 
00031 //: vil1_image, stored entirely in memory
00032 class vil1_memory_image : public vil1_image
00033 {
00034  public:
00035   vil1_memory_image();
00036   vil1_memory_image(int planes, int w, int h, vil1_memory_image_format const&);
00037   vil1_memory_image(int planes, int w, int h, int components, int bits_per_component, vil1_component_format);
00038   vil1_memory_image(int planes, int w, int h, vil1_pixel_format_t);
00039   vil1_memory_image(int w, int h, int components, int bits_per_component, vil1_component_format);
00040   vil1_memory_image(int w, int h, vil1_pixel_format_t );
00041   // this constructor *should* be 'explicit'
00042   vil1_memory_image(vil1_image const &);
00043   vil1_memory_image(vil1_memory_image const&);
00044 
00045   vil1_memory_image& operator=(vil1_memory_image const&);
00046 
00047   void resize(int width, int height);
00048   void resize(int planes, int width, int height);
00049   inline void* get_buffer() { return rows0_[0]; }
00050 
00051   vil1_memory_image(void *buf, int planes, int w, int h, vil1_memory_image_format const&);
00052   vil1_memory_image(void *buf, int planes, int w, int h, int components, int bits_per_component, vil1_component_format);
00053   vil1_memory_image(void *buf, int planes, int w, int h, vil1_pixel_format_t);
00054   vil1_memory_image(void *buf, int w, int h, int components, int bits_per_component, vil1_component_format);
00055   vil1_memory_image(void *buf, int w, int h, vil1_pixel_format_t );
00056 
00057   // these duplicate the signatures in the base class, but are inlined, so
00058   // much faster. the base class methods incur a virtual function call.
00059   int width () const { return width_ ; }
00060   int height() const { return height_; }
00061 
00062   void assert_size(int width, int height) const;
00063 
00064   //: Reset this class's member variables from the image implementation
00065   // This is is useful if the impl object has been modified outside the control of this object.
00066   void recache_from_impl();
00067  protected:
00068   // The following informations are cached from the vil1_memory_image_impl :
00069   int width_;
00070   int height_;
00071   void ** rows0_;
00072 };
00073 
00074 #endif // vil1_memory_image_h_

Generated on Sat Nov 22 05:08:29 2008 for core/vil1 by  doxygen 1.5.1