-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQRIdenticonOptions.cs
51 lines (45 loc) · 1.47 KB
/
QRIdenticonOptions.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
using System;
using IdenticonSharp.Compatibility;
#if NETFRAMEWORK
using System.Drawing;
#else
using Color = SixLabors.ImageSharp.PixelFormats.Rgba32;
using Image = SixLabors.ImageSharp.Image<SixLabors.ImageSharp.PixelFormats.Rgba32>;
#endif
namespace IdenticonSharp.Identicons.Defaults.QR
{
public class QRIdenticonOptions : IIdenticonOptions
{
public Color Foreground { get; set; } = ColorHelper.FromRgb(0, 0, 0);
public Color Background { get; set; } = ColorHelper.FromRgb(255, 255, 255);
public int Scale
{
get => _scale;
set
{
if (value < 1)
throw new ArgumentException("Scale must be greater than 0", nameof(Scale));
_scale = value;
}
}
private int _scale = 1;
public int Border
{
get => _border;
set
{
if (value < 0)
throw new ArgumentException("Border must be greater or equal than 0", nameof(Border));
_border = value;
}
}
private int _border = 4;
public Image CenterImage { get; set; } = null;
public CorrectionLevel CorrectionLevel
{
get => _correctionLevel;
set => _correctionLevel = value ?? throw new ArgumentNullException(nameof(CorrectionLevel));
}
private CorrectionLevel _correctionLevel = CorrectionLevel.Medium;
}
}