solidfill.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 solid color fill goog.graphics.
  16. * @author arv@google.com (Erik Arvidsson)
  17. */
  18. goog.provide('goog.graphics.SolidFill');
  19. goog.require('goog.graphics.Fill');
  20. /**
  21. * Creates an immutable solid color fill object.
  22. *
  23. * @param {string} color The color of the background.
  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. * @extends {goog.graphics.Fill}
  29. * @deprecated goog.graphics is deprecated. It existed to abstract over browser
  30. * differences before the canvas tag was widely supported. See
  31. * http://en.wikipedia.org/wiki/Canvas_element for details.
  32. */
  33. goog.graphics.SolidFill = function(color, opt_opacity) {
  34. /**
  35. * The color with which to fill.
  36. * @type {string}
  37. * @private
  38. */
  39. this.color_ = color;
  40. /**
  41. * The opacity of the fill.
  42. * @type {number}
  43. * @private
  44. */
  45. this.opacity_ = opt_opacity == null ? 1.0 : opt_opacity;
  46. };
  47. goog.inherits(goog.graphics.SolidFill, goog.graphics.Fill);
  48. /**
  49. * @return {string} The color of this fill.
  50. */
  51. goog.graphics.SolidFill.prototype.getColor = function() {
  52. return this.color_;
  53. };
  54. /**
  55. * @return {number} The opacity of this fill.
  56. */
  57. goog.graphics.SolidFill.prototype.getOpacity = function() {
  58. return this.opacity_;
  59. };