Go to the documentation of this file.00001
00002 #ifndef vil_flip_h_
00003 #define vil_flip_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011 #include <vil/vil_image_resource.h>
00012 #include <vil/vil_image_view.h>
00013
00014
00015
00016
00017
00018
00019 template<class T>
00020 inline vil_image_view<T> vil_flip_lr(const vil_image_view<T>& v)
00021 {
00022 return vil_image_view<T>(v.memory_chunk(),
00023 v.top_left_ptr()+(v.ni()-1)*v.istep(),
00024 v.ni(),v.nj(),v.nplanes(),
00025 -v.istep(),v.jstep(),v.planestep());
00026 }
00027
00028
00029
00030
00031
00032 template<class T>
00033 inline vil_image_view<T> vil_flip_ud(const vil_image_view<T>& v)
00034 {
00035 return vil_image_view<T>(v.memory_chunk(),
00036 v.top_left_ptr()+(v.nj()-1)*v.jstep(),
00037 v.ni(),v.nj(),v.nplanes(),
00038 v.istep(),-v.jstep(),v.planestep());
00039 }
00040
00041
00042
00043
00044 vil_image_resource_sptr vil_flip_lr(const vil_image_resource_sptr &src);
00045
00046
00047
00048 class vil_flip_lr_image_resource : public vil_image_resource
00049 {
00050 vil_flip_lr_image_resource(vil_image_resource_sptr const&);
00051 friend vil_image_resource_sptr vil_flip_lr(const vil_image_resource_sptr &src);
00052 public:
00053
00054 virtual unsigned nplanes() const { return src_->nplanes(); }
00055 virtual unsigned ni() const { return src_->ni(); }
00056 virtual unsigned nj() const { return src_->nj(); }
00057
00058 virtual enum vil_pixel_format pixel_format() const { return src_->pixel_format(); }
00059
00060
00061 virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00062 unsigned j0, unsigned nj) const;
00063
00064 virtual vil_image_view_base_sptr get_view(unsigned i0, unsigned ni,
00065 unsigned j0, unsigned nj) const;
00066
00067
00068
00069 virtual bool put_view(const vil_image_view_base& im, unsigned i0,
00070 unsigned j0);
00071
00072
00073 virtual bool get_property(char const* tag, void* property_value = 0) const {
00074 return src_->get_property(tag, property_value); }
00075
00076
00077 protected:
00078
00079 vil_image_resource_sptr src_;
00080 };
00081
00082
00083
00084
00085 vil_image_resource_sptr vil_flip_ud(const vil_image_resource_sptr &src);
00086
00087
00088
00089 class vil_flip_ud_image_resource : public vil_image_resource
00090 {
00091 vil_flip_ud_image_resource(vil_image_resource_sptr const&);
00092 friend vil_image_resource_sptr vil_flip_ud(const vil_image_resource_sptr &src);
00093 public:
00094
00095 virtual unsigned nplanes() const { return src_->nplanes(); }
00096 virtual unsigned ni() const { return src_->ni(); }
00097 virtual unsigned nj() const { return src_->nj(); }
00098
00099 virtual enum vil_pixel_format pixel_format() const { return src_->pixel_format(); }
00100
00101
00102 virtual vil_image_view_base_sptr get_copy_view(unsigned i0, unsigned ni,
00103 unsigned j0, unsigned nj) const;
00104
00105 virtual vil_image_view_base_sptr get_view(unsigned i0, unsigned ni,
00106 unsigned j0, unsigned nj) const;
00107
00108
00109
00110 virtual bool put_view(const vil_image_view_base& im, unsigned i0,
00111 unsigned j0);
00112
00113
00114 virtual bool get_property(char const* tag, void* property_value = 0) const {
00115 return src_->get_property(tag, property_value); }
00116
00117 protected:
00118
00119 vil_image_resource_sptr src_;
00120 };
00121
00122 #endif // vil_flip_h_