3 using System
.Drawing
.Drawing2D
;
4 using System
.Collections
;
7 using image
= java
.awt
.image
;
8 using geom
= java
.awt
.geom
;
11 namespace System
.Drawing
13 public abstract class Brush
: MarshalByRefObject
, ICloneable
, IDisposable
, awt
.Paint
{
17 private Matrix _brushTransform
= new Matrix();
21 protected abstract java
.awt
.Paint NativeObject
{
25 awt
.PaintContext awt
.Paint
.createContext (image
.ColorModel cm
,
26 awt
.Rectangle deviceBounds
, geom
.Rectangle2D userBounds
, geom
.AffineTransform xform
,
27 awt
.RenderingHints hints
) {
29 return createContextInternal(cm
, deviceBounds
, userBounds
, xform
, hints
);
32 protected virtual awt
.PaintContext
createContextInternal (image
.ColorModel cm
,
33 awt
.Rectangle deviceBounds
, geom
.Rectangle2D userBounds
, geom
.AffineTransform xform
,
34 awt
.RenderingHints hints
) {
36 Matrix
.Multiply(xform
, _brushTransform
.NativeObject
, MatrixOrder
.Append
);
37 return NativeObject
.createContext (cm
, deviceBounds
, userBounds
, xform
, hints
);
40 int awt
.Transparency
.getTransparency () {
41 return NativeObject
.getTransparency ();
44 abstract public object Clone ();
46 public void Dispose () {
50 protected virtual void Dispose (bool disposing
) {
53 protected Brush
InternalClone() {
54 Brush brush
= (Brush
)this.MemberwiseClone();
55 brush
._brushTransform
= this._brushTransform
.Clone();
59 #region Brush transform
61 internal Matrix BrushTransform
{
62 get { return _brushTransform.Clone(); }
65 throw new ArgumentNullException("matrix");
67 value.CopyTo( _brushTransform
);
71 protected internal void BrushTranslateTransform (float dx
, float dy
) {
72 BrushTranslateTransform(dx
, dy
, MatrixOrder
.Prepend
);
74 protected internal void BrushTranslateTransform (float dx
, float dy
, MatrixOrder order
) {
75 _brushTransform
.Translate(dx
,dy
,order
);
77 protected internal void BrushResetTransform () {
78 _brushTransform
.Reset();
80 protected internal void BrushRotateTransform (float angle
) {
81 BrushRotateTransform(angle
, MatrixOrder
.Prepend
);
83 protected internal void BrushRotateTransform (float angle
, MatrixOrder order
) {
84 _brushTransform
.Rotate(angle
, order
);
86 protected internal void BrushScaleTransform (float sx
, float sy
) {
87 BrushScaleTransform(sx
, sy
, MatrixOrder
.Prepend
);
89 protected internal void BrushScaleTransform (float sx
, float sy
, MatrixOrder order
) {
90 _brushTransform
.Scale(sx
, sy
, order
);
92 protected internal void BrushMultiplyTransform (Matrix matrix
) {
93 BrushMultiplyTransform(matrix
, MatrixOrder
.Prepend
);
95 protected internal void BrushMultiplyTransform (Matrix matrix
, MatrixOrder order
) {
97 throw new ArgumentNullException("matrix");
98 _brushTransform
.Multiply(matrix
, order
);