blob: b2d504bf587698967c757d698452596cd0301e5c (
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
|
using System;
namespace Xamarin.PropertyEditing.Drawing
{
/// <summary>
/// Base class for brush descriptions.
/// </summary>
[Serializable]
public abstract class CommonBrush : IEquatable<CommonBrush>
{
// TODO: add transforms
public CommonBrush(double opacity = 1.0)
{
Opacity = opacity;
}
/// <summary>
/// The opacity of the brush.
/// </summary>
public double Opacity { get; }
public override bool Equals (object obj)
{
var brush = obj as CommonBrush;
if (brush == null) return false;
return Equals (brush);
}
public bool Equals (CommonBrush other)
{
return other != null &&
Opacity == other.Opacity;
}
public static bool operator == (CommonBrush left, CommonBrush right) => Equals (left, right);
public static bool operator != (CommonBrush left, CommonBrush right) => !Equals (left, right);
public override int GetHashCode ()
{
return unchecked(1107944354 * -1521134295 + Opacity.GetHashCode ());
}
}
}
|