Am Mittwoch, 25. Juli 2007 schrieb Rob Desbois: > Yes, sorry I didn't phrase my post very well: there is a URL for the image, > of course, but I was trying to emphasise that there isn't a URL to an image > cached on the server's filesystem to pass back, as I don't want to > *permanently* cache the image (or implement a cleverer algorithm - there's > no need). > I simply want the cached image (or intermediates) to be temporary; the > user's session seems the obvious candidate for this type of storage to me.
var ctx = $('canvas')[0].getContext("2d"); var img = new Image(); img.onload = function() { ctx.drawImage(img,0,0); ctx.beginPath(); ctx.moveTo(30,96); ctx.lineTo(70,66); ctx.lineTo(103,76); ctx.lineTo(170,15); ctx.stroke(); // ... } img.src = "/basicImage.png"; I am pretty shure that this is what you are looking for. I have the code almost exactly from the first example of http://developer.mozilla.org/en/docs/Canvas_tutorial:Using_images The example should work in Firefox, Safari and Opera. For IE there is IECanvas (http://sourceforge.net/projects/iecanvas). If you really need to care about Konqueror, you can try to mimic the behaviour you need with data URLs. For a refference how this could look like, see PNGlets: http://www.elf.org/pnglets/ There is no really usefull Drawing solution on all Browsers. Changing data URLs lie PNGlet is slow and annoying and IECanvas is slow and can not handle many drawing primitives - it gets slower all the time. There was the possibility in IE 6 to use javascript URLs for images that return monochrome XBM images which could have been colored and combined with filters. Alas MS doesn't support XBM any more, so there is not evan a pita-way left. Christof