core/vil1/vil1_flipud_impl.cxx

Go to the documentation of this file.
00001 // This is core/vil1/vil1_flipud_impl.cxx
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005 //:
00006 // \file
00007 // \author fsm
00008 
00009 #include "vil1_flipud_impl.h"
00010 #include <vcl_climits.h> // for CHAR_BIT
00011 
00012 vil1_image vil1_flipud_impl::get_plane(unsigned int p) const {
00013   return new vil1_flipud_impl(base.get_plane(p));
00014 }
00015 
00016 bool vil1_flipud_impl::get_section(void *buf, int x0, int y0, int w, int h) const {
00017   int bs = base.components() * base.bits_per_component() / CHAR_BIT;
00018   int last_row = base.height() - 1;
00019   for (int j=h-1; j>=0; --j)
00020     if (!base.get_section(static_cast<char*>(buf) + bs*w*j, x0, last_row - y0 - j, w, 1))
00021       return false;
00022   return true;
00023 }
00024 
00025 bool vil1_flipud_impl::put_section(void const *buf, int x0, int y0, int w, int h) {
00026   int bs = base.components() * base.bits_per_component() / CHAR_BIT;
00027   for (int j=0; j<h; ++j)
00028     if (!base.put_section(static_cast<char const*>(buf) + bs*w*(h-1-j), x0, y0+j, w, 1))
00029       return false;
00030   return true;
00031 }
00032 
00033 //: Return the name of the class;
00034 vcl_string vil1_flipud_impl::is_a() const
00035 {
00036   static const vcl_string class_name_="vil1_flipud_impl";
00037   return class_name_;
00038 }
00039 
00040 //: Return true if the name of the class matches the argument
00041 bool vil1_flipud_impl::is_class(vcl_string const& s) const
00042 {
00043   return s==vil1_flipud_impl::is_a() || vil1_image_impl::is_class(s);
00044 }

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