

Definition at line 9 of file EffectMirror.h.
Public Member Functions | |
| virtual void | blit (SDL_Surface *screen, SDL_Surface *surface, int x, int y) |
| Mirror effect. | |
|
||||||||||||||||||||
|
Mirror effect. Draw left side inside. The pixel in the middle will be used as a mask. NOTE: mirror object should be draw as the last. Implements ViewEffect. Definition at line 21 of file EffectMirror.cpp. 00022 {
00023 SurfaceLock lock1(screen);
00024 SurfaceLock lock2(surface);
00025
00026 SDL_Color mask = PixelTool::getColor(surface,
00027 surface->w / 2, surface->h / 2);
00028
00029 for (int py = 0; py < surface->h; ++py) {
00030 for (int px = 0; px < surface->w; ++px) {
00031 SDL_Color pixel = PixelTool::getColor(surface, px, py);
00032 if (px > MIRROR_BORDER && PixelTool::colorEquals(pixel, mask)) {
00033 SDL_Color sample = PixelTool::getColor(screen,
00034 x - px + MIRROR_BORDER, y + py);
00035 PixelTool::putColor(screen, x + px, y + py, sample);
00036 }
00037 else {
00038 if (pixel.unused == 255) {
00039 PixelTool::putColor(screen, x + px, y + py, pixel);
00040 }
00041 }
00042 }
00043 }
00044 }
|
1.4.2