This repository was archived by the owner on Jul 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersistentSettings.cs
384 lines (352 loc) · 10.2 KB
/
PersistentSettings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
using PaintDotNet.Effects;
using System.Collections.Generic;
namespace BrushFilter
{
/// <summary>
/// Represents the settings used in the dialog so they can be stored and
/// loaded when applying the effect consecutively for convenience.
/// </summary>
public class PersistentSettings : EffectConfigToken
{
#region Fields
/// <summary>
/// The brush's intensity.
/// </summary>
public int BrushIntensity
{
get;
set;
}
/// <summary>
/// The active brush index, as chosen from built-in brushes.
/// </summary>
public string BrushName
{
get;
set;
}
/// <summary>
/// The brush's orientation in degrees.
/// </summary>
public int BrushRotation
{
get;
set;
}
/// <summary>
/// The brush's radius.
/// </summary>
public int BrushSize
{
get;
set;
}
/// <summary>
/// A loaded effect, if any.
/// </summary>
public Effect LoadedEffect;
/// <summary>
/// The config details of a non-property-based loaded effect.
/// </summary>
public EffectConfigToken LoadedEffectToken;
/// <summary>
/// Whether the brush rotates with the mouse direction or not.
/// </summary>
public bool DoRotateWithMouse
{
get;
set;
}
/// <summary>
/// Whether to save the settings when the effect is applied.
/// </summary>
public bool DoSaveSettings
{
get;
set;
}
/// <summary>
/// Whether affected pixels blend or overwrite original pixels while
/// drawing.
/// </summary>
public bool OverwriteMode
{
get;
set;
}
/// <summary>
/// Whether to render the clipboard image below the drawing when
/// finalized after a brush stroke.
/// </summary>
public bool AlphaMask
{
get;
set;
}
/// <summary>
/// Randomized maximum effect intensity.
/// </summary>
public int RandMaxIntensity
{
get;
set;
}
/// <summary>
/// Randomized maximum brush size.
/// </summary>
public int RandMaxSize
{
get;
set;
}
/// <summary>
/// Randomized minimum brush effect intensity.
/// </summary>
public int RandMinIntensity
{
get;
set;
}
/// <summary>
/// Randomized minimum brush size.
/// </summary>
public int RandMinSize
{
get;
set;
}
/// <summary>
/// Randomized counter-clockwise rotation.
/// </summary>
public int RandRotLeft
{
get;
set;
}
/// <summary>
/// Randomized clockwise rotation.
/// </summary>
public int RandRotRight
{
get;
set;
}
/// <summary>
/// Randomized horizontal shifting with respect to canvas size.
/// </summary>
public int RandHorzShift
{
get;
set;
}
/// <summary>
/// Randomized vertical shifting with respect to canvas size.
/// </summary>
public int RandVertShift
{
get;
set;
}
/// <summary>
/// Doesn't apply brush strokes until the mouse is a certain distance
/// from its last location.
/// </summary>
public int MinDrawDistance
{
get;
set;
}
/// <summary>
/// Increments/decrements the size by an amount after each stroke.
/// </summary>
public int SizeChange
{
get;
set;
}
/// <summary>
/// Increments/decrements the rotation by an amount after each stroke.
/// </summary>
public int RotChange
{
get;
set;
}
/// <summary>
/// Increments/decrements the effect intensity by an amount after each stroke.
/// </summary>
public int IntensityChange
{
get;
set;
}
/// <summary>
/// Sets whether to draw horizontal, vertical, or radial reflections
/// of the current image.
/// </summary>
public SymmetryMode SymmetryMode
{
get;
set;
}
/// <summary>
/// Sets the effect to be applied during filter drawing.
/// </summary>
public int EffectMode
{
get;
set;
}
/// <summary>
/// The value for the first property of the effect chosen.
/// </summary>
public int EffectProperty1
{
get;
set;
}
/// <summary>
/// The value for the second property of the effect chosen.
/// </summary>
public int EffectProperty2
{
get;
set;
}
/// <summary>
/// The value for the third property of the effect chosen.
/// </summary>
public int EffectProperty3
{
get;
set;
}
/// <summary>
/// The value for the fourth property of the effect chosen.
/// </summary>
public int EffectProperty4
{
get;
set;
}
/// <summary>
/// Contains a list of all custom brushes to reload. The dialog will
/// attempt to read the paths of each brush and add them if possible.
/// </summary>
public List<string> CustomBrushLocations
{
get;
set;
}
#endregion
#region Constructors
/// <summary>
/// Calls and sets up dialog settings to be stored.
/// </summary>
public PersistentSettings(
int brushSize,
string brushName,
int brushRotation,
int brushIntensity,
int randMaxIntensity,
int randMinIntensity,
int randMaxSize,
int randMinSize,
int randRotLeft,
int randRotRight,
int randHorzShift,
int randVertShift,
bool doRotateWithMouse,
int minDrawDistance,
int sizeChange,
int rotChange,
int intensityChange,
bool overwriteMode,
bool useAlphaMask,
SymmetryMode symmetryMode,
int effectMode,
int valProperty1,
int valProperty2,
int valProperty3,
int valProperty4,
List<string> customBrushLocations,
Effect customEffect,
EffectConfigToken customEffectToken)
: base()
{
BrushSize = brushSize;
BrushName = brushName;
BrushRotation = brushRotation;
BrushIntensity = brushIntensity;
RandMaxIntensity = randMaxIntensity;
RandMinIntensity = randMinIntensity;
RandMaxSize = randMaxSize;
RandMinSize = randMinSize;
RandRotLeft = randRotLeft;
RandRotRight = randRotRight;
RandHorzShift = randHorzShift;
RandVertShift = randVertShift;
DoRotateWithMouse = doRotateWithMouse;
MinDrawDistance = minDrawDistance;
SizeChange = sizeChange;
RotChange = rotChange;
IntensityChange = intensityChange;
OverwriteMode = overwriteMode;
AlphaMask = useAlphaMask;
SymmetryMode = symmetryMode;
EffectMode = effectMode;
EffectProperty1 = valProperty1;
EffectProperty2 = valProperty2;
EffectProperty3 = valProperty3;
EffectProperty4 = valProperty4;
CustomBrushLocations = new List<string>(customBrushLocations);
LoadedEffect = customEffect;
LoadedEffectToken = customEffectToken;
}
/// <summary>
/// Copies all settings to another token.
/// </summary>
protected PersistentSettings(PersistentSettings other)
: base(other)
{
BrushSize = other.BrushSize;
BrushName = other.BrushName;
BrushRotation = other.BrushRotation;
BrushIntensity = other.BrushIntensity;
RandMaxIntensity = other.RandMaxIntensity;
RandMinIntensity = other.RandMinIntensity;
RandMaxSize = other.RandMaxSize;
RandMinSize = other.RandMinSize;
RandRotLeft = other.RandRotLeft;
RandRotRight = other.RandRotRight;
RandHorzShift = other.RandHorzShift;
RandVertShift = other.RandVertShift;
DoRotateWithMouse = other.DoRotateWithMouse;
MinDrawDistance = other.MinDrawDistance;
SizeChange = other.SizeChange;
RotChange = other.RotChange;
IntensityChange = other.IntensityChange;
OverwriteMode = other.OverwriteMode;
AlphaMask = other.AlphaMask;
SymmetryMode = other.SymmetryMode;
EffectMode = other.EffectMode;
EffectProperty1 = other.EffectProperty1;
EffectProperty2 = other.EffectProperty2;
EffectProperty3 = other.EffectProperty3;
EffectProperty4 = other.EffectProperty4;
CustomBrushLocations = new List<string>(other.CustomBrushLocations);
LoadedEffect = other.LoadedEffect;
LoadedEffectToken = other.LoadedEffectToken;
}
#endregion
#region Methods
/// <summary>
/// Copies all settings to another token.
/// </summary>
public override object Clone()
{
return new PersistentSettings(this);
}
#endregion
}
}