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
20 #ifndef __SURFACE_HPP__
21 #define __SURFACE_HPP__
29 /// bitset for drawing effects
31 /** Don't apply anything */
33 /** Draw the Surface upside down */
34 VERTICAL_FLIP = 0x0001,
35 /** Draw the Surface from left to down */
36 HORIZONTAL_FLIP = 0x0002,
40 * A rectangular image.
41 * The class basically holds a reference to a texture with additional UV
42 * coordinates that specify a rectangular area on this texture
47 friend class DrawingContext;
49 ImageTexture* texture;
56 void draw(float x, float y, float alpha, float angle, const Color& color, const Blend& blend, DrawingEffect effect) const;
57 void draw(float x, float y, float alpha, DrawingEffect effect) const;
58 void draw_part(float src_x, float src_y, float dst_x, float dst_y,
59 float width, float height,
60 float alpha, DrawingEffect effect) const;
65 Surface(const std::string& file);
66 Surface(const std::string& file, int x, int y, int w, int h);
67 Surface(const Surface& other);
70 /** flip the surface horizontally */
73 const Surface& operator= (const Surface& other);
75 float get_width() const
80 float get_height() const