Re: Proposal: layered CSS background (SVG, png)

On Thursday 22 April 2010 18:59:53 Kristaps Karlsons wrote:
> Hi, list.
>
> I have a proposal for further CSS (4?) development. I'll try to keep
> it short as possible.
> Please, keep in mind that (almost) no SVG background support is
> available right now, so this idea would should be actualised only on
> full SVG background support, or layered png support.
>
> Lets's take a SVG file whitch has 3 groups: group1, group2, group3.
>
> For example, we would like to show only group1 on our declared
> element:

SVG indeed allows multiple "views" (as they are called in SVG) in a 
single file. But it already defines itself how to display them 
individually. You do that by adding a fragment ID:

    background: url(example.svg#group1)

See, e.g., section 14.3.2 in SVG Tiny 1.2:
http://www.w3.org/TR/2008/REC-SVGTiny12-20081222/linking.html#LinksIntoSVG

That is a better approach than defining handling for specific formats in 
CSS. Any image format (or indeed any other type of resource) that 
defines multiple resources in a single file should also define the URL 
syntax that accesses those resources.

PNG files don't contain multiple images, as far as I know, but its 
sister format MNG does, and it indeed follows this approach. It 
specifies how to use fragment identifiers to display a frame from a 
multi-frame MNG file. See http://www.libpng.org/pub/mng/spec/#URL


The possibilities don't stop there. W3C also has an index of complex 
fragment IDs for XML-based formats, where "complex" means: more than 
just an identifier. They are called "XPointer schemes."

SVG is XML-based and is listed there, but MNG, as a binary format, is 
not. SVG in fact allows extra transformations to be specified after 
the "#". See http://www.w3.org/2005/04/xpointer-schemes/



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Friday, 23 April 2010 16:24:30 UTC