Definition at line 14 of file PixelIterator.h.
Public Member Functions | |
| PixelIterator (SDL_Surface *surface) | |
| Creates new pixel iterator and locks the surface. | |
| virtual | ~PixelIterator () |
| Unlocks surface. | |
| void | setPos (const V2 &pos) |
| bool | isValid () const |
| void | inc () |
| bool | isTransparent () const |
| SDL_Color | getColor () const |
| Uint32 | getPixel () const |
| void | putColor (const SDL_Color &color) |
| void | putPixel (Uint32 pixel) |
|
|
Creates new pixel iterator and locks the surface.
Definition at line 20 of file PixelIterator.cpp. 00021 {
00022 m_surface = surface;
00023 m_lock = new SurfaceLock(m_surface);
00024 m_p = static_cast<Uint8*>(surface->pixels);
00025 m_end = m_p + m_surface->h * m_surface->pitch;
00026 m_bpp = surface->format->BytesPerPixel;
00027 }
|
|
|
Unlocks surface.
Definition at line 32 of file PixelIterator.cpp. 00033 {
00034 delete m_lock;
00035 }
|
|
|
Definition at line 56 of file PixelIterator.cpp. 00057 {
00058 SDL_Color color;
00059 SDL_GetRGBA(getPixel(), m_surface->format,
00060 &color.r, &color.g, &color.b, &color.unused);
00061 return color;
00062 }
|
|
|
Definition at line 65 of file PixelIterator.cpp. 00066 {
00067 return PixelTool::unpackPixel(m_bpp, m_p);
00068 }
|
|
|
Definition at line 26 of file PixelIterator.h. 00026 { m_p += m_bpp; }
|
|
|
Definition at line 50 of file PixelIterator.cpp. 00051 {
00052 return getPixel() == m_surface->format->colorkey;
00053 }
|
|
|
Definition at line 25 of file PixelIterator.h. 00025 { return m_p < m_end; }
|
|
|
Definition at line 71 of file PixelIterator.cpp. 00072 {
00073 Uint32 pixel = SDL_MapRGBA(m_surface->format,
00074 color.r, color.g, color.b, color.unused);
00075 putPixel(pixel);
00076 }
|
|
|
Definition at line 79 of file PixelIterator.cpp. 00080 {
00081 PixelTool::packPixel(m_bpp, m_p, pixel);
00082 }
|
|
|
Definition at line 38 of file PixelIterator.cpp. 00039 {
00040 int x = pos.getX();
00041 int y = pos.getY();
00042 assert((0 <= x && x < m_surface->w) && (0 <= y && y < m_surface->h));
00043
00044 m_p = static_cast<Uint8*>(m_surface->pixels) +
00045 y * m_surface->pitch +
00046 x * m_bpp;
00047 }
|
1.4.2