Welcome to mirror list, hosted at ThFree Co, Russian Federation.

PixelPicker.cs « Structures « UVtools.WPF - github.com/sn4k3/UVtools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c0459ffb0e8b00d72e4c2e9e8815ecc80b679f39 (plain)
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
using System.Drawing;
using UVtools.Core.Objects;

namespace UVtools.WPF.Structures
{
    public class PixelPicker : BindableBase
    {
        private bool _isSet;
        private Point _location = new(0,0);
        private byte _brightness;

        public bool IsSet
        {
            get => _isSet;
            private set => RaiseAndSetIfChanged(ref _isSet, value);
        }

        public Point Location
        {
            get => _location;
            set => RaiseAndSetIfChanged(ref _location, value);
        }

        public byte Brightness
        {
            get => _brightness;
            private set => RaiseAndSetIfChanged(ref _brightness, value);
        }

        public void Set(Point location, byte brightness)
        {
            Location = location;
            Brightness = brightness;
            IsSet = true;
        }

        public void Reset()
        {
            Location = Point.Empty;
            Brightness = 0;
            IsSet = false;
        }

        public override string ToString()
        {
            return $"{{X={_location.X}, Y={_location.Y}, B={_brightness}}}";
        }
    }
}