Re: SVG as Widget Icon

Hi Doug,

2009/1/31 Doug Schepers <schepers@w3.org>:
>
> Hi, Jere-
>
> Jere Kapyaho wrote (on 1/30/09 3:31 AM):
>>
>> (And if there is any animation, just use the first rendered frame.)
>
> Declarative animations should be allowed, assuming the UA supports them.
>
> FWIW, SVG doesn't use frames, it uses timeline-based animation.  That's
> not to say that it couldn't be rendered as "frames", but that's not the
> inherent model.
>
>
>> If so, the widget engine
>> needs to pass an icon size in pixels to the SVG engine -- it could be the
>> 'width' and 'height' attributes of the 'icon' element, except that those
>> values are not necessarily what the widget engine would use. The icon needs
>> to adapt to the engine and its UI, not the other way around.
>>
>> Curiously, the spec states in the description of those attributes (section
>> 7.9) [1] that they are "only applicable to graphic formats that have no
>> intrinsic width or height (e.g., SVG)". But an SVG image may specify a size
>> with the width and height attributes in the root element [2]. What is
>> supposed to happen if you have 'width' and 'height' in both?
>
> If you specify fixed width and height in the SVG root, then that icon
> should be rendered with that fixed size.  Whenever you want to have a
> scalable SVG image (I know, sounds redundant), you need to specify the
> relative dimensions in the viewBox, with percentage values in the width
> and height.  For example, this is a fixed-size SVG:
>
> <svg xmlns="http://www.w3.org/2000/svg"
>     width="50px" height="50px">
>  <rect x="1" y="1" width="48" height="48" rx="5" ry="5" fill="red" />
>  <circle cx="25" cy="25" r="20" fill="orange" />
> </svg>
>
> and here is the resizable equivalent:
>
> <svg xmlns="http://www.w3.org/2000/svg"
>     width="100%" height="100%" viewBox="0 0 50 50">
>  <rect x="1" y="1" width="48" height="48" rx="5" ry="5" fill="red" />
>  <circle cx="25" cy="25" r="20" fill="orange" />
> </svg>
>
> If you supply, in the widget manifest, a width and height to the first
> one, if it doesn't match those dimensions (let's say it's width="30"
> height="20"), then it should only show a portion of the icon (if the
> native icon dimensions are smaller), or it should show space around the
> unused part of the image.  By contrast, if you pass dimensions to the
> second icon, it will scale to match the available space, as defined in
> the SVG specification.

The proposed behavior sounds good. I've temporarily added your
paragraph above to the spec until I get around to specifying that
behavior properly. Again, I don't know SVG very well so I will need
your help making sure I get the wording right.

I might also take screenshots that demo what you describe above.

Thanks again for your help, Doug.

Kind regards,
Marcos
-- 
Marcos Caceres
http://datadriven.com.au

Received on Thursday, 12 February 2009 14:07:30 UTC