2 // System.Drawing.Drawing2D.CustomLineCap.cs
5 // Dennis Hayes (dennish@Raytek.com)
6 // Andreas Nahr (ClassDevelopment@A-SoftTech.com)
7 // Ravindra (rkumar@novell.com)
9 // Copyright (C) 2002/3 Ximian, Inc. http://www.ximian.com
10 // Copyright (C) 2004 Novell, Inc. http://www.novell.com
14 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
16 // Permission is hereby granted, free of charge, to any person obtaining
17 // a copy of this software and associated documentation files (the
18 // "Software"), to deal in the Software without restriction, including
19 // without limitation the rights to use, copy, modify, merge, publish,
20 // distribute, sublicense, and/or sell copies of the Software, and to
21 // permit persons to whom the Software is furnished to do so, subject to
22 // the following conditions:
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 namespace System
.Drawing
.Drawing2D
41 /// Summary description for CustomLineCap.
43 public class CustomLineCap
: MarshalByRefObject
, ICloneable
, IDisposable
45 private bool disposed
;
46 internal IntPtr nativeObject
;
50 internal CustomLineCap () { }
52 internal CustomLineCap (IntPtr ptr
)
57 public CustomLineCap (GraphicsPath fillPath
, GraphicsPath strokePath
) : this (fillPath
, strokePath
, LineCap
.Flat
, 0)
61 public CustomLineCap (GraphicsPath fillPath
, GraphicsPath strokePath
, LineCap baseCap
) : this (fillPath
, strokePath
, baseCap
, 0)
65 public CustomLineCap(GraphicsPath fillPath
, GraphicsPath strokePath
, LineCap baseCap
, float baseInset
)
67 IntPtr fill
= IntPtr
.Zero
;
68 IntPtr stroke
= IntPtr
.Zero
;
71 fill
= fillPath
.nativePath
;
72 if (strokePath
!= null)
73 stroke
= strokePath
.nativePath
;
75 Status status
= GDIPlus
.GdipCreateCustomLineCap (fill
, stroke
, baseCap
, baseInset
, out nativeObject
);
76 GDIPlus
.CheckStatus (status
);
79 public LineCap BaseCap
{
82 Status status
= GDIPlus
.GdipGetCustomLineCapBaseCap (nativeObject
, out baseCap
);
83 GDIPlus
.CheckStatus (status
);
89 Status status
= GDIPlus
.GdipSetCustomLineCapBaseCap (nativeObject
, value);
90 GDIPlus
.CheckStatus (status
);
94 public LineJoin StrokeJoin
{
97 Status status
= GDIPlus
.GdipGetCustomLineCapStrokeJoin (nativeObject
, out strokeJoin
);
98 GDIPlus
.CheckStatus (status
);
104 Status status
= GDIPlus
.GdipSetCustomLineCapStrokeJoin (nativeObject
, value);
105 GDIPlus
.CheckStatus (status
);
109 public float BaseInset
{
112 Status status
= GDIPlus
.GdipGetCustomLineCapBaseInset (nativeObject
, out baseInset
);
113 GDIPlus
.CheckStatus (status
);
119 Status status
= GDIPlus
.GdipSetCustomLineCapBaseInset (nativeObject
, value);
120 GDIPlus
.CheckStatus (status
);
124 public float WidthScale
{
127 Status status
= GDIPlus
.GdipGetCustomLineCapWidthScale (nativeObject
, out widthScale
);
128 GDIPlus
.CheckStatus (status
);
134 Status status
= GDIPlus
.GdipSetCustomLineCapWidthScale (nativeObject
, value);
135 GDIPlus
.CheckStatus (status
);
141 public virtual object Clone ()
144 Status status
= GDIPlus
.GdipCloneCustomLineCap (nativeObject
, out clonePtr
);
145 GDIPlus
.CheckStatus (status
);
147 return new CustomLineCap (clonePtr
);
150 public virtual void Dispose ()
153 System
.GC
.SuppressFinalize (this);
156 protected virtual void Dispose (bool disposing
)
159 Status status
= GDIPlus
.GdipDeleteCustomLineCap (nativeObject
);
160 GDIPlus
.CheckStatus (status
);
162 nativeObject
= IntPtr
.Zero
;
171 public void GetStrokeCaps (out LineCap startCap
, out LineCap endCap
)
173 Status status
= GDIPlus
.GdipGetCustomLineCapStrokeCaps (nativeObject
, out startCap
, out endCap
);
174 GDIPlus
.CheckStatus (status
);
177 public void SetStrokeCaps(LineCap startCap
, LineCap endCap
)
179 Status status
= GDIPlus
.GdipSetCustomLineCapStrokeCaps (nativeObject
, startCap
, endCap
);
180 GDIPlus
.CheckStatus (status
);