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

CommonBrush.cs « Drawing « Xamarin.PropertyEditing - github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7ce63e0dc55dcfa40ac5431b80d613396f0e724 (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
using System;

namespace Xamarin.PropertyEditing.Drawing
{
	/// <summary>
	/// Base class for brush descriptions.
	/// </summary>
	[Serializable]
	public abstract class 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);
		}

		protected bool Equals (CommonBrush other)
		{
			return other != null &&
				   Opacity == other.Opacity;
		}
		// Note: not overriding equality operators on the base class on purpose because that won't be properly overridden on derived classes.

		public override int GetHashCode ()
		{
			return unchecked(1107944354 * -1521134295 + Opacity.GetHashCode ());
		}
	}
}