1
0
Fork 0

Add Image to Canvas API

This commit is contained in:
James Turner 2012-08-05 22:43:43 +01:00
parent c3bcb8a6de
commit 15e0e0d7c7

View file

@ -701,12 +701,34 @@ var Path = {
} }
}; };
# Image
# ==============================================================================
# Class for an image element on a canvas
#
var Image = {
new: func(parent, id)
{
var m = {
parents: [Image, Element.new(parent, "image", id, arg)]
};
m.color = _createColorNodes(m._node, "color");
m.sourceRect = m._node.getNode("source", 1);
return m;
},
setFile: func(file)
{
me.set("file", file);
}
};
# Element factories used by #Group elements to create children # Element factories used by #Group elements to create children
Group._element_factories = { Group._element_factories = {
"group": Group.new, "group": Group.new,
"map": Map.new, "map": Map.new,
"text": Text.new, "text": Text.new,
"path": Path.new "path": Path.new,
"image": Image.new
}; };
# Canvas # Canvas