Skip to content

Commit 9fe272d

Browse files
committed
Actually commit the changes from last night, rewriting the image() section.
1 parent 0c0bf2e commit 9fe272d

1 file changed

Lines changed: 50 additions & 36 deletions

File tree

css3-images/Overview.src.html

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -197,48 +197,62 @@ <h3 id="url">
197197
<!-- ====================================================================== -->
198198

199199
<h3 id="image-notation">
200-
Image Fallbacks: the ''image()'' notation</h3>
201-
202-
<p>The ''image()'' notation allows an author to specify multiple images,
203-
each one a fallback for the previous. The UA must use only the first image
204-
that it can load and display. The syntax for ''image()'' is defined as
205-
206-
<pre class="prod"><dfn>&lt;image-list></dfn> =
207-
image( [ &lt;image-decl&gt; , ]* [ &lt;image-decl&gt; | &lt;color> | &lt;element-reference> | &lt;image-combination> | &lt;gradient> ] )</pre>
208-
209-
<p>where &lt;image-decl&gt; is given by
210-
211-
<pre class="prod"><dfn>&lt;image-decl></dfn> =
212-
[ &lt;string&gt; | &lt;url-token&gt; ] [ snap? &amp;&amp; &lt;resolution&gt; ]?</pre>
213-
214-
<p>&lt;url-token&gt; is given as <code>[!#$%&amp;*-~]|{nonascii}|{escape}</code>
215-
(i.e. the contents of ''url()'') using the productions in the
216-
<a href="http://www.w3.org/TR/CSS21/syndata.html#tokenization">CSS2.1 tokenization</a>.
217-
<strong>The &lt;url-token&gt; must not contain unescaped brackets, commas,
218-
white space characters, single quotes (&#39;) or double quotes (&quot;);
219-
if it does the ''image()'' containing it is invalid.</strong>
220-
221-
<p>Each string or url-token represents the URI of an image. If a resolution
222-
is given, then the image must be rendered at the specified resolution. If the
223-
''snap'' keyword is also specified, and the image is a raster image, then the
224-
image must be rendered at the resolution closest to the specified resolution
225-
that would result in no pixel rounding. <span class="issue">I don't think
226-
"no pixel rounding" is the right terminology here... basically we want to
227-
avoid blurry images.</span></p>
228-
229-
<p>The final argument may be a color or generated image, to serve as an
230-
ultimate fallback if none of the preceeding <i>&lt;image-decl></i>s can be used.
231-
If it is a color, the <i>&lt;image-list></i> must represent a single-color
232-
image of that color with no <i>intrinsic dimensions</i>.</p>
200+
Image Annotations: the ''image()'' notation</h3>
201+
202+
<p>The ''image()'' notation allows an author to tag an image with a few types
203+
of useful processing instructions which can affect the rendering of the image.
204+
The author can specify the desired resolution the image should be rendered at,
205+
declare the directionality of an image so that it can be automatically be
206+
reversed if used in text with a different directionality, or declare fallback
207+
images to be used if the original image can't be decoded or is a type that the
208+
browser doesn't recognize.</p>
209+
210+
<pre class='prod'><dfn>&lt;image-list></dfn> =
211+
image( [ &lt;image-decl> , ]* [ &lt;image-decl> | &lt;color> | &lt;image> ] )</pre>
212+
213+
<p>where &lt;image-decl> is given by:</p>
214+
215+
<pre class='prod'><dfn>&lt;image-decl></dfn> =
216+
[ &lt;string> | &lt;url> ] [ snap? && &lt;resolution> ]? [ ltr | rtl ]?
217+
218+
<p>Each <i>&lt;image-decl></i> represents an external image. If a &lt;string>
219+
is provided, it represents the same image that it would if the the string
220+
were given to the ''url()'' function.</p>
221+
222+
<p>If a &lt;resolution> is given, the image must be rendered at that resolution.
223+
<span class='note'>Recall that the default resolution of images is ''1dppx'',
224+
so that one image pixel corresponds to one CSS ''px'' unit.</span> If the
225+
''snap'' keyword is also specified, and the specified resolution would make
226+
one image pixel larger than one device pixel, the image must be rendered at
227+
the specified resolution, rounded to the nearest value that would map one image
228+
pixel to an integer number of device pixels; if the specified resolution would
229+
make one image pixel smaller than one device pixel, the image must be rendered
230+
at the specified resolution, rounded to the nearest value that would map an
231+
integer number of image pixels to one device pixel.</p>
232+
233+
<p>If a directional keyword (''ltr'' or ''rtl'') is given, the image itself
234+
gains that directionality. If the image is used in a property on an element
235+
with opposite directionality, is must be rendered horizontally flipped (in the
236+
image's own coordinate space).</p>
237+
238+
<p>Multiple arguments can be given, in which case the function represents
239+
the first &lt;image-decl> representing an image that the browser can successfully
240+
load and display. The final argument can be a &lt;color> or other type of
241+
&lt;image to serve as ultimate fallback if none of the preceding &lt;image-decl>s
242+
can be used. If the final argument is a &lt;color>, it represents a solid-color
243+
image of the given color with no <i>intrinsic dimensions</i>.
233244

234245
<div class="example">
235-
<p>For example, the rule below would tell the UA to load ''wavy.svg'' if
246+
<p>The rule below would tell the UA to load ''wavy.svg'' if
236247
it can; failing that to load ''wavy.png'' and display it at 150dpi;
237248
failing that to display ''wavy.gif''; and finally, if none of the images
238249
can be loaded and displayed, to use the color ''blue'' to create a
239-
dimensionless background image.</p>
250+
dimensionless background image. For example, the browser may not understand
251+
how to render SVG images, the PNG may be malformed, and the GIF may not
252+
exist on the server, so requesting it returns an HTML 404 page instead of
253+
an image.</p>
240254

241-
<pre>background-image: image(wavy.svg, 'wavy.png' 150dpi, "wavy.gif", blue);</pre>
255+
<pre>background-image: image(url(wavy.svg), 'wavy.png' 150dpi, "wavy.gif", blue);</pre>
242256

243257
<p>The 'background-image' property specifies that dimensionless images
244258
must stretch to cover the entire background positioning area

0 commit comments

Comments
 (0)