stroke.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. // Copyright 2007 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview Represents a stroke object for goog.graphics.
  16. * @author arv@google.com (Erik Arvidsson)
  17. */
  18. goog.provide('goog.graphics.Stroke');
  19. /**
  20. * Creates an immutable stroke object.
  21. *
  22. * @param {number|string} width The width of the stroke.
  23. * @param {string} color The color of the stroke.
  24. * @param {number=} opt_opacity The opacity of the background fill. The value
  25. * must be greater than or equal to zero (transparent) and less than or
  26. * equal to 1 (opaque).
  27. * @constructor
  28. * @deprecated goog.graphics is deprecated. It existed to abstract over browser
  29. * differences before the canvas tag was widely supported. See
  30. * http://en.wikipedia.org/wiki/Canvas_element for details.
  31. */
  32. goog.graphics.Stroke = function(width, color, opt_opacity) {
  33. /**
  34. * The width of the stroke.
  35. * @type {number|string}
  36. * @private
  37. */
  38. this.width_ = width;
  39. /**
  40. * The color with which to fill.
  41. * @type {string}
  42. * @private
  43. */
  44. this.color_ = color;
  45. /**
  46. * The opacity of the fill.
  47. * @type {number}
  48. * @private
  49. */
  50. this.opacity_ = opt_opacity == null ? 1.0 : opt_opacity;
  51. };
  52. /**
  53. * @return {number|string} The width of this stroke.
  54. */
  55. goog.graphics.Stroke.prototype.getWidth = function() {
  56. return this.width_;
  57. };
  58. /**
  59. * @return {string} The color of this stroke.
  60. */
  61. goog.graphics.Stroke.prototype.getColor = function() {
  62. return this.color_;
  63. };
  64. /**
  65. * @return {number} The opacity of this fill.
  66. */
  67. goog.graphics.Stroke.prototype.getOpacity = function() {
  68. return this.opacity_;
  69. };