Go to the documentation of this file.00001 
00002 #ifndef vil_memory_image_h_
00003 #define vil_memory_image_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 #include <vil/vil_image_resource.h>
00016 #include <vil/vil_image_view_base.h>
00017 #include <vil/vil_property.h>
00018 #include <vcl_cstring.h>
00019 
00020 
00021 
00022 class vil_memory_image : public vil_image_resource
00023 {
00024   
00025   vil_image_view_base* view_;
00026 
00027   
00028   vil_memory_image();
00029 
00030   
00031   
00032   
00033   
00034   vil_memory_image(unsigned ni,
00035                    unsigned nj,
00036                    unsigned nplanes,
00037                    vil_pixel_format format,
00038                    unsigned n_interleaved_planes = 1);
00039 
00040   
00041   vil_memory_image(vil_image_view_base const &);
00042 
00043 
00044   friend vil_image_resource_sptr vil_new_image_resource(
00045     unsigned ni, unsigned nj, unsigned nplanes,
00046     vil_pixel_format format);
00047 
00048   friend vil_image_resource_sptr vil_new_image_resource_interleaved(
00049     unsigned ni, unsigned nj, unsigned nplanes,
00050     vil_pixel_format format);
00051 
00052   friend vil_image_resource_sptr vil_new_image_resource_of_view(
00053     vil_image_view_base const & view);
00054 
00055  public:
00056 
00057   ~vil_memory_image() {delete view_;}
00058 
00059   
00060   virtual unsigned nplanes() const { return view_->nplanes(); }
00061   virtual unsigned ni() const { return view_->ni(); }
00062   virtual unsigned nj() const { return view_->nj(); }
00063 
00064   virtual enum vil_pixel_format pixel_format() const { return view_->pixel_format(); }
00065 
00066   
00067   
00068   virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00069                                                  unsigned j0, unsigned nj) const;
00070 
00071   
00072   
00073   virtual vil_image_view_base_sptr get_view(unsigned i0, unsigned ni,
00074                                             unsigned j0, unsigned nj) const;
00075 
00076   
00077   virtual bool put_view(const vil_image_view_base& im, unsigned i0, unsigned j0);
00078 
00079   
00080   bool get_property(char const * tag, void * prop = 0) const
00081   {
00082     if (0==vcl_strcmp(tag, vil_property_memory))
00083       return prop ? (*static_cast<bool*>(prop)) = true : true;
00084 
00085     return false;
00086   }
00087 };
00088 
00089 #endif // vil_memory_image_h_