This file is indexed.

/usr/include/crystalspace-2.0/csgfx/gradient.h is in libcrystalspace-dev 2.0+dfsg-1build1.

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
/*
    Copyright (C) 2003 by Jorrit Tyberghein
              (C) 2003 by Frank Richter
              (C) 2006 by Christopher Nelson

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free
    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __CS_CSGFX_GRADIENT_H__
#define __CS_CSGFX_GRADIENT_H__

/**\file
 * Simple color gradient implementation
 */

#include "csextern.h"

#include "ivaria/gradient.h"

#include "csutil/array.h"
#include "csutil/cscolor.h"
#include "csutil/scf_implementation.h"
#include "csutil/scfarray.h"
#include "csgfx/rgbpixel.h"

/**
 * A simple color gradient.
 * If you ever have worked with an image creation/manipulation program with
 * a slightly higher niveau than Windows Paint then you probably know what 
 * this is.
 *
 * Colors(here called 'shades') can be placed at arbitrary positions; although 
 * commonly a range of [0;1] is used, negative positions and positions larger 
 * than 1 are supported.
 *
 * Shades contain actually two colors, a 'left' and 'right' one. You can think
 * of this as, when approaching from one side, you'll get closer and closer to
 * the respective color. If you step over a shade, you have the other color, 
 * but you're getting farther and farther from it (and towards the next color) 
 * when moving on. This feature can be used for sharp transitions; for smooth 
 * ones they are simply set to the same value.
 *
 * For some examples see the iGradient documentation.
 */
class CS_CRYSTALSPACE_EXPORT csGradient :
  public scfImplementation1<csGradient, iGradient>
{
protected:
  /// The entries in this gradient.
  csArray<csGradientShade> shades;
  struct scfGradientShadesArray : public scfArrayWrapConst<iGradientShades,
    csArray<csGradientShade> >
  {
    scfGradientShadesArray (csGradient* parent) : 
      scfArrayWrapConst<iGradientShades, csArray<csGradientShade> > (
      	parent->shades, parent) {}
  };
public:
  /// Construct an empty gradient.
  csGradient ();
  /// Construct with \p first at position 0 and \p last at 1.
  csGradient (csColor4 first, csColor4 last);
  
  /// Add a shade
  //@{
  /// Add a shade
  void AddShade (const csGradientShade& shade);
  void AddShade (const csColor4& color, float position);
  void AddShade (const csColor4& left, const csColor4& right, 
    float position);
  //@}
  
  /// Clear all shades
  void Clear ();
  
  /**
   * Interpolate the colors over a part of the gradient.
   * \param pal Array of csRGBcolor the gradient should be rendered to.
   * \param count Number of \p palette entries to render.
   * \param begin Start position. Can be anywhere in the gradient.
   * \param end End position. Can be anywhere in the gradient.
   *
   * \remark At least 1 shade has to be present in the gradient to
   *  have this function succeed.
   * \remark Makes heavy use of floating point calculations, so you
   *  might want to use this function in a precalc phase.
   * \remark \p begin doesn't have to be smaller than \p end.
   * \remark \p begin and \p end can both lie completely 'outside'
   *  the gradient (i.e. both smaller/large than the first resp. last
   *  shade's position.)
   */
  bool Render (csRGBcolor* pal, size_t count, float begin = 0.0f, 
    float end = 1.0f) const;
  
  /**
   * Interpolate the colors over a part of the gradient.
   * \param pal Array of csRGBpixel the gradient should be rendered to.
   * \param count Number of \p palette entries to render.
   * \param begin Start position. Can be anywhere in the gradient.
   * \param end End position. Can be anywhere in the gradient.
   *
   * \remark At least 1 shade has to be present in the gradient to
   *  have this function succeed.
   * \remark Makes heavy use of floating point calculations, so you
   *  might want to use this function in a precalc phase.
   * \remark \p begin doesn't have to be smaller than \p end.
   * \remark \p begin and \p end can both lie completely 'outside'
   *  the gradient (i.e. both smaller/large than the first resp. last
   *  shade's position.)
   */  
  bool Render (csRGBpixel* pal, size_t count, float begin = 0.0f, 
    float end = 1.0f) const;

  /// Get the array of shades
  csPtr<iGradientShades> GetShades ();
};


#endif // __CS_CSGFX_GRADIENT_H__