1 /** 2 * Copyright (c) 2006-2011 LOVE Development Team 3 * 4 * This software is provided 'as-is', without any express or implied 5 * warranty. In no event will the authors be held liable for any damages 6 * arising from the use of this software. 7 * 8 * Permission is granted to anyone to use this software for any purpose, 9 * including commercial applications, and to alter it and redistribute it 10 * freely, subject to the following restrictions: 11 * 12 * 1. The origin of this software must not be misrepresented; you must not 13 * claim that you wrote the original software. If you use this software 14 * in a product, an acknowledgment in the product documentation would be 15 * appreciated but is not required. 16 * 2. Altered source versions must be plainly marked as such, and must not be 17 * misrepresented as being the original software. 18 * 3. This notice may not be removed or altered from any source distribution. 19 **/ 20 21 #ifndef LOVE_GRAPHICS_IMAGE_H 22 #define LOVE_GRAPHICS_IMAGE_H 23 24 // LOVE 25 #include <graphics/Volatile.h> 26 #include <graphics/Drawable.h> 27 #include <common/StringMap.h> 28 29 namespace love 30 { 31 namespace graphics 32 { 33 34 class Image : public Drawable, public Volatile 35 { 36 public: 37 38 enum WrapMode 39 { 40 WRAP_CLAMP = 1, 41 WRAP_REPEAT, 42 WRAP_MAX_ENUM 43 }; 44 45 enum FilterMode 46 { 47 FILTER_LINEAR = 1, 48 FILTER_NEAREST, 49 FILTER_MAX_ENUM 50 }; 51 52 struct Filter 53 { 54 Filter(); 55 FilterMode min; 56 FilterMode mag; 57 }; 58 59 struct Wrap 60 { 61 Wrap(); 62 WrapMode s; 63 WrapMode t; 64 }; 65 66 virtual ~Image(); 67 68 static bool getConstant(const char * in, FilterMode & out); 69 static bool getConstant(FilterMode in, const char *& out); 70 static bool getConstant(const char * in, WrapMode & out); 71 static bool getConstant(WrapMode in, const char *& out); 72 73 private: 74 75 static StringMap<FilterMode, FILTER_MAX_ENUM>::Entry filterModeEntries[]; 76 static StringMap<FilterMode, FILTER_MAX_ENUM> filterModes; 77 static StringMap<WrapMode, WRAP_MAX_ENUM>::Entry wrapModeEntries[]; 78 static StringMap<WrapMode, WRAP_MAX_ENUM> wrapModes; 79 80 }; // Image 81 82 } // graphics 83 } // love 84 85 #endif // LOVE_GRAPHICS_IMAGE_H 86