1 /*$
2  Copyright (C) 2013-2020 Azel.
3 
4  This file is part of AzPainter.
5 
6  AzPainter 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 3 of the License, or
9  (at your option) any later version.
10 
11  AzPainter 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 this program.  If not, see <http://www.gnu.org/licenses/>.
18 $*/
19 
20 /********************************
21  * ブラシアイテムデータ
22  ********************************/
23 
24 #ifndef BRUSHITEM_H
25 #define BRUSHITEM_H
26 
27 #include "mListDef.h"
28 
29 typedef struct _BrushGroupItem BrushGroupItem;
30 
31 #define BRUSHITEM(p)  ((BrushItem *)(p))
32 
33 typedef struct _BrushItem
34 {
35 	mListItem i;
36 
37 	BrushGroupItem *group;	//所属グループ
38 
39 	char *name,			//名前
40 		*shape_path,	//ブラシ形状ファイルパス (空で円形)
41 		*texture_path;	//テクスチャファイルパス (空でなし[強制]、"?" でオプション指定を使う)
42 
43 	uint32_t pressure_val;	//筆圧補正値(共通)
44 					/* 曲線 : 2byte ガンマ値 (1.00=100)
45 					 * 線形1点 : 下位8byte から [IN,OUT]
46 					 * 線形2点 : 下位8byte から 1[IN,OUT] 2[IN,OUT] */
47 	uint16_t radius,	//半径サイズ [1.0=10]
48 		radius_min,		//半径最小
49 		radius_max,		//半径最大
50 		min_size,		//最小サイズ(%) [1.0=10]
51 		min_opacity,	//最小濃度(%) [1.0=10]
52 		interval,		//点の間隔 [1.00=100]
53 		rand_size_min,	//ランダム、サイズ最小 [1.0=10]
54 		rand_pos_range,	//ランダム、位置の最大距離 [1.00=100]
55 		rotate_angle,	//回転角度 (0-359)
56 		water_param[3];	//水彩パラメータ (0:色の補充 1:キャンバス色の割合 2:描画色の割合)
57 	uint8_t type,		//ブラシタイプ
58 		opacity,		//濃度 (0-100)
59 		pixelmode,		//塗りタイプ
60 		hosei_type,		//補正タイプ
61 		hosei_strong,	//補正強さ (1-)
62 		hardness,		//形状硬さ (0-100)
63 		roughness,		//荒さ (0-100)
64 		rotate_rand_w,	//回転ランダム幅 (0-180)
65 		pressure_type,	//筆圧補正タイプ (0:曲線 1:線形1点 2:線形2点)
66 		flags;			//フラグ
67 }BrushItem;
68 
69 enum
70 {
71 	BRUSHITEM_TYPE_NORMAL,
72 	BRUSHITEM_TYPE_ERASE,
73 	BRUSHITEM_TYPE_WATER,
74 	BRUSHITEM_TYPE_BLUR,
75 	BRUSHITEM_TYPE_DOTPEN,
76 	BRUSHITEM_TYPE_FINGER,
77 
78 	BRUSHITEM_TYPE_NUM
79 };
80 
81 enum
82 {
83 	BRUSHITEM_F_AUTO_SAVE = 1<<0,
84 	BRUSHITEM_F_ROTATE_TRAVELLING_DIR = 1<<1,
85 	BRUSHITEM_F_ANTIALIAS = 1<<2,
86 	BRUSHITEM_F_CURVE     = 1<<3,
87 };
88 
89 enum
90 {
91 	BRUSHITEM_16BITVAL_NUM = 12,
92 	BRUSHITEM_8BITVAL_NUM  = 10,
93 
94 	BRUSHITEM_RADIUS_MIN = 3,
95 	BRUSHITEM_RADIUS_MAX = 6000,
96 	BRUSHITEM_FINGER_RADIUS_MIN = 1,
97 	BRUSHITEM_FINGER_RADIUS_MAX = 50,
98 	BRUSHITEM_INTERVAL_MIN = 5,
99 	BRUSHITEM_INTERVAL_MAX = 1000,
100 	BRUSHITEM_RANDOM_POS_MAX = 5000,
101 	BRUSHITEM_PRESSURE_CURVE_MIN = 1,
102 	BRUSHITEM_PRESSURE_CURVE_MAX = 600,
103 	BRUSHITEM_HOSEI_STRONG_MAX = 15
104 };
105 
106 
107 void BrushItem_destroy_handle(mListItem *item);
108 
109 void BrushItem_setDefault(BrushItem *p);
110 int BrushItem_adjustRadius(BrushItem *p,int n);
111 void BrushItem_adjustRadiusMinMax(BrushItem *p);
112 int BrushItem_getPixelModeNum(BrushItem *p);
113 int BrushItem_getPosInGroup(BrushItem *p);
114 void BrushItem_copy(BrushItem *dst,BrushItem *src);
115 void BrushItem_getTextFormat(BrushItem *p,mStr *str);
116 void BrushItem_setFromText(BrushItem *p,const char *text);
117 
118 #endif
119