| 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 |
|
| 16 |
/** |
| 17 |
* @fileoverview Represents a solid color fill goog.graphics. |
| 18 |
* @author [email protected] (Erik Arvidsson) |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
goog.provide('goog.graphics.SolidFill'); |
| 23 |
|
| 24 |
|
| 25 |
goog.require('goog.graphics.Fill'); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
/** |
| 30 |
* Creates an immutable solid color fill object. |
| 31 |
* |
| 32 |
* @param {string} color The color of the background. |
| 33 |
* @param {number=} opt_opacity The opacity of the background fill. The value |
| 34 |
* must be greater than or equal to zero (transparent) and less than or |
| 35 |
* equal to 1 (opaque). |
| 36 |
* @constructor |
| 37 |
* @extends {goog.graphics.Fill} |
| 38 |
* @deprecated goog.graphics is deprecated. It existed to abstract over browser |
| 39 |
* differences before the canvas tag was widely supported. See |
| 40 |
* http://en.wikipedia.org/wiki/Canvas_element for details. |
| 41 |
*/ |
| 42 |
goog.graphics.SolidFill = function(color, opt_opacity) { |
| 43 |
/** |
| 44 |
* The color with which to fill. |
| 45 |
* @type {string} |
| 46 |
* @private |
| 47 |
*/ |
| 48 |
this.color_ = color; |
| 49 |
|
| 50 |
|
| 51 |
/** |
| 52 |
* The opacity of the fill. |
| 53 |
* @type {number} |
| 54 |
* @private |
| 55 |
*/ |
| 56 |
this.opacity_ = opt_opacity == null ? 1.0 : opt_opacity; |
| 57 |
}; |
| 58 |
goog.inherits(goog.graphics.SolidFill, goog.graphics.Fill); |
| 59 |
|
| 60 |
|
| 61 |
/** |
| 62 |
* @return {string} The color of this fill. |
| 63 |
*/ |
| 64 |
goog.graphics.SolidFill.prototype.getColor = function() { |
| 65 |
return this.color_; |
| 66 |
}; |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* @return {number} The opacity of this fill. |
| 71 |
*/ |
| 72 |
goog.graphics.SolidFill.prototype.getOpacity = function() { |
| 73 |
return this.opacity_; |
| 74 |
}; |