File indexing completed on 2024-05-05 16:57:02
0001 /*************************************************************************** 0002 * Copyright (C) 2013-2016 by Linuxstopmotion contributors; * 0003 * see the AUTHORS file for details. * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 0021 #ifndef IMAGECACHE_H_ 0022 #define IMAGECACHE_H_ 0023 0024 class QPixmap; 0025 0026 struct SurfaceLoader; 0027 template<typename T> class LoadCache; 0028 0029 class ImageCache { 0030 LoadCache<SurfaceLoader>* delegate; 0031 public: 0032 /** 0033 * Constructs an image cache. 0034 * @param cacheSize The number of images that the cache should hold. 0035 */ 0036 ImageCache(int cacheSize); 0037 ~ImageCache(); 0038 /** 0039 * Pulls the named image into the cache, if necessary, and returns it. 0040 * @param path The path of the file. 0041 */ 0042 QPixmap* get(const char* path); 0043 /** 0044 * Removes the named image from the cache, if it is present. 0045 * @param path The path of the file. 0046 */ 0047 void drop(const char* path); 0048 /** 0049 * Clears the cache. 0050 */ 0051 void clear(); 0052 }; 0053 0054 #endif