Path: blob/trunk/third_party/closure/goog/graphics/ext/image.js
2868 views
// Copyright 2007 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.131415/**16* @fileoverview A thick wrapper around images.17* @author [email protected] (Robby Walker)18*/192021goog.provide('goog.graphics.ext.Image');2223goog.require('goog.graphics.ext.Element');24252627/**28* Wrapper for a graphics image element.29* @param {goog.graphics.ext.Group} group Parent for this element.30* @param {string} src The path to the image to display.31* @constructor32* @extends {goog.graphics.ext.Element}33* @final34*/35goog.graphics.ext.Image = function(group, src) {36// Initialize with some stock values.37var wrapper = group.getGraphicsImplementation().drawImage(380, 0, 1, 1, src, group.getWrapper());39goog.graphics.ext.Element.call(this, group, wrapper);40};41goog.inherits(goog.graphics.ext.Image, goog.graphics.ext.Element);424344/**45* Redraw the image. Called when the coordinate system is changed.46* @protected47* @override48*/49goog.graphics.ext.Image.prototype.redraw = function() {50goog.graphics.ext.Image.superClass_.redraw.call(this);5152// Our position is already handled bu transform_.53this.getWrapper().setSize(this.getWidth(), this.getHeight());54};555657/**58* Update the source of the image.59* @param {string} src Source of the image.60*/61goog.graphics.ext.Image.prototype.setSource = function(src) {62this.getWrapper().setSource(src);63};646566