This file is indexed.

/usr/include/claw/impl/image.ipp is in libclaw-graphic-dev 1.7.3-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
/*
  CLAW - a C++ Library Absolutely Wonderful

  CLAW is a free library without any particular aim but being useful to 
  anyone.

  Copyright (C) 2005-2009 Julien Jorge

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

  contact: julien_jorge@yahoo.fr
*/
/**
 * \file image.ipp
 * \brief Inline methods for the claw::graphic::image class.
 * \author Julien Jorge
 */
#include <claw/assert.hpp>

/*----------------------------------------------------------------------------*/
/**
 * \brief Get a pixel from the line.
 * \param i The index of the pixel.
 */
claw::graphic::image::scanline::reference
inline claw::graphic::image::scanline::operator[](unsigned int i)
{
  return super::operator[](i);
} // image::scanline::operator[]()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get a pixel from the line.
 * \param i The index of the pixel.
 */
claw::graphic::image::scanline::const_reference
inline claw::graphic::image::scanline::operator[](unsigned int i) const
{
  return super::operator[](i);
} // image::scanline::operator[]()




/*----------------------------------------------------------------------------*/
/**
 * \brief Constructor.
 */
template<typename Image, typename Pixel>
inline claw::graphic::image::base_iterator<Image, Pixel>::base_iterator()
  : m_owner(NULL), m_pos(0, 0)
{
  CLAW_POSTCOND(is_final());
} // image::base_iterator::base_iterator()

/*----------------------------------------------------------------------------*/
/**
 * \brief Constructor, from an image.
 * \param owner The image we will iterate through.
 * \param x X-coordinate of the pointed pixel.
 * \param y Y-coordinate of the pointed pixel.
 */
template<typename Image, typename Pixel>
inline claw::graphic::image::base_iterator<Image, Pixel>::base_iterator
( image_type& owner, unsigned int x, unsigned int y )
  : m_owner(&owner), m_pos(x, y)
{

} // image::base_iterator::base_iterator()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if two iterator point to the same address.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator==
( const self_type& that ) const
{
  if ( is_final() && that.is_final() )
    return true;
  else if ( m_owner == that.m_owner )
    return m_pos == that.m_pos;
  else
    return false;
} // image::base_iterator::operator==()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if two iterator points to different addresses.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator!=
( const self_type& that ) const
{
  return !(*this == that);
} // image::base_iterator::operator!=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if the current iterator is before an other.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator<
  ( const self_type& that ) const
{
  if ( this->m_pos.y == that.m_pos.y)
    return this->m_pos.x < that.m_pos.x;
  else
    return this->m_pos.y < that.m_pos.y;
} // image::base_iterator::operator<()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if the current iterator is after an other.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator>
( const self_type& that ) const
{
  return that < *this;
} // image::base_iterator::operator>()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if the current iterator is before an other, or on the same
 *        address.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator<=
( const self_type& that ) const
{
  return !(*this > that);
} // image::base_iterator::operator<=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if the current iterator is after an other, or on the same
 *        address.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::operator>=
( const self_type& that ) const
{
  return !(*this < that);
} // image::base_iterator::operator>=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Move the iterator.
 * \param n Number of steps of the move.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type&
claw::graphic::image::base_iterator<Image, Pixel>::operator+=( int n )
{
  if (n < 0)
    return *this -= -n;
  else
    {
      CLAW_PRECOND( !is_final() );

      unsigned int n_y = n / m_owner->width();
      unsigned int n_x = n % m_owner->width();

      m_pos.x += n_x;
      m_pos.y += n_y;

      return *this;
    }
} // image::base_iterator::operator+=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Move the iterator.
 * \param n Number of steps of the move.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type&
claw::graphic::image::base_iterator<Image, Pixel>::operator-=( int n )
{
  if (n < 0)
    return *this += -n;
  else
    {
      CLAW_PRECOND( m_owner );

      unsigned int n_y = n / m_owner->width();
      unsigned int n_x = n % m_owner->width();

      CLAW_PRECOND( m_pos.x >= n_x );
      CLAW_PRECOND( m_pos.y >= n_y );

      m_pos.x -= n_x;
      m_pos.y -= n_y;

      return *this;
    }
} // image::base_iterator::operator-=()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get an iterator at a specific distance of the current iterator.
 * \param n The distance of the wanted iterator.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type
claw::graphic::image::base_iterator<Image, Pixel>::operator+( int n ) const
{
  self_type that(*this);

  return that += n;
} // image::base_iterator::operator+()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get an iterator at a specific distance of the current iterator.
 * \param n The distance of the wanted iterator.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type
claw::graphic::image::base_iterator<Image, Pixel>::operator-( int n ) const
{
  self_type that(*this);

  return that -= n;
} // image::base_iterator::operator-()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get an iterator at a specific distance of the current iterator.
 * \param n The distance of the wanted iterator.
 * \param self The reference iterator.
 */
