This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26299 - Add a "9-slice element" in the next version of the SVG specifications
Summary: Add a "9-slice element" in the next version of the SVG specifications
Status: NEW
Alias: None
Product: SVG
Classification: Unclassified
Component: Basic Data Types (show other bugs)
Version: SVG 2.0
Hardware: All All
: P2 enhancement
Target Milestone: Test Suite
Assignee: Doug Schepers
QA Contact: SVG Public List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-09 19:18 UTC by Emanuele Sabetta
Modified: 2014-07-10 06:28 UTC (History)
2 users (show)

See Also:


Attachments
9-slice graphic element contraints (29.88 KB, image/png)
2014-07-09 19:18 UTC, Emanuele Sabetta
Details

Description Emanuele Sabetta 2014-07-09 19:18:32 UTC
Created attachment 1492 [details]
9-slice graphic element contraints

The 9-slice scaling grid has been around in desktop graphics software for some years already and is well known to users of Flash and Illustrator. It's a brilliant technique for scaling images by dividing them into sections that have a fixed size (the corners) and sections that are flexible (the edges and the center). In fact this method is so powerful that 9-slice elements are standard classes in most development platforms (Android, Flash, Flex, etc). A similar technique (9-tiles or 9-grid) is used in HTML pages and native 9 sliced images are exported by graphic software like Photoshop.
The only platform missing 9-slice elements is the SVG one. This means that to create a 9-slice svg element we currently need to use convoluted techniques that are quite complicated to implement, like this popular one devised by Dirk Weber:

http://w3.eleqtriq.com/2014/03/the-holy-grail-of-image-scaling/

Because of this you cannot even make a resizeable button (a very common web page element) with SVG without resorting to tricks.

To solve this problem affecting all web designers I propose to add a "9-slice element" in the next version of the SVG specifications. It will be a special group element, with some simple transformation constraints applied to any 9 elements composing the group.

Thank you.
Comment 1 Dirk Schulze 2014-07-09 21:41:52 UTC
CSS has border-image which allows 9-sliced images that can also be used together with SVG images. Especially for your use case of scalable buttons this seems to be the ideal solution:

http://www.w3.org/TR/css3-background/#border-images
Comment 2 Robert Longson 2014-07-10 06:28:51 UTC
There's also CSS flexbox: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes or http://dev.w3.org/csswg/css-flexbox/ which may already meet your needs and which is pretty much cross browser these days.