Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/html/lib/canvas/Image.js
diff options
context:
space:
mode:
Diffstat (limited to 'html/lib/canvas/Image.js')
-rw-r--r--html/lib/canvas/Image.js26
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