core/vil1/vil1_memory_image_impl.h

Go to the documentation of this file.
00001 // This is core/vil1/vil1_memory_image_impl.h
00002 #ifndef vil1_memory_image_impl_h_
00003 #define vil1_memory_image_impl_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \author awf@robots.ox.ac.uk
00010 // \date 16 Mar 00
00011 //
00012 //\verbatim
00013 // Modifications
00014 //     010126 BJM (mccane@cs.otago.ac.nz) added constructor from previously
00015 //            allocated memory. This memory is not deallocated on destruction.
00016 // 7 June 2001 - Peter Vanroose - added support for packed 1-bit pixel type
00017 //\endverbatim
00018 
00019 #include <vil1/vil1_image_impl.h>
00020 #include <vil1/vil1_memory_image.h>
00021 #include <vcl_string.h>
00022 
00023 //: Implementation class for vil1_memory_image.
00024 class vil1_memory_image_impl : public vil1_image_impl
00025 {
00026  public:
00027   vil1_memory_image_impl(int planes, int w, int h,
00028                          vil1_memory_image_format const& format);
00029   vil1_memory_image_impl(int planes, int w, int h, int components, int bits_per_component,
00030                          vil1_component_format component_format);
00031   vil1_memory_image_impl(int planes, int w, int h,
00032                          vil1_pixel_format_t pixel_format);
00033   vil1_memory_image_impl(int w, int h, int components, int bits_per_component,
00034                          vil1_component_format component_format);
00035   vil1_memory_image_impl(int w, int h,
00036                          vil1_pixel_format_t pixel_format);
00037   vil1_memory_image_impl(vil1_memory_image_impl const&);
00038 
00039   ~vil1_memory_image_impl();
00040 
00041   virtual int planes() const { return planes_; }
00042   virtual int width() const { return width_; }
00043   virtual int height() const { return height_; }
00044   virtual int components() const { return components_; }
00045   virtual int bits_per_component() const { return bits_per_component_; }
00046   virtual vil1_component_format component_format() const { return component_format_; }
00047   virtual vil1_image get_plane(unsigned int p) const;
00048 
00049   virtual bool get_section(void* buf, int x0, int y0, int width, int height) const;
00050   virtual bool put_section(void const* buf, int x0, int y0, int width, int height);
00051 
00052   virtual bool get_property(char const *tag, void *property_value = 0) const;
00053 
00054   void resize(int planes, int width, int height);
00055   void resize(int planes, int width, int height, int components, int bits_per_component,
00056               vil1_component_format format);
00057 
00058   //: Return the name of the class;
00059   virtual vcl_string is_a() const;
00060 
00061   //: Return true if the name of the class matches the argument
00062   virtual bool is_class(vcl_string const&) const;
00063 
00064   //: Constructor from previously allocated memory.
00065   // This memory is not deallocated on destruction.
00066   vil1_memory_image_impl(void *buf, int planes, int w, int h,
00067                          vil1_memory_image_format const& format);
00068   //: Constructor from previously allocated memory.
00069   // This memory is not deallocated on destruction.
00070   vil1_memory_image_impl(void *buf, int planes, int w, int h, int components, int bits_per_component,
00071                          vil1_component_format component_format);
00072   //: Constructor from previously allocated memory.
00073   // This memory is not deallocated on destruction.
00074   vil1_memory_image_impl(void *buf, int planes, int w, int h,
00075                          vil1_pixel_format_t pixel_format);
00076   //: Constructor from previously allocated memory.
00077   // This memory is not deallocated on destruction.
00078   vil1_memory_image_impl(void *buf, int w, int h, int components, int bits_per_component,
00079                          vil1_component_format component_format);
00080   //: Constructor from previously allocated memory.
00081   // This memory is not deallocated on destruction.
00082   vil1_memory_image_impl(void *buf, int w, int h,
00083                          vil1_pixel_format_t pixel_format);
00084 
00085  protected:
00086   friend class vil1_memory_image;
00087 
00088   void init(void *buf, int planes, int w, int h,
00089             vil1_pixel_format_t pixel_format);
00090   void init(void *buf, int planes, int w, int h, int components,
00091             int bits_per_component, vil1_component_format);
00092 
00093   int planes_;
00094   int width_;
00095   int height_;
00096   int components_;
00097   int bits_per_component_;
00098   vil1_component_format component_format_;
00099 
00100   int bytes_per_pixel_;
00101   bool is_foreign_buf_; // is the buffer created externally?
00102 
00103   unsigned char* buf_;
00104   void*** rows_;
00105 };
00106 
00107 #endif // vil1_memory_image_impl_h_

Generated on Mon Nov 23 05:09:19 2009 for core/vil1 by  doxygen 1.5.1