Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
97 andreas 1
/*
2
 * Copyright (C) 2022 by Andreas Theofilu <andreas@theosys.at>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
 
19
#ifndef __TIMGCACHE_H__
20
#define __TIMGCACHE_H__
21
 
22
#include <string>
23
#include <vector>
24
 
25
#include <include/core/SkBitmap.h>
26
 
165 andreas 27
typedef enum _IMGCACHE_BMTYPE
28
{
29
    _BMTYPE_NONE,
30
    _BMTYPE_CHAMELEON,
31
    _BMTYPE_BITMAP,
32
    _BMTYPE_ICON,
33
    _BMTYPE_URL
34
}_IMGCACHE_BMTYPE;
35
 
97 andreas 36
typedef struct _IMGCACHE
37
{
165 andreas 38
    _IMGCACHE_BMTYPE bmType{_BMTYPE_NONE};
97 andreas 39
    std::string name;
40
    SkBitmap bitmap;
41
}_IMGCACHE;
42
 
43
class TImgCache
44
{
45
    public:
165 andreas 46
        static bool addImage(const std::string& name, SkBitmap& bm, _IMGCACHE_BMTYPE bmType=_BMTYPE_NONE);
47
        static bool getBitmap(const std::string& name, SkBitmap *bm, _IMGCACHE_BMTYPE bmType=_BMTYPE_NONE);
48
        static bool delBitmap(const std::string& name, _IMGCACHE_BMTYPE bmType=_BMTYPE_NONE);
49
        static bool existBitmap(const std::string& name, _IMGCACHE_BMTYPE bmType=_BMTYPE_NONE);
97 andreas 50
 
51
    private:
52
        // This should never be used
53
        TImgCache() {}
54
        ~TImgCache();
55
 
56
        // Internal variables
57
        static std::vector<_IMGCACHE> mImgCache;
58
        SkBitmap mDummyBM;
59
};
60
 
61
#endif