1 
  2 /**
  3  * 示例:
  4  * <pre>
  5  * var bmp = new Hilo.Bitmap({image:imgElem, rect:[0, 0, 100, 100]});
  6  * stage.addChild(bmp);
  7  * </pre>
  8  * @class Bitmap类表示位图图像类。
  9  * @augments View
 10  * @param {Object} properties 创建对象的属性参数。可包含此类所有可写属性。此外还包括:
 11  * <ul>
 12  * <li><b>image</b> - 位图所在的图像image。必需。</li>
 13  * <li><b>rect</b> - 位图在图像image中矩形区域。</li>
 14  * </ul>
 15  * @module hilo/view/Bitmap
 16  * @requires hilo/core/Hilo
 17  * @requires hilo/core/Class
 18  * @requires hilo/view/View
 19  * @requires hilo/view/Drawable
 20  */
 21  var Bitmap = Class.create(/** @lends Bitmap.prototype */{
 22     Extends: View,
 23     constructor: function Bitmap(properties){
 24         properties = properties || {};
 25         this.id = this.id || properties.id || Hilo.getUid("Bitmap");
 26         Bitmap.superclass.constructor.call(this, properties);
 27         
 28         this.drawable = new Drawable(properties);
 29 
 30         //init width and height
 31         if(!this.width || !this.height){
 32             var rect = this.drawable.rect;
 33             if(rect){
 34                 this.width = rect[2];
 35                 this.height = rect[3];
 36             }
 37         }
 38     }
 39  });