Debian Codegraph @

src/effect/PixelIterator.h

raw
1 #ifndef HEADER_PIXELITERATOR_H
2 #define HEADER_PIXELITERATOR_H
3
4 class SurfaceLock;
5
6 #include "V2.h"
7 #include "NoCopy.h"
8
9 #include "SDL.h"
10
11 /**
12 * Iterator over surface pixels.
13 */
14 class PixelIterator : public NoCopy {
15 private:
16 SDL_Surface *m_surface;
17 SurfaceLock *m_lock;
18 Uint8 *m_p;
19 Uint8 *m_end;
20 Uint8 m_bpp;
21 public:
22 PixelIterator(SDL_Surface *surface);
23 virtual ~PixelIterator();
24 void setPos(const V2 &pos);
25 inline bool isValid() const { return m_p < m_end; }
26 inline void inc() { m_p += m_bpp; }
27
28 bool isTransparent() const;
29 SDL_Color getColor() const;
30 Uint32 getPixel() const;
31
32 void putColor(const SDL_Color &color);
33 void putPixel(Uint32 pixel);
34 };
35
36 #endif