4 |
andreas |
1 |
/*
|
21 |
andreas |
2 |
* Copyright (C) 2020, 2021 by Andreas Theofilu <andreas@theosys.at>
|
4 |
andreas |
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 __TRESOURCES_H__
|
|
|
20 |
#define __TRESOURCES_H__
|
|
|
21 |
|
|
|
22 |
#include <include/core/SkImage.h>
|
|
|
23 |
#include <include/core/SkString.h>
|
|
|
24 |
#include <include/core/SkData.h>
|
|
|
25 |
|
|
|
26 |
class SkBitmap;
|
|
|
27 |
class SkData;
|
|
|
28 |
class SkStreamAsset;
|
|
|
29 |
class SkTypeface;
|
|
|
30 |
|
|
|
31 |
extern sk_sp<SkData> (*gResourceFactory)(const char*);
|
|
|
32 |
|
|
|
33 |
SkString GetResourcePath(const char* resource = "");
|
|
|
34 |
|
|
|
35 |
bool DecodeDataToBitmap(sk_sp<SkData> data, SkBitmap* dst);
|
|
|
36 |
|
|
|
37 |
sk_sp<SkData> GetResourceAsData(const char* resource);
|
|
|
38 |
|
|
|
39 |
inline bool GetResourceAsBitmap(const char* resource, SkBitmap* dst)
|
|
|
40 |
{
|
|
|
41 |
return DecodeDataToBitmap(GetResourceAsData(resource), dst);
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
inline sk_sp<SkImage> GetResourceAsImage(const char* resource)
|
|
|
45 |
{
|
|
|
46 |
return SkImage::MakeFromEncoded(GetResourceAsData(resource));
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
std::unique_ptr<SkStreamAsset> GetResourceAsStream(const char* resource);
|
|
|
50 |
|
|
|
51 |
sk_sp<SkTypeface> MakeResourceAsTypeface(const char* resource, int ttcIndex = 0);
|
|
|
52 |
|
6 |
andreas |
53 |
sk_sp<SkData> readImage(const std::string& fname);
|
|
|
54 |
|
21 |
andreas |
55 |
std::string toLower(std::string& str);
|
|
|
56 |
std::string toUpper(std::string& str);
|
11 |
andreas |
57 |
std::vector<std::string> StrSplit(const std::string& str, const std::string& seps, const bool trimEmpty=false);
|
|
|
58 |
std::string UTF8ToCp1250(const std::string& str);
|
|
|
59 |
std::string cp1250ToUTF8(const std::string& str);
|
|
|
60 |
std::string latin1ToUTF8(const std::string& str);
|
|
|
61 |
|
21 |
andreas |
62 |
void *renew(void *mem, size_t old_size, size_t new_size);
|
|
|
63 |
|
4 |
andreas |
64 |
#endif // __TRESOURCES_H__
|