TextureBrush.jvm.cs 4.7 KB

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