Go to the documentation of this file.00001 
00002 #ifndef vil_image_resource_plugin_h_
00003 #define vil_image_resource_plugin_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 #include <vcl_string.h>
00016 #include <vil/vil_image_view_base.h>
00017 #include <vil/vil_image_resource.h>
00018 
00019 
00020 
00021 
00022 
00023 
00024 class vil_image_resource_plugin : public vil_image_resource
00025 {
00026  public:
00027 
00028   
00029   vil_image_resource_plugin() : filetype_(""), colour_(""), width_(-1), height_(-1) {}
00030 
00031   
00032   virtual ~vil_image_resource_plugin() {}
00033 
00034   
00035   virtual vcl_string is_a() const { return "vil_image_resource_plugin"; }
00036 
00037   virtual vil_pixel_format pixel_format() const { return VIL_PIXEL_FORMAT_UNKNOWN; }
00038 
00039   virtual unsigned ni() const { return 0; }
00040   virtual unsigned nj() const { return 0; }
00041   virtual unsigned nplanes() const { return 0; }
00042 
00043   virtual bool get_property(char const * , void * =0) const { return false; }
00044   virtual vil_image_view_base_sptr get_copy_view(unsigned , unsigned , unsigned , unsigned ) const
00045   { return vil_image_view_base_sptr(0); }
00046 
00047   virtual bool put_view(vil_image_view_base const& , unsigned , unsigned ) { return false; }
00048 
00049   
00050   
00051   virtual bool load_the_image(vil_image_view_base_sptr& image, const vcl_string & path)
00052   { return load_the_image(image,path,filetype_,colour_); }
00053 
00054   
00055   
00056   
00057   
00058   
00059   virtual bool load_the_image(vil_image_view_base_sptr& image,
00060                               const vcl_string & path,
00061                               const vcl_string & filetype,
00062                               const vcl_string & colour);
00063 
00064   
00065   static void register_plugin(vil_image_resource_plugin* plugin);
00066 
00067   
00068   static void delete_all_plugins();
00069 
00070   
00071   virtual void set_size(int width, int height) { width_=width; height_=height; }
00072 
00073   
00074   virtual bool can_be_loaded(const vcl_string& filename);
00075 
00076   
00077   void set_colour(const vcl_string& colour) { colour_=colour; }
00078 
00079   
00080   void set_filetype(const vcl_string& filetype) { filetype_=filetype; }
00081 
00082  protected:
00083 
00084   
00085   vcl_string filetype_;
00086 
00087   
00088   vcl_string colour_;
00089 
00090   vil_pixel_format pixel_format_;
00091   unsigned int ni_;
00092   unsigned int nj_;
00093   unsigned int nplanes_;
00094   int width_;
00095   int height_;
00096 };
00097 
00098 #endif // vil_image_resource_plugin_h_