imageelement.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 A thin wrapper around the DOM element for images.
  16. */
  17. goog.provide('goog.graphics.ImageElement');
  18. goog.require('goog.graphics.Element');
  19. /**
  20. * Interface for a graphics image element.
  21. * You should not construct objects from this constructor. Instead,
  22. * you should use {@code goog.graphics.Graphics.drawImage} and it
  23. * will return an implementation of this interface for you.
  24. *
  25. * @param {Element} element The DOM element to wrap.
  26. * @param {goog.graphics.AbstractGraphics} graphics The graphics creating
  27. * this element.
  28. * @constructor
  29. * @extends {goog.graphics.Element}
  30. * @deprecated goog.graphics is deprecated. It existed to abstract over browser
  31. * differences before the canvas tag was widely supported. See
  32. * http://en.wikipedia.org/wiki/Canvas_element for details.
  33. */
  34. goog.graphics.ImageElement = function(element, graphics) {
  35. goog.graphics.Element.call(this, element, graphics);
  36. };
  37. goog.inherits(goog.graphics.ImageElement, goog.graphics.Element);
  38. /**
  39. * Update the position of the image.
  40. *
  41. * @param {number} x X coordinate (left).
  42. * @param {number} y Y coordinate (top).
  43. */
  44. goog.graphics.ImageElement.prototype.setPosition = goog.abstractMethod;
  45. /**
  46. * Update the size of the image.
  47. *
  48. * @param {number} width Width of image.
  49. * @param {number} height Height of image.
  50. */
  51. goog.graphics.ImageElement.prototype.setSize = goog.abstractMethod;
  52. /**
  53. * Update the source of the image.
  54. * @param {string} src Source of the image.
  55. */
  56. goog.graphics.ImageElement.prototype.setSource = goog.abstractMethod;