RAWK
Gigapixel Raw Image Processing Toolkit
 All Classes Functions Variables Pages
image_append.hpp
1 // RAWK Copyright (C) 2014 Robert Kooima
2 //
3 // This program is free software: you can redistribute it and/or modify it
4 // under the terms of the GNU General Public License as published by the Free
5 // Software Foundation, either version 3 of the License, or (at your option)
6 // any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but WITH-
9 // OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 // more details.
12 
13 #ifndef IMAGE_APPEND_HPP
14 #define IMAGE_APPEND_HPP
15 
16 //------------------------------------------------------------------------------
17 
19 
20 class append : public image
21 {
22 public:
28 
29  append(image *L, image *R) : image(L, R) { }
30 
31  virtual double get(int i, int j, int k) const
32  {
33  const int d = L->get_depth();
34 
35  if (k < d)
36  return L->get(i, j, k);
37  else
38  return R->get(i, j, k - d);
39  }
40 
41  virtual int get_depth() const
42  {
43  return L->get_depth() + R->get_depth();
44  }
45 
46  virtual void doc(std::ostream& out) const
47  {
48  out << "append";
49  }
50 };
51 
52 //------------------------------------------------------------------------------
53 
54 #endif
virtual double get(int i, int j, int k) const =0
Return the value of the sample at row i, column j, channel k.
image * L
Left child.
Definition: image.hpp:117
virtual int get_depth() const
Return the depth of this image.
Definition: image_append.hpp:41
Base class for all image sources, filters, and operators.
Definition: image.hpp:20
virtual void doc(std::ostream &out) const
Produce a string documenting the function of this object.
Definition: image_append.hpp:46
append(image *L, image *R)
Append the channels of image R to those of image L. This can be used to assemble a multichannel image...
Definition: image_append.hpp:29
virtual int get_depth() const
Return the depth of this image.
Definition: image.hpp:66
Channel append.
Definition: image_append.hpp:20
image * R
Right child.
Definition: image.hpp:118