446 |
andreas |
1 |
/*
|
|
|
2 |
* Copyright (C) 2023 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 |
#ifndef TINTBORDER_H
|
|
|
19 |
#define TINTBORDER_H
|
|
|
20 |
|
|
|
21 |
#include <string>
|
|
|
22 |
|
|
|
23 |
class SkBitmap;
|
|
|
24 |
struct SkRect;
|
|
|
25 |
|
|
|
26 |
namespace Border
|
|
|
27 |
{
|
|
|
28 |
typedef enum ERASE_PART_t
|
|
|
29 |
{
|
|
|
30 |
ERASE_NONE,
|
|
|
31 |
ERASE_LEFT_RIGHT,
|
|
|
32 |
ERASE_RIGHT_LEFT,
|
|
|
33 |
ERASE_TOP_DOWN,
|
|
|
34 |
ERASE_BOTTOM_UP,
|
|
|
35 |
ERASE_OUTSIDE
|
|
|
36 |
}ERASE_PART_t;
|
|
|
37 |
|
|
|
38 |
typedef struct SYSBORDER_t
|
|
|
39 |
{
|
|
|
40 |
int id{0}; // Internal unique ID number
|
|
|
41 |
char *name{nullptr}; // Name of the border
|
|
|
42 |
int number{0}; // AMX number
|
|
|
43 |
char *style{nullptr}; // Style to use if dynamicaly calculated
|
|
|
44 |
int width{0}; // The width of the border
|
|
|
45 |
int radius{0}; // Radius for rounded corners
|
|
|
46 |
bool calc{false}; // TRUE = Calculated inside, FALSE = Read from images
|
|
|
47 |
}SYSBORDER_t;
|
|
|
48 |
|
|
|
49 |
typedef struct TP4BORDERS_t
|
|
|
50 |
{
|
|
|
51 |
int id{0};
|
|
|
52 |
std::string name;
|
|
|
53 |
int prgNum[4];
|
|
|
54 |
}TP4BORDERS_t;
|
|
|
55 |
|
|
|
56 |
class TIntBorder
|
|
|
57 |
{
|
|
|
58 |
public:
|
|
|
59 |
TIntBorder();
|
|
|
60 |
|
|
|
61 |
bool drawBorder(SkBitmap* bm, const std::string& bname, int wt, int ht, const std::string& cb, bool force=false);
|
|
|
62 |
int getBorderWidth(const std::string& bname, bool force=false);
|
|
|
63 |
bool borderExist(const std::string& name);
|
|
|
64 |
bool borderExist(int index);
|
|
|
65 |
std::string getBorderName(int index);
|
|
|
66 |
std::string getCorrectName(const std::string& name);
|
|
|
67 |
bool isForcedBorder(const std::string& name);
|
|
|
68 |
bool isTP4BorderValid(const std::string& name);
|
|
|
69 |
std::string getTP4BorderName(int id);
|
|
|
70 |
|
|
|
71 |
void erasePart(SkBitmap *bm, const SkBitmap& mask, ERASE_PART_t ep, int fwidth=0);
|
|
|
72 |
void colorizeFrame(SkBitmap *frame, SkColor color);
|
|
|
73 |
|
|
|
74 |
private:
|
|
|
75 |
SkRect calcRect(int width, int height, int pen);
|
|
|
76 |
};
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
#endif // TINTBORDER_H
|