2005-09-19 Chris Toshok <toshok@ximian.com>
[mono.git] / mcs / class / System.Drawing / System.Drawing / TextureBrush.jvm.cs
1 //
2 // System.Drawing.TextureBrush.cs
3 //
4 // Author:
5 //   Dennis Hayes (dennish@Raytek.com)
6 //   Ravindra (rkumar@novell.com)
7 //
8 // (C) 2002 Ximian, Inc
9 // (C) 2004 Novell, Inc.
10 //
11
12 //
13 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 //
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 // 
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 // 
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 //
34
35 using System;
36 using System.Drawing.Drawing2D;
37 using System.Drawing.Imaging;
38
39 using awt = java.awt;
40 using geom = java.awt.geom;
41 using image = java.awt.image;
42
43 namespace System.Drawing
44 {
45         /// <summary>
46         /// Summary description for TextureBrush.
47         /// </summary>
48         public sealed class TextureBrush : Brush
49         {
50                 awt.TexturePaint _nativeObject;
51
52                 protected override java.awt.Paint NativeObject {
53                         get {
54                                 return _nativeObject;
55                         }
56                 }
57
58
59                 WrapMode _wrapMode;
60
61                 TextureBrush (awt.TexturePaint ptr)
62                 {
63                         _nativeObject = ptr;
64                 }
65
66                 public TextureBrush (Image image) : this (image, WrapMode.Tile)
67                 {
68                 }
69
70                 public TextureBrush (Image image, Rectangle dstRect)
71                 {
72                 }
73
74                 public TextureBrush (Image image, RectangleF dstRect)
75                 {
76                         // FIXME: check if not metafile
77                         _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
78                                 new geom.Rectangle2D.Float((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,
79                                 (float)dstRect.Height));
80                 }
81
82                 public TextureBrush (Image image, WrapMode wrapMode)
83                 {
84                         // FIXME: check if not metafile
85                         // TBD: WRAP MODE
86                         _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
87                                 new geom.Rectangle2D.Float(0,0,1,1));
88                 }
89
90                 public TextureBrush (Image image, Rectangle dstRect, ImageAttributes imageAttr)
91                 {
92                         throw new NotImplementedException();
93                 }
94
95                 public TextureBrush (Image image, RectangleF dstRect, ImageAttributes imageAttr)
96                 {
97                         throw new NotImplementedException();
98                 }
99
100                 public TextureBrush (Image image, WrapMode wrapMode, Rectangle dstRect)
101                 {
102                         // FIXME: check if not metafile
103                         // TBD:WRAP MODE
104                         _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
105                                 new geom.Rectangle2D.Float ((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,(float)dstRect.Height));
106                 }
107
108                 public TextureBrush (Image image, WrapMode wrapMode, RectangleF dstRect)
109                 {
110                         // FIXME: check if not metafile
111                         //TBD:WRAP MODE
112                         _nativeObject = new awt.TexturePaint((image.BufferedImage)image.NativeObject.CurrentImage.NativeImage,
113                                 new geom.Rectangle2D.Float((float)dstRect.X,(float)dstRect.Y,(float)dstRect.Width,
114                                 (float)dstRect.Height));
115                 }
116
117                 // properties
118                 public Image Image {
119                         get {
120                                 return Image.ImageFromNativeImage(((awt.TexturePaint)NativeObject).getImage(),
121                                         ImageFormat.Bmp);
122                         }
123                 }
124
125                 public Matrix Transform {
126                         get {                                   
127                                 throw new NotImplementedException();
128                         }
129                         set {
130                                 throw new NotImplementedException();
131                         }
132                 }
133
134                 public WrapMode WrapMode {
135                         get {
136                                 return _wrapMode;
137                         }
138                         set {
139                                 _wrapMode = value;
140                         }
141                 }
142
143                 // public methods
144
145                 public override object Clone ()
146                 {
147                         throw new NotImplementedException();
148                 }
149
150                 public void MultiplyTransform (Matrix matrix)
151                 {
152                         MultiplyTransform (matrix, MatrixOrder.Prepend);
153                 }
154
155                 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
156                 {
157                         throw new NotImplementedException();
158                 }
159
160                 public void ResetTransform ()
161                 {
162                         throw new NotImplementedException();
163                 }
164
165                 public void RotateTransform (float angle)
166                 {
167                         RotateTransform (angle, MatrixOrder.Prepend);
168                 }
169
170                 public void RotateTransform (float angle, MatrixOrder order)
171                 {
172                         throw new NotImplementedException();
173                 }
174
175                 public void ScaleTransform (float sx, float sy)
176                 {
177                         ScaleTransform (sx, sy, MatrixOrder.Prepend);
178                 }
179
180                 public void ScaleTransform (float sx, float sy, MatrixOrder order)
181                 {
182                         throw new NotImplementedException();
183                 }
184
185                 public void TranslateTransform (float dx, float dy)
186                 {
187                         TranslateTransform (dx, dy, MatrixOrder.Prepend);
188                 }
189
190                 public void TranslateTransform (float dx, float dy, MatrixOrder order)
191                 {
192                         throw new NotImplementedException();
193                 }
194         }
195 }