Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/lib/canvas/Image.js
blob: 018f2756e1554a9859204ff9ad89ad3b2e25a540 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
	Canvas control that draws an image, stretched to fit the rectangle specified
	by the _bounds_ property.
*/
enyo.kind({
	name: "enyo.canvas.Image",
	kind: enyo.canvas.Control,
	published: {
		//* Source URL for the image
		src: ""
	},
	//* @protected
	create: function() {
		this.image = new Image();
		this.inherited(arguments);
		this.srcChanged();
	},
	srcChanged: function() {
		if (this.src) {
			this.image.src = this.src;
		}
	},
	renderSelf: function(ctx) {
		ctx.drawImage(this.image, this.bounds.l, this.bounds.t);
	}
});