diff options
author | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
---|---|---|
committer | Lionel LASKE <llaske@c2s.fr> | 2012-08-25 20:23:36 (GMT) |
commit | ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 (patch) | |
tree | 7ef2b853640f99807fba7fd3f2a28bda81727297 /html/lib/canvas/Image.js |
Init commit
Diffstat (limited to 'html/lib/canvas/Image.js')
-rw-r--r-- | html/lib/canvas/Image.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/html/lib/canvas/Image.js b/html/lib/canvas/Image.js new file mode 100644 index 0000000..018f275 --- /dev/null +++ b/html/lib/canvas/Image.js @@ -0,0 +1,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); + } +});
\ No newline at end of file |