hyperlink - Raphael, copy image internally -


in raphael can load images in following manner:

var image_one=paper.image("some_url", x,y,width,height); 

but thing splicing image, , need several of cuts, preferably without reloading original image. because loading single large image via http faster many small. apparently there overhead in each upload can become quite substantial.

but anyways, how can make copy of raphael image, after has been loaded ram? have tried:

var image_two=image_one; 

but seems creating link image.

this kind of internal copying done via raphael's .clone(), simple this:

var newelem = oldelem.clone(); 

element.clone() works on elements including paths, images, rects, circles... but not sets.


here's simple demo - play around splicing desired.

http://jsbin.com/ufayuw/1/edit

if want clone hidden until needed, hide .hide()


Comments