1 /* 2 This file is part of Warzone 2100. 3 Copyright (C) 1999-2004 Eidos Interactive 4 Copyright (C) 2005-2020 Warzone 2100 Project 5 6 Warzone 2100 is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 Warzone 2100 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. 15 16 You should have received a copy of the GNU General Public License 17 along with Warzone 2100; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 #ifndef _tex_ 21 #define _tex_ 22 23 #include "lib/framework/wzstring.h" 24 #include "gfx_api.h" 25 #include "png_util.h" 26 27 #include <optional-lite/optional.hpp> 28 using nonstd::optional; 29 using nonstd::nullopt; 30 31 #define iV_TEX_INVALID 0 32 #define iV_TEXNAME_MAX 64 33 34 #define iV_TEXNAME_TCSUFFIX "_tcmask" 35 36 //************************************************************************* 37 38 gfx_api::texture& pie_Texture(size_t page); 39 size_t pie_NumberOfPages(); 40 size_t pie_ReserveTexture(const char *name, const size_t& width, const size_t& height); 41 void pie_AssignTexture(size_t page, gfx_api::texture* texture); 42 43 //************************************************************************* 44 45 bool scaleImageMaxSize(iV_Image *s, int maxWidth, int maxHeight); 46 47 optional<size_t> iV_GetTexture(const char *filename, bool compression = true, int maxWidth = -1, int maxHeight = -1); 48 void iV_unloadImage(iV_Image *image); 49 gfx_api::pixel_format iV_getPixelFormat(const iV_Image *image); 50 51 bool replaceTexture(const WzString &oldfile, const WzString &newfile); 52 size_t pie_AddTexPage(iV_Image *s, const char *filename, bool gameTexture); 53 size_t pie_AddTexPage(iV_Image *s, const char *filename, bool gameTexture, size_t page); 54 void pie_TexInit(); 55 56 std::string pie_MakeTexPageName(const std::string& filename); 57 std::string pie_MakeTexPageTCMaskName(const std::string& filename); 58 59 //************************************************************************* 60 61 void pie_TexShutDown(); 62 63 #endif 64