- From: SVG Working Group Issue Tracker <sysbot+tracker@w3.org>
- Date: Thu, 15 May 2008 13:43:03 +0000 (GMT)
- To: public-svg-wg@w3.org
ISSUE-2002: Controlling the implicit viewBox of raster images used in the <image> element [SVG Full 1.2] http://www.w3.org/Graphics/SVG/WG/track/issues/ Raised by: Erik Dahlström On product: SVG Full 1.2 This is a summary of the thread here[1]. 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". This makes it difficult to cut out parts of raster images, such as an image that contains a number of sprite images [2]. Since this implicit viewbox can't be controlled you are forced to use other less intuitive methods (which are usually more expensive, but it may depend on the implementation) of getting the part of the raster image you want. E.g. clip, mask, pattern, clip-path to cut out a part of the image. Sub-issue #1: "specifying the source rectangle in raster image coordinatespace (i.e. in pixels)" ------------- There is a need for defining the source rectangle used for the rendering of an <image> element. The destination rectangle is defined by attributes {x,y,width,height} and the positioning within this rectangle is controllable through preserveAspectRatio and the (implicit or explicit) viewBox in the referenced image resource. If the implicit viewBox could be controlled for raster images then you would have full control over what part of the image was drawn. Sub-issue #2: "allowing percentages resolved relative to the native dimensions of a raster image" ------------- In some use-cases the size of the raster image is unknown, and in such situations it helps if it's possible to perform calculations based on the native dimensions of the raster image. While it is possible to do this using the 'clip' property, the 'clip' property works in user-space coordinates, not in the raster image coordinate-space (pixels), it doesn't support percentages (this is also a drawback of trying to use the viewBox property for this, if that was picked as a solution for sub-issue #1). Currently the situation is that you control the destination rectangle, but not the source rectangle for rendering an <image> element. [1] http://lists.w3.org/Archives/Public/www-svg/2008May/0011.html [2] http://www.otanistudio.com/swt/sprite_explosions/_i/exp2.png
Received on Thursday, 15 May 2008 13:44:55 UTC