From ca3ad6305ec0655ad8475a12ac2228b61cdd9ba0 Mon Sep 17 00:00:00 2001 From: Lionel LASKE Date: Sat, 25 Aug 2012 20:23:36 +0000 Subject: Init commit --- (limited to 'html/lib/canvas/Image.js') 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 -- cgit v0.9.1