ImageAttributes.jvm.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. using System;
  2. using System.Drawing;
  3. using System.Drawing.Drawing2D;
  4. namespace System.Drawing.Imaging
  5. {
  6. /// <summary>
  7. /// Summary description for ImageAttributes.
  8. /// </summary>
  9. ///
  10. public sealed class ImageAttributes : ICloneable, IDisposable
  11. {
  12. public ImageAttributes()
  13. {
  14. }
  15. public void Dispose()
  16. {
  17. }
  18. public void Finalize()
  19. {
  20. Dispose();
  21. }
  22. public Object Clone()
  23. {
  24. ImageAttributes imgAttr = new ImageAttributes();
  25. imgAttr.clrMatrix = clrMatrix;
  26. imgAttr.clrMatrixFlag = clrMatrixFlag;
  27. imgAttr.clrAdjustType = clrAdjustType;
  28. imgAttr.gMatrix = gMatrix;
  29. imgAttr.thresh = thresh;
  30. imgAttr.gamma = gamma;
  31. imgAttr.clrChannelFlags = clrChannelFlags;
  32. imgAttr.clrProfileFilename = clrProfileFilename;
  33. imgAttr.clrLow = clrLow;
  34. imgAttr.clrHigh = clrHigh;
  35. imgAttr.clrMap = clrMap;
  36. imgAttr.wrapMode = wrapMode;
  37. imgAttr.col = col;
  38. imgAttr.bClamp = bClamp;
  39. imgAttr.clrPalette = clrPalette;
  40. imgAttr.bNoOp = bNoOp;
  41. return imgAttr;
  42. }
  43. public void SetColorMatrix(ColorMatrix newColorMatrix)
  44. {
  45. SetColorMatrix(newColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
  46. }
  47. public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag flags)
  48. {
  49. SetColorMatrix(newColorMatrix, flags, ColorAdjustType.Default);
  50. }
  51. public void SetColorMatrix(ColorMatrix newColorMatrix, ColorMatrixFlag mode, ColorAdjustType type)
  52. {
  53. clrMatrix = newColorMatrix;
  54. clrMatrixFlag = mode;
  55. clrAdjustType = type;
  56. }
  57. public void ClearColorMatrix()
  58. {
  59. ClearColorMatrix(ColorAdjustType.Default);
  60. }
  61. public void ClearColorMatrix(ColorAdjustType type)
  62. {
  63. ColorMatrix cm = new ColorMatrix();
  64. clrMatrix = cm;
  65. clrAdjustType = type;
  66. }
  67. public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix gMatrix)
  68. {
  69. SetColorMatrices(newColorMatrix, gMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
  70. }
  71. public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix gMatrix, ColorMatrixFlag flags)
  72. {
  73. SetColorMatrices(newColorMatrix, gMatrix, flags, ColorAdjustType.Default);
  74. }
  75. public void SetColorMatrices(ColorMatrix newColorMatrix, ColorMatrix gMatrix, ColorMatrixFlag mode, ColorAdjustType type)
  76. {
  77. clrMatrix = newColorMatrix;
  78. this.gMatrix = gMatrix;
  79. clrMatrixFlag = mode;
  80. clrAdjustType = type;
  81. }
  82. public void SetThreshold(float thresh)
  83. {
  84. SetThreshold(thresh, ColorAdjustType.Default);
  85. }
  86. public void SetThreshold(float thresh, ColorAdjustType type)
  87. {
  88. this.thresh = thresh;
  89. clrAdjustType = type;
  90. }
  91. public void ClearThreshold()
  92. {
  93. ClearThreshold(ColorAdjustType.Default);
  94. }
  95. public void ClearThreshold(ColorAdjustType type)
  96. {
  97. thresh = 1.0F;
  98. clrAdjustType = type;
  99. }
  100. public void SetGamma(float gamma)
  101. {
  102. SetGamma(gamma, ColorAdjustType.Default);
  103. }
  104. public void SetGamma(float gamma, ColorAdjustType type)
  105. {
  106. this.gamma = gamma;
  107. clrAdjustType = type;
  108. return;
  109. }
  110. public void ClearGamma()
  111. {
  112. ClearGamma(ColorAdjustType.Default);
  113. }
  114. public void ClearGamma(ColorAdjustType type)
  115. {
  116. gamma = 1;
  117. clrAdjustType = type;
  118. }
  119. public void SetNoOp()
  120. {
  121. SetNoOp(ColorAdjustType.Default);
  122. }
  123. public void SetNoOp(ColorAdjustType type)
  124. {
  125. bNoOp = true;
  126. clrAdjustType = type;
  127. }
  128. public void ClearNoOp()
  129. {
  130. ClearNoOp(ColorAdjustType.Default);
  131. }
  132. public void ClearNoOp(ColorAdjustType type)
  133. {
  134. bNoOp = false;
  135. clrAdjustType = type;
  136. }
  137. public void SetColorKey(Color clrLow, Color clrHigh)
  138. {
  139. SetColorKey(clrLow, clrHigh, ColorAdjustType.Default);
  140. }
  141. public void SetColorKey(Color clrLow, Color clrHigh, ColorAdjustType type)
  142. {
  143. this.clrLow = clrLow;
  144. this.clrHigh = clrHigh;
  145. clrAdjustType = type;
  146. }
  147. public void ClearColorKey()
  148. {
  149. ClearColorKey(ColorAdjustType.Default);
  150. }
  151. public void ClearColorKey(ColorAdjustType type)
  152. {
  153. clrAdjustType = type;
  154. }
  155. public void SetOutputChannel(ColorChannelFlag flags)
  156. {
  157. SetOutputChannel(flags, ColorAdjustType.Default);
  158. }
  159. public void SetOutputChannel(ColorChannelFlag flags, ColorAdjustType type)
  160. {
  161. clrChannelFlags = flags;
  162. clrAdjustType = type;
  163. }
  164. public void ClearOutputChannel()
  165. {
  166. ClearOutputChannel(ColorAdjustType.Default);
  167. }
  168. public void ClearOutputChannel(ColorAdjustType type)
  169. {
  170. clrAdjustType = type;
  171. }
  172. public void SetOutputChannelColorProfile(String clrProfileFilename)
  173. {
  174. SetOutputChannelColorProfile(clrProfileFilename, ColorAdjustType.Default);
  175. }
  176. public void SetOutputChannelColorProfile(String clrProfileFilename, ColorAdjustType type)
  177. {
  178. this.clrProfileFilename = clrProfileFilename;
  179. clrAdjustType = type;
  180. }
  181. public void ClearOutputChannelColorProfile()
  182. {
  183. ClearOutputChannel(ColorAdjustType.Default);
  184. }
  185. public void ClearOutputChannelColorProfile(ColorAdjustType type)
  186. {
  187. clrProfileFilename = null;
  188. clrAdjustType = type;
  189. }
  190. public void SetRemapTable(ColorMap[] map)
  191. {
  192. SetRemapTable(map, ColorAdjustType.Default);
  193. }
  194. public void SetRemapTable(ColorMap[] map, ColorAdjustType type)
  195. {
  196. clrMap = map;
  197. clrAdjustType = type;
  198. }
  199. public void ClearRemapTable()
  200. {
  201. ClearRemapTable(ColorAdjustType.Default);
  202. }
  203. public void ClearRemapTable(ColorAdjustType type)
  204. {
  205. clrMap = null;
  206. clrAdjustType = type;
  207. }
  208. public void SetBrushRemapTable(ColorMap []map)
  209. {
  210. SetRemapTable(map, ColorAdjustType.Brush);
  211. }
  212. public void ClearBrushRemapTable()
  213. {
  214. ClearRemapTable(ColorAdjustType.Brush);
  215. }
  216. public void SetWrapMode(WrapMode mode)
  217. {
  218. SetWrapMode(mode, new Color(), false);
  219. }
  220. public void SetWrapMode(WrapMode mode, Color clr)
  221. {
  222. SetWrapMode(mode, clr, false);
  223. }
  224. public void SetWrapMode(WrapMode mode, Color clr, bool bClamp)
  225. {
  226. wrapMode = mode;
  227. col = clr;
  228. this.bClamp = bClamp;
  229. }
  230. public void GetAdjustedPalette(ColorPalette palette, ColorAdjustType type)
  231. {
  232. clrPalette = palette;
  233. clrAdjustType = type;
  234. }
  235. public ColorMatrix clrMatrix;
  236. public ColorMatrixFlag clrMatrixFlag;
  237. public ColorAdjustType clrAdjustType;
  238. public ColorMatrix gMatrix;
  239. public float thresh;
  240. public float gamma;
  241. public ColorChannelFlag clrChannelFlags;
  242. public string clrProfileFilename;
  243. public Color clrLow;
  244. public Color clrHigh;
  245. public ColorMap[] clrMap;
  246. public WrapMode wrapMode;
  247. public Color col;
  248. public bool bClamp;
  249. public ColorPalette clrPalette;
  250. public bool bNoOp;
  251. }
  252. }