Source-image offset/dimensions control for the image element

Hello www-svg,

I'm wondering if there's interest in being able to control the offset,  
width and height of a raster image to draw in the <image> element, to be  
able to select exactly what part of the raster image to draw.

Something similar to CSS background-position [1], which allows you to pick  
an arbitrary (x,y) offset of an image. This is often used to collect many  
sprites in one image, to be able to load multiple resources as one.

In SVG it's only possible to use the 'preserveAspectRatio' attribute to  
control the position for raster images. The 1.1 spec says that when an  
<image> element references a raster image the implicit 'viewBox' has a  
value of "0 0 raster-image-width raster-image-height". If there was a way  
of controlling the implicit viewBox it would be possible to draw raster  
sprites more efficiently.

It is possible to control all of this in SVG, using for example the clip,  
mask or pattern features. However, each of these comes at the price of  
additional processing, since they are meant to cover more advanced  
use-cases as well.

Thoughts?

Cheers
/Erik

[1] http://www.w3.org/TR/CSS21/colors.html#background-properties
[2] http://www.w3.org/TR/SVG11/struct.html#ImageElement

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Wednesday, 7 May 2008 08:22:00 UTC