1 // $Id: sdl_texture.hpp 4063 2006-07-21 21:05:23Z anmaster $
4 // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __SDL_TEXTURE_HPP__
21 #define __SDL_TEXTURE_HPP__
27 #include "texture.hpp"
33 class Texture : public ::Texture
42 static void ref(SDL_Surface *surface)
50 SDL_Surface *data[NUM_EFFECTS];
54 memset(data, 0, NUM_EFFECTS * sizeof(SDL_Surface *));
59 std::for_each(data, data + NUM_EFFECTS, SDL_FreeSurface);
62 void operator = (const Cache &other)
64 std::for_each(other.data, other.data + NUM_EFFECTS, ref);
65 std::for_each(data, data + NUM_EFFECTS, SDL_FreeSurface);
66 memcpy(data, other.data, sizeof(Cache));
69 SDL_Surface *&operator [] (DrawingEffect effect)
74 mutable std::map<Color, Cache> cache; /**< Cache for processed surfaces */
77 Texture(SDL_Surface* sdlsurface);
80 SDL_Surface *get_transform(const Color &color, DrawingEffect effect);
82 SDL_Surface *get_texture() const
87 unsigned int get_texture_width() const
92 unsigned int get_texture_height() const
97 unsigned int get_image_width() const
102 unsigned int get_image_height() const