Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

EffectReverse.cpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  */
00009 #include "EffectReverse.h"
00010 
00011 #include "SurfaceLock.h"
00012 #include "PixelTool.h"
00013 
00014 //-----------------------------------------------------------------
00015 /**
00016  * Reverse left and right.
00017  */
00018 void
00019 EffectReverse::blit(SDL_Surface *screen, SDL_Surface *surface, int x, int y)
00020 {
00021     SurfaceLock lock1(screen);
00022     SurfaceLock lock2(surface);
00023 
00024     for (int py = 0; py < surface->h; ++py) {
00025         for (int px = 0; px < surface->w; ++px) {
00026             SDL_Color pixel = PixelTool::getColor(surface, px, py);
00027             if (pixel.unused == 255) {
00028                 PixelTool::putColor(screen,
00029                         x + surface->w - 1 - px, y + py, pixel);
00030             }
00031         }
00032     }
00033 }
00034 

Generated on Wed Jun 1 09:54:30 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2