64 inline const unsigned char*
75 for (std::size_t row_index = 0; row_index < height; ++row_index)
77 for (std::size_t col_index = 0; col_index < width; ++col_index)
82 subMap (col_index, row_index) = (*this) (col_index + x, row_index + y);
90 resize (std::size_t width, std::size_t height);
92 inline unsigned char &
93 operator() (
const std::size_t x,
const std::size_t y)
95 return (data_[y*width_+x]);
98 inline const unsigned char &
99 operator() (
const std::size_t x,
const std::size_t y)
const
101 return (data_[y*width_+x]);
110 const int width =
static_cast<int> (width_);
111 const int height =
static_cast<int> (height_);
113 stream.write (
reinterpret_cast<const char*
> (&width),
sizeof (width));
114 stream.write (
reinterpret_cast<const char*
> (&height),
sizeof (height));
116 const int num_of_elements =
static_cast<int> (data_.size ());
117 stream.write (
reinterpret_cast<const char*
> (&num_of_elements),
sizeof (num_of_elements));
118 for (
int element_index = 0; element_index < num_of_elements; ++element_index)
120 stream.write (
reinterpret_cast<const char*
> (&(data_[element_index])),
sizeof (data_[element_index]));
130 stream.read (
reinterpret_cast<char*
> (&width),
sizeof (width));
131 stream.read (
reinterpret_cast<char*
> (&height),
sizeof (height));
133 width_ =
static_cast<std::size_t
> (width);
134 height_ =
static_cast<std::size_t
> (height);
137 stream.read (
reinterpret_cast<char*
> (&num_of_elements),
sizeof (num_of_elements));
138 data_.resize (num_of_elements);
139 for (
int element_index = 0; element_index < num_of_elements; ++element_index)
141 stream.read (
reinterpret_cast<char*
> (&(data_[element_index])),
sizeof (data_[element_index]));