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

Brush.cs « System.Drawing « System.Drawing « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cf0a32b9cf2b46783eabef82cf59fc054422afcb (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
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
//
// System.Drawing.Brush.cs
//
// Authors:
//   Miguel de Icaza (miguel@ximian.com)
//   Ravindra (rkumar@novell.com)
//
// (C) Ximian, Inc.  http://www.ximian.com
// (C) Novell, Inc.  Http://www.novell.com
//

using System;
using System.Drawing;
using System.Drawing.Drawing2D;

namespace System.Drawing
{
	public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable
	{
		internal IntPtr nativeObject;
		abstract public object Clone ();

                internal Brush ()
                { }

		internal Brush (IntPtr ptr)
		{
                        nativeObject = ptr;
		}
		
		internal IntPtr NativeObject {
			get {
				return nativeObject;
			}
			set {
				nativeObject = value;
			}
		}

                internal Brush CreateBrush (IntPtr brush, System.Drawing.BrushType type)
                {
                        switch (type) {

                        case BrushType.BrushTypeSolidColor:
                                return new SolidBrush (brush);

                        case BrushType.BrushTypeHatchFill:
                                return new HatchBrush (brush);

                        case BrushType.BrushTypeTextureFill:
                                return new TextureBrush (brush);

                        default:
                                throw new NotImplementedException ();
                        }
                }

		public void Dispose ()
		{
			Dispose (true);
			System.GC.SuppressFinalize (this);
		}

		protected virtual void Dispose (bool disposing)
		{
			Status status = GDIPlus.GdipDeleteBrush (nativeObject);
			GDIPlus.CheckStatus (status);
		}

		~Brush ()
		{
			Dispose (false);
		}
	}
}