- From: Ken Stacey <ken@svgmaker.com>
- Date: Tue, 13 May 2008 01:04:00 +1000
- To: www-svg@w3.org
> 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.
or by using the svg viewBox in the example below.
Not sure of the cost.
<svg >
...
<svg width="400" height="300"
viewBox="80 0 80 60" overflow="hidden">
<image width="160" height="120"
preserveAspectRatio="xMinYMin" xlink:href="sprites.jpg"/>
</svg>
...
</svg>
Ken Stacey
On 7/05/2008 6:19 PM, Erik Dahlström wrote:
>
> 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
>
Received on Monday, 12 May 2008 15:04:39 UTC