1919
2020 < h1 > CSS Image Values and Replaced Content Module Level 3</ h1 >
2121
22- < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 8 December
22+ < h2 class ="no-num no-toc " id =longstatus-date > Editor's Draft 14 December
2323 2010</ h2 >
2424
2525 < dl >
2626 < dt > This version:</ dt >
27- <!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101208 /">http://www.w3.org/TR/2010/CR-css3-images-20101208 /</a></dd> -->
27+ <!-- <dd><a href="http://www.w3.org/TR/2010/CR-css3-images-20101214 /">http://www.w3.org/TR/2010/CR-css3-images-20101214 /</a></dd> -->
2828
2929 < dd > < a
3030 href ="http://dev.w3.org/csswg/css3-images/ "> http://dev.w3.org/csswg/css3-images/</ a >
@@ -147,7 +147,10 @@ <h2 class="no-num no-toc" id=contents>Table of contents</h2>
147147 < li > < a href ="#radial-gradients "> < span class =secno > 5.2. </ span > Radial
148148 Gradients</ a >
149149
150- < li > < a href ="#color-stop-syntax "> < span class =secno > 5.3.
150+ < li > < a href ="#repeating-gradients "> < span class =secno > 5.3.
151+ </ span > Repeating Gradients</ a >
152+
153+ < li > < a href ="#color-stop-syntax "> < span class =secno > 5.4.
151154 </ span > < code > color-stop</ code > Syntax</ a >
152155 </ ul >
153156
@@ -560,7 +563,7 @@ <h2 id=gradients><span class=secno>5. </span>Gradients</h2>
560563 href ="#ltgradient "> < code > <gradient> </ code > </ a > is:</ p >
561564
562565 < pre
563- class =prod > < dfn id =ltgradient > <gradient> </ dfn > = [ <linear-gradient> | <radial-gradient> ]</ pre >
566+ class =prod > < dfn id =ltgradient > <gradient> </ dfn > = [ <linear-gradient> | <radial-gradient> | <repeating-linear-gradient > | <repeating-radial-gradient > ]</ pre >
564567
565568 < p > where < a
566569 href ="#ltlinear-gradient "> < code > <linear-gradient> </ code > </ a > and < a
@@ -921,31 +924,75 @@ <h4 class=no-toc id=radial-gradient-examples><span class=secno>5.2.2.
921924 < p > < img alt ="" src =radial7.png > </ p >
922925 </ div >
923926 </ div >
924- <!-- Removed for lack of a use-case; we'll just leave it as a vendor-prefix for now.
925- <div>
926- <h3>Repeating Gradients</h3>
927-
928- <p>In addition to the <code>linear-gradient()</code> and <code>radial-gradient()</code> functions, this specification defines <code>repeating-linear-gradient()</code> and <code>repeating-radial-gradient()</code> functions. These two functions take the same values and are interpreted the same as their respective non-repeating siblings defined previously. However, the color-stops are repeated infinitely in both directions, with their positions shifted by multiples of the difference between the last color-stop's position and the first color-stop's position. For example, <code>repeating-linear-gradient(red 10px, blue 50px)</code> is equivalent to <code>linear-gradient(..., red -30px, blue 10px, red 10px, blue 50px, red 50px, blue 90px, ...)</code>. Note that the last color-stop and first color-stop will always coincide at the boundaries of each group, which may produce sharp transitions if the gradient does not start and end with the same color.</p>
929-
930- <div class=example>
931- <p>Repeating gradient syntax is basically identical to that of non-repeating gradients:</p>
932-
933- <pre><code>repeating-linear-gradient(red, blue 20px, red 40px)</code></pre>
934- <p><img src="repeating1.png" alt=""></p>
935-
936- <pre><code>repeating-radial-gradient(red, blue 20px, red 40px)</code></pre>
937- <p><img src="repeating2.png" alt=""></p>
938-
939- <pre><code>repeating-radial-gradient(20px 30px, circle contain, red, yellow, green 100%, yellow 150%, red 200%)</code></pre>
940- <p><img src="repeating3.png" alt=""></p>
941- </div>
942-
943- <p>If the difference in the first and last color-stops is 0 (for example, in the rule <code>linear-gradient(red 10px, blue 10px)</code>), the gradient defines a solid-color image with the color of the last color-stop in the rule (in this case, then, it would simply define a blue image).</p>
944- </div>
945- -->
946-
927+
947928 < div >
948- < h3 id =color-stop-syntax > < span class =secno > 5.3.
929+ < h3 id =repeating-gradients > < span class =secno > 5.3. </ span > Repeating
930+ Gradients</ h3 >
931+
932+ < p > In addition to the ‘< code
933+ class =css > linear-gradient()</ code > ’ and ‘< code
934+ class =css > radial-gradient()</ code > ’ functions, this specification
935+ defines ‘< code class =css > repeating-linear-gradient()</ code > ’
936+ and ‘< code class =css > repeating-radial-gradient()</ code > ’
937+ functions. These two functions take the same values and are interpreted
938+ the same as their respective non-repeating siblings defined previously:</ p >
939+
940+ < pre
941+ class =prod > < code > < dfn id =ltrepeating-linear-gradient > <repeating-linear-gradient> </ dfn > = repeating-linear-gradient(
942+ [
943+ [ [top | bottom] || [left | right] ]
944+ ||
945+ <angle>
946+ ,]?
947+ <color-stop>[, <color-stop>]+
948+ )
949+ < dfn id =ltrepeating-radial-gradient > <repeating-radial-gradient> </ dfn > = repeating-radial-gradient(
950+ [<bg-position>,]?
951+ [
952+ [<shape> || <size>]
953+ |
954+ [<length> | <percentage> ]{2}
955+ ,]?
956+ <color-stop>[, <color-stop>]+
957+ )</ code > </ pre >
958+
959+ < p > When rendered, however, the color-stops are repeated infinitely in
960+ both directions, with their positions shifted by multiples of the
961+ difference between the last specified color-stop's position and the
962+ first specified color-stop's position. For example, ‘< code
963+ class =css > repeating-linear-gradient(red 10px, blue 50px)</ code > ’
964+ is equivalent to ‘< code class =css > linear-gradient(..., red -30px,
965+ blue 10px, red 10px, blue 50px, red 50px, blue 90px, ...)</ code > ’.
966+ Note that the last color-stop and first color-stop will always coincide
967+ at the boundaries of each group, which may produce sharp transitions if
968+ the gradient does not start and end with the same color.</ p >
969+
970+ < div class =example >
971+ < p > Repeating gradient syntax is basically identical to that of
972+ non-repeating gradients:</ p >
973+
974+ < pre > < code > repeating-linear-gradient(red, blue 20px, red 40px)</ code > </ pre >
975+
976+ < p > < img alt ="" src =repeating1.png > </ p >
977+
978+ < pre > < code > repeating-radial-gradient(red, blue 20px, red 40px)</ code > </ pre >
979+
980+ < p > < img alt ="" src =repeating2.png > </ p >
981+
982+ < pre > < code > repeating-radial-gradient(20px 30px, circle contain, red, yellow, green 100%, yellow 150%, red 200%)</ code > </ pre >
983+
984+ < p > < img alt ="" src =repeating3.png > </ p >
985+ </ div >
986+
987+ < p > If the difference in the first and last color-stops is 0 (for example,
988+ in the value ‘< code class =css > linear-gradient(red 10px, blue
989+ 10px)</ code > ’), the gradient defines a solid-color image with the
990+ color of the last color-stop in the rule (in this case, then, it would
991+ simply define a blue image).</ p >
992+ </ div >
993+
994+ < div >
995+ < h3 id =color-stop-syntax > < span class =secno > 5.4.
949996 </ span > < code > color-stop</ code > Syntax</ h3 >
950997
951998 < p > The < dfn id =ltcolor-stopgt > < code > <color-stop></ code > </ dfn > is
@@ -1004,6 +1051,24 @@ <h3 id=color-stop-syntax><span class=secno>5.3.
10041051 area is at least 200px tall. If it was 150px tall, however, the blue
10051052 color-stop's position would be equivalent to "75px", which precedes the
10061053 yellow color-stop, and would be corrected to a position of 100px.</ p >
1054+
1055+ < p class =note > The definition and implications of "premultiplied" color
1056+ spaces are given elsewhere in the technical literature, but a quick
1057+ primer is given here to illuminate the process. Given a color expressed
1058+ as an rgba() 4-tuple, one can convert this to a premultiplied
1059+ representation by multiplying the red, green, and blue components by the
1060+ alpha component. For example, a partially-transparent blue may be given
1061+ as rgba(0,0,255,.5), which would then be expressed as (0,0,127.5,.5) in
1062+ its premultiplied representation. Note that fully opaque colors have the
1063+ same representation in rgba and premultiplied-rgba (you multiply the
1064+ components by 1), and all fully transparent colors are expressed the
1065+ same way in the premultiplied representation (you multiply each
1066+ component by 0, so no matter what the source color was in rgba, the
1067+ premultiplied representation is (0,0,0,0)). Interpolating colors using
1068+ the premultiplied representations rather than the plain rgba
1069+ representations tends to produce more attractive transitions,
1070+ particularly when transitioning from a fully opaque color to fully
1071+ transparent.</ p >
10071072 </ div >
10081073 </ div >
10091074
@@ -1041,8 +1106,8 @@ <h2 id=sizing><span class=secno>6. </span>Sizing Images and Objects in CSS</h2>
10411106 < p > If an object (such as an icon) has multiple sizes, then the largest
10421107 size is used. If it has multiple aspect ratios of that size (or of no
10431108 size), then the aspect ratio closest to the aspect ratio of the default
1044- image sizing area is use < span class =issue > This is pretty
1045- arbitrary</ span > .
1109+ image sizing area is used. < span class =issue > This is pretty
1110+ arbitrary. </ span >
10461111
10471112 < dt > < dfn id =specified-size > specified size</ dfn >
10481113
@@ -1064,12 +1129,17 @@ <h2 id=sizing><span class=secno>6. </span>Sizing Images and Objects in CSS</h2>
10641129 and width used to determine the size of the CSS View Box when both the
10651130 intrinsic dimensions and specified size are missing dimensions. It
10661131 varies based on the property that the image is being used as a value in.
1067- For < code > background-image</ code > , the default image sizing area is the
1068- size of the background positioning area of the element. For
1069- < code > list-style-image</ code > , the default image sizing area is a 1em
1070- square. For < code > list-style-image</ code > , the default image sizing area
1071- is the size of the border box of the element. In any other context, the
1072- default image sizing area is a rectangle 300px wide and 150px tall.
1132+ For ‘< code class =property > background-image</ code > ’, the
1133+ default image sizing area is the size of the background positioning area
1134+ of the element. For ‘< code
1135+ class =property > list-style-image</ code > ’, the default image sizing
1136+ area is a 1em square. For ‘< code
1137+ class =property > list-style-image</ code > ’, the default image sizing
1138+ area is the size of the border box of the element. For ‘< code
1139+ class =property > cursor</ code > ’, the default image sizing area is a
1140+ UA-defined rectangle that should be based on the size of a typical
1141+ cursor on the UA's operating system. In any other context, the default
1142+ image sizing area is a rectangle 300px wide and 150px tall.
10731143 </ dl >
10741144
10751145 < p > Images and objects in CSS are sized as follows:</ p >
@@ -1867,6 +1937,28 @@ <h3 id=serializing-gradients><span class=secno>7.6. </span>Serializing
18671937 < li > Append a close parenthesis ")" to s.
18681938 </ ol >
18691939
1940+ < p > To serialize a ‘< a href ="#ltrepeating-linear-gradient "> < code
1941+ class =css > <repeating-linear-gradient> </ code > </ a > ’:</ p >
1942+
1943+ < ol >
1944+ < li > Append "repeating-linear-gradient(" to s.
1945+
1946+ < li > Follow the steps for serializing a ‘< a
1947+ href ="#ltlinear-gradient "> < code
1948+ class =css > <linear-gradient> </ code > </ a > ’, except skip step 1.
1949+ </ ol >
1950+
1951+ < p > To serialize a ‘< a href ="#ltrepeating-radial-gradient "> < code
1952+ class =css > <repeating-radial-gradient> </ code > </ a > ’:</ p >
1953+
1954+ < ol >
1955+ < li > Append "repeating-radial-gradient(" to s.
1956+
1957+ < li > Follow the steps for serializing a ‘< a
1958+ href ="#ltradial-gradient "> < code
1959+ class =css > <radial-gradient> </ code > </ a > ’, except skip step 1.
1960+ </ ol >
1961+
18701962 < p > To serialize a ‘< a href ="#ltcolor-stop "> < code
18711963 class =css > <color-stop> </ code > </ a > ’:</ p >
18721964
@@ -1970,13 +2062,18 @@ <h3 id=interpolating-gradients><span class=secno>8.2.
19702062 interpolated:</ p >
19712063
19722064 < ol >
1973- < li > Both the starting and ending gradient must be of the same type;
1974- either both linear gradients or both radial gradients.
2065+ < li > Both the starting and ending gradient must be expressed with the
2066+ same function. (For example, you can transition from a
2067+ linear-gradient() to a linear-gradient(), but not from a
2068+ linear-gradient() to a radial-gradient() or a
2069+ repeating-linear-gradient().)
19752070
19762071 < li > Both the starting and ending gradient must have the same number of
1977- color-stops. (Remember, you can always pad a gradient with additional
1978- color-stops placed atop each other if you need to play with the number
1979- of color-stops.)
2072+ color-stops. For this purpose, a repeating gradient is considered to
2073+ have infinite color-stops, and thus all repeating gradients have the
2074+ same number of color-stops. (Note that one may pad a gradient with
2075+ additional color-stops placed atop each other, if necessary to make
2076+ two gradients have the same number of color-stops.)
19802077 </ ol >
19812078
19822079 < p > If the two gradients satisfy both of those constraints, they must be
@@ -1993,8 +2090,11 @@ <h3 id=interpolating-gradients><span class=secno>8.2.
19932090
19942091 < li > To interpolate a color-stop, first match each color-stop in the
19952092 start gradient to the corresponding color-stop at the same index in
1996- the end gradient. Then, for each pair of color-stops, interpolate the
1997- position and color independently.
2093+ the end gradient. For repeating gradients, the first specified
2094+ color-stop in the start and end gradients are considered to be at the
2095+ same index, and all other color-stops following and preceding are
2096+ indexed appropriately. Then, for each pair of color-stops, interpolate
2097+ the position and color independently.
19982098 </ ol >
19992099 </ div >
20002100 </ div >
0 commit comments