This file is indexed.

/usr/include/crystalspace-2.0/cstool/cspixmap.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
/*
    Crystal Space 3D engine: 2D pixmaps
    Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru>

    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_CSPIXMAP_H__
#define __CS_CSPIXMAP_H__

/**\file
 * 2D pixmaps
 */

#include "csextern.h"

#include "csutil/ref.h"
#include "ivideo/texture.h"

struct iGraphics3D;

/**
 * This class is an simple set of inline routines good as an abstraction
 * for simple 2D sprites. Pixmaps can be drawn with a transparent key color
 * as well as without transparent color: all this depends on texture handle.
 * Note that this class is only used as the interface to several
 * implementations of pixmaps, for example csSimplePixmap.
 */
class CS_CRYSTALSPACE_EXPORT csPixmap
{
public:
  /// Destructor
  virtual ~csPixmap() {}

  /// return current width of this pixmap
  virtual int Width() = 0;
  /// return current height of this pixmap
  virtual int Height() = 0;
  /// advance in time
  virtual void Advance(csTicks ElapsedTime) = 0;
  /// return current texture handle
  virtual iTextureHandle *GetTextureHandle() = 0;

  /// Draw the pixmap given the screen position and new size
  virtual void DrawScaled (iGraphics3D* g3d, int sx, int sy, int sw, int sh,
    uint8 Alpha = 0) = 0;
  /// Draw the pixmap given the screen position and new size (aligned)
  inline void DrawScaledAlign (iGraphics3D* g3d, int sx, int sy, int sw,
      int sh, int alnx, int alny, uint8 Alpha = 0)
    { DrawScaled (g3d, sx - alnx * sw / 2, sy - alny * sh / 2, sw, sh, Alpha); }
  /// Draw the pixmap without rescale
  inline void Draw (iGraphics3D* g3d, int sx, int sy, uint8 Alpha = 0)
    { DrawScaled (g3d, sx, sy, Width(), Height(), Alpha); }
  /// Draw the pixmap without rescale (aligned)
  inline void DrawAlign (iGraphics3D* g3d, int sx, int sy, int alnx, int alny,
      uint8 Alpha = 0)
    { DrawScaledAlign (g3d, sx, sy, Width(), Height(), alnx, alny, Alpha); }

  /**
   * Draw the pixmap tiled over an area. multiple draw commands with the
   * same texture and same origin values will align properly.
   * The orgx and orgy point to a pixel (perhaps offscreen) where the
   * (0,0) pixel of this pixmap would be drawn.
   */
  virtual void DrawTiled (iGraphics3D* g3d, int sx, int sy, int sw, int sh,
    int orgx, int orgy, uint8 Alpha = 0) = 0;
  /// Fill a rectangle with the pixmap, tiled.
  inline void DrawTiled (iGraphics3D* g3d, int sx, int sy, int w, int h,
      uint8 Alpha = 0)
  { DrawTiled (g3d, sx, sy, w, h, sx, sy, Alpha); }
};

/// This is the simple implementation of csPixmap that uses a single texture
class CS_CRYSTALSPACE_EXPORT csSimplePixmap : public csPixmap
{
protected:
  csRef<iTextureHandle> hTex;
  int tx, ty, tw, th;

public:
  /// Initialize the pixmap from a texture.
  csSimplePixmap (iTextureHandle *hTexture);
  /// Initialize the pixmap from a texture with given rectangle
  csSimplePixmap (iTextureHandle *hTexture, int x, int y, int w, int h);
  /// Deinitialize the pixmap
  virtual ~csSimplePixmap ();

  /// Change pixmap texture handle
  void SetTextureHandle (iTextureHandle *hTexture);
  /// Set new location of pixmap image on texture
  inline void SetTextureRectangle (int x, int y, int w, int h)
  { tx = x; ty = y; tw = w; th = h; }

  // implementation of csPixmap methods
  virtual void DrawScaled (iGraphics3D* g3d, int sx, int sy, int sw, int sh,
    uint8 Alpha = 0);
  virtual void DrawTiled (iGraphics3D* g3d, int sx, int sy, int sw, int sh,
    int orgx, int orgy, uint8 Alpha = 0);
  virtual int Width ();
  virtual int Height ();
  virtual void Advance(csTicks /*ElapsedTime*/) {}
  virtual iTextureHandle *GetTextureHandle ();
};

#endif // __CS_CSPIXMAP_H__