fix typo
[mcs.git] / class / System.Drawing / System.Drawing / Brush.jvm.cs
blobc7fa4051e088e74024e18dd939e3b365d92b059e
1 using System;
2 using System.Drawing;
3 using System.Drawing.Drawing2D;
4 using System.Collections;
6 using awt = java.awt;
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 {
15 #region fields
17 private Matrix _brushTransform = new Matrix();
19 #endregion
21 protected abstract java.awt.Paint NativeObject {
22 get;
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 () {
47 Dispose (true);
50 protected virtual void Dispose (bool disposing) {
53 protected Brush InternalClone() {
54 Brush brush = (Brush)this.MemberwiseClone();
55 brush._brushTransform = this._brushTransform.Clone();
56 return brush;
59 #region Brush transform
61 internal Matrix BrushTransform {
62 get { return _brushTransform.Clone(); }
63 set {
64 if (value == null)
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) {
96 if (matrix == null)
97 throw new ArgumentNullException("matrix");
98 _brushTransform.Multiply(matrix, order);
101 #endregion