1 // This is core/vil/vil_image_resource.cxx
2 //:
3 // \file
4 // \author Ian Scott  ISBE Manchester
5 // \date   20 Sep 2002
6 //
7 //-----------------------------------------------------------------------------
8 
9 #include "vil_image_resource.h"
10 #include "vil/vil_image_view_base.h"
11 
12 //--------------------------------------------------------------------------------
13 
14 //: the reference count starts at 0.
vil_image_resource()15 vil_image_resource::vil_image_resource()
16   : reference_count_(0)
17 {}
18 
19 vil_image_resource::~vil_image_resource() = default;
20 
21 
22 bool
get_property(char const *,void *) const23 vil_image_resource::get_property(char const *, void *) const
24 {
25   return false;
26 }
27 
28 
29 //: Check that a view will fit into the data at the given offset.
30 // This includes checking that the pixel type is scalar.
31 bool
view_fits(const vil_image_view_base & im,unsigned i0,unsigned j0)32 vil_image_resource::view_fits(const vil_image_view_base & im, unsigned i0, unsigned j0)
33 {
34   return i0 + im.ni() <= ni() && j0 + im.nj() <= nj() && im.nplanes() == nplanes() &&
35          vil_pixel_format_num_components(im.pixel_format()) == 1;
36 }
37