00001
00002 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00003 #pragma implementation
00004 #endif
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "vil1_copy.h"
00018
00019 #include <vcl_cassert.h>
00020 #include <vil1/vil1_image.h>
00021 #include <vil1/vil1_memory_image.h>
00022
00023 void vil1_copy(vil1_image const& in, vil1_image& out)
00024 {
00025 #define assert_dimension_equal(dim) assert(in.dim() == out.dim())
00026 assert_dimension_equal(height);
00027 assert_dimension_equal(width);
00028 assert_dimension_equal(bits_per_component);
00029 assert_dimension_equal(planes);
00030 assert_dimension_equal(components);
00031 #undef assert_dimension_equal
00032
00033
00034 int height = in.height();
00035 int width = in.width();
00036
00037
00038
00039
00040 unsigned char* buf = new unsigned char[in.get_size_bytes()];
00041 #ifdef DEBUG
00042 vcl_cerr << "...vil1_copy() doing get_section()\n";
00043 #endif
00044 in.get_section(buf, 0, 0, width, height);
00045 #ifdef DEBUG
00046 vcl_cerr << "...vil1_copy() doing put_section()\n";
00047 #endif
00048 out.put_section(buf, 0, 0, width, height);
00049 #ifdef DEBUG
00050 vcl_cerr << "...vil1_copy() done\n";
00051 #endif
00052 delete[] buf;
00053 }
00054
00055 vil1_memory_image
00056 vil1_copy(vil1_image const& src)
00057 {
00058 vil1_memory_image dst( src.planes(), src.width(), src.height(), src.components(),
00059 src.bits_per_component(), src.component_format() );
00060 vil1_copy( src, dst );
00061 return dst;
00062 }