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 {
14 protected abstract java.awt.Paint NativeObject {
18 awt.PaintContext awt.Paint.createContext (image.ColorModel cm,
19 awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
20 awt.RenderingHints hints) {
21 Matrix.Multiply(xform, _brushTransform.NativeObject, MatrixOrder.Append);
22 return NativeObject.createContext (cm, deviceBounds, userBounds, xform, hints);
25 int awt.Transparency.getTransparency () {
26 return NativeObject.getTransparency ();
29 abstract public object Clone ();
31 public void Dispose () {
35 protected virtual void Dispose (bool disposing) {
38 #region Brush transform
40 private readonly Matrix _brushTransform = new Matrix();
42 protected Matrix BrushTransform {
43 get { return _brushTransform.Clone(); }
46 throw new ArgumentNullException("matrix");
48 value.CopyTo( _brushTransform );
52 protected void BrushTranslateTransform (float dx, float dy) {
53 BrushTranslateTransform(dx, dy, MatrixOrder.Prepend);
55 protected void BrushTranslateTransform (float dx, float dy, MatrixOrder order) {
56 BrushTransform.Translate(dx,dy,order);
58 protected void BrushResetTransform () {
59 BrushTransform.Reset();
61 protected void BrushRotateTransform (float angle) {
62 BrushRotateTransform(angle, MatrixOrder.Prepend);
64 protected void BrushRotateTransform (float angle, MatrixOrder order) {
65 BrushTransform.Rotate(angle, order);
67 protected void BrushScaleTransform (float sx, float sy) {
68 BrushScaleTransform(sx, sy, MatrixOrder.Prepend);
70 protected void BrushScaleTransform (float sx, float sy, MatrixOrder order) {
71 BrushTransform.Scale(sx, sy, order);
73 protected void BrushMultiplyTransform (Matrix matrix) {
74 BrushMultiplyTransform(matrix, MatrixOrder.Prepend);
76 protected void BrushMultiplyTransform (Matrix matrix, MatrixOrder order) {
78 throw new ArgumentNullException("matrix");
\r
79 BrushTransform.Multiply(matrix, order);
84 // TODO: implement transform methods.