Sha256: 842118d740de53f78a833d730cc80414e62356df9d044ccdc0dd50105592ea08

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 Bytes

Contents

/*
The image component draws an image on screen.


FUTURE - add bitdata component for image manipulation.
*/
re.c('image')
.requires('draw')
.defines({
	
	image:function(b){
    if(re.is(b)){
      this.attr({_image:b, sizeX:b.width, sizeY:b.height});
  		return this;
    }
    return this._image;
	},
	
	visible:function(){
		return this._image && this.parent('draw', 'visible');
	},
	
	draw:function(c){
		c.drawImage(this._image, -this.regX, -this.regY, this.sizeX, this.sizeY);
		return this;
	}
	
})
.init(function(){
	
	if(this._image){
		this.image(this._image);
	}
	
});

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
entityjs-0.3.2 src/display/image.js
entityjs-0.3.1 src/display/image.js
entityjs-0.3.0 src/display/image.js