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: Rik Cabanier <cabanier@gmail.com>
Date: Tue, 21 Jun 2011 12:19:04 -0700
Message-ID: <BANLkTimugGenQyLTojhu+001V8DT_nLKdA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: public-fx@w3.org
It would even be better if there was a way that you could refer to a SVG
symbol instead of a paint server.

We're working on converting Flash content to HTML+SVG and if the animation
is complex, we create many external SVG files.
The size of the SVG files is not a problem but having to do a http request
for each one causes a lot of overhead.

If we could refer to symbols, we could put all our content in 1 external
file which is much more efficient...

Rik


On Fri, Jun 17, 2011 at 10:27 AM, Tab Atkins Jr. <jackalmage@gmail.com>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 Tuesday, 21 June 2011 19:19:42 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 21 June 2011 19:19:43 GMT