W3C home > Mailing lists > Public > public-fx@w3.org > April to June 2011

Re: [css3-images] Defining SVG paint servers as a CSS <image>

From: Dean Jackson <dino@apple.com>
Date: Sat, 18 Jun 2011 16:37:53 -0700
Cc: public-fx@w3.org
Message-id: <578E6D2F-ABD0-48FA-8B6C-470B879CD1D8@apple.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
I like this!

Dean

On 17/06/2011, at 10:27 AM, Tab Atkins Jr. wrote:

> As the title states, I'd like to define SVG paint servers as a CSS
> <image> type.  They would be addressable via the url() function as
> normal, like "background: url(doc.svg#gradient1);".
> 
> I'm planning to follow the experimental work that Robert O'Callahan
> did in Firefox, as outlined in
> <http://weblogs.mozillazine.org/roc/archives/2008/07/svg_paint_serve.html>.
> Basically, the paint server is painted into the canvas in the obvious
> manner.  The only tricky bit is defining how the *Units attributes
> work, and I think roc got this right - "userSpaceOnUse" units will be
> CSS px, while an "objectBoundingBox" unit will be the size of the
> canvas.  For both, the origin of the coordinate space is the top left
> corner of the canvas.
> 
> This also suggests how to unify <image> and paint servers in the
> reverse direction - all CSS <image> types can become paint servers
> trivially now.  CSS-defined paint servers automatically work in
> userSpaceOnUse units, is all.
> 
> Theoretically, then, it should be acceptable to do this:
> 
> <rect fill="linear-gradient(90deg, red, green 25px, blue)" width="100"
> height="100" />
> 
> And it would work in the obvious way.  (You could also
> machine-translate linear-gradient() and radial-gradient() into
> <linearGradient> and <radialGradient>, as they're identical in
> functionality and only differ in syntax, but that's not possible for
> all <image> types.)
> 
> Anyone see any problems with this?  If not, I'll put the appropriate
> text for paint-server-as-<image> into Image Values.  What would be the
> appropriate location for <image>-as-paint-server?
> 
> ~TJ
> 
Received on Saturday, 18 June 2011 23:38:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 18 June 2011 23:38:33 GMT