template<typename ImageT, typename PixelT>
inline typename claw::graphic::image::base_iterator<ImageT, PixelT>::self_type
operator+
( int n,
  const typename 
  claw::graphic::image::base_iterator<ImageT, PixelT>::self_type& self )
{
  return self + n;
} // image::base_iterator::operator+()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get the distance between two iterators.
 * \param that The other operand.
 */
template<typename Image, typename Pixel>
inline
typename claw::graphic::image::base_iterator<Image, Pixel>::difference_type
claw::graphic::image::base_iterator<Image, Pixel>::operator-
( const self_type& that ) const
{
  CLAW_PRECOND( is_final() || that.is_final() || (m_owner == that.m_owner) );

  if ( that.is_final() )
    {
      if ( is_final() )
        return 0;
      else
        return -(m_owner->height() - m_pos.y) * m_owner->width() - m_pos.x;
    }
  else if ( is_final() )
    return (that.m_owner->height() - that.m_pos.y) * that.m_owner->width()
      + that.m_pos.x;
  else
    return m_pos.y * m_owner->width() + m_pos.x
      - that.m_pos.y * that.m_owner->width() + that.m_pos.x;
} // image::base_iterator::operator-()

/*----------------------------------------------------------------------------*/
/**
 * \brief Preincrement.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type&
claw::graphic::image::base_iterator<Image, Pixel>::operator++()
{
  CLAW_PRECOND( !is_final() );

  ++m_pos.x;

  if ( m_pos.x == m_owner->width() )
    {
      m_pos.x = 0;
      ++m_pos.y;
    }

  return *this;
} // image::base_iterator::operator++()

/*----------------------------------------------------------------------------*/
/**
 * \brief Postincrement.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type
claw::graphic::image::base_iterator<Image, Pixel>::operator++(int)
{
  self_type that(*this);
  ++(*this);
  return that;
} // image::base_iterator::operator++() [postincrement]

/*----------------------------------------------------------------------------*/
/**
 * \brief Predecrement.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type&
claw::graphic::image::base_iterator<Image, Pixel>::operator--()
{
  CLAW_PRECOND( !is_final() );
  CLAW_PRECOND( (m_pos.y > 0) || (m_pos.x > 0) );

  if ( m_pos.x == 0 )
    {
      m_pos.x = m_owner->width() - 1;
      --m_pos.y;
    }
  else
    --m_pos.x;

  return *this;
} // image::base_iterator::operator--()

/*----------------------------------------------------------------------------*/
/**
 * \brief Postdecrement.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::self_type
claw::graphic::image::base_iterator<Image, Pixel>::operator--(int)
{
  self_type that(*this);
  --(*this);
  return that;
} // image::base_iterator::operator--() [postdecrement]

/*----------------------------------------------------------------------------*/
/**
 * \brief Get a reference on the pointed pixel.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::reference
claw::graphic::image::base_iterator<Image, Pixel>::operator*() const
{
  CLAW_PRECOND( !is_final() );

  return (*m_owner)[m_pos.y][m_pos.x];
} // image::base_iterator::operator*()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get a pointer on the pointed pixel.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::pointer
claw::graphic::image::base_iterator<Image, Pixel>::operator->() const
{
  CLAW_PRECOND( !is_final() );

  return &(*m_owner)[m_pos.y][m_pos.x];
} // image::base_iterator::operator->()

/*----------------------------------------------------------------------------*/
/**
 * \brief Get a pixel, using the iterator like an array.
 * \param n Index of the cell from which we want the pixel.
 */
template<typename Image, typename Pixel>
inline typename claw::graphic::image::base_iterator<Image, Pixel>::reference
claw::graphic::image::base_iterator<Image, Pixel>::operator[]( int n ) const
{
  return *(*this + n);
} // image::base_iterator::operator[]()

/*----------------------------------------------------------------------------*/
/**
 * \brief Tell if the iterator is past the end of its owner.
 */
template<typename Image, typename Pixel>
inline bool
claw::graphic::image::base_iterator<Image, Pixel>::is_final() const
{
  if ( !m_owner )
    return true;
  else if ( m_pos.y >= m_owner->height() )
    return true;
  else if ( m_pos.y == m_owner->height() - 1 )
    return m_pos.x >= m_owner->width();
  else
    return false;
} // image::base_iterator::is_final()




/*----------------------------------------------------------------------------*/
/**
 * \brief Gets a line of the image.
 */
inline claw::graphic::image::scanline&
claw::graphic::image::operator[](unsigned int i)
{
  return m_data[i];
} // image::operator[]()

/*----------------------------------------------------------------------------*/
/**
 * \brief Gets a line of the image.
 */
inline const claw::graphic::image::scanline&
claw::graphic::image::operator[](unsigned int i) const
{
  return m_data[i];
} // image::operator[]() [const]