Skip to content

Commit 5b3a1a3

Browse files
committed
[filter-effects-1] Represent invalidity of negative values in filter function arguments in grammar
Doing this in the grammar rather than the prose makes it clearer
1 parent f1db79e commit 5b3a1a3

1 file changed

Lines changed: 8 additions & 24 deletions

File tree

filter-effects-1/Overview.bs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,10 @@ Unless defined otherwise, omitted values default to the <a for=svg>initial value
375375
Note: For some filter functions the default value for omitted values differes from their <a for=svg>initial value</a> for interpolation. For the convenience of content creators, the default value for omitted values for ''grayscale()'', ''sepia()'' and ''invert()'' is ''1'' (apply the effect to 100%) while the <a for=svg>initial value</a> for interpolation is ''0'' (no effect).
376376

377377
<dl id="FilterFunction" dfn-for="filter">
378-
: <pre class=prod><dfn>blur()</dfn> = blur( <<length>>? )</pre>
378+
: <pre class=prod><dfn>blur()</dfn> = blur( <<length [0,∞]>>? )</pre>
379379
::
380380
Applies a Gaussian blur to the input image. The passed parameter defines the value of the standard deviation to the Gaussian function. The parameter is specified a CSS length, but does not accept percentage values. The markup equivalent of this function is <a href="#blurEquivalent">given below</a>.
381381

382-
Negative values are not allowed.
383-
384382
Default value when omitted is ''0px''.
385383

386384
The <a for=svg>initial value</a> for interpolation is ''0px''.
@@ -391,21 +389,17 @@ Note: For some filter functions the default value for omitted values differes fr
391389

392390
Note: A true Gaussian blur has theoretically infinite extent, but in practice all implementations use a finite-area approximation of a Gaussian blur. At the time of writing (January 2024) all major implementations use the familiar three-pass box blur approximation, which has extent:<br> <code>((3 * sqrt(2 * &pi;) / 4) * &sigma;)</code>.
393391

394-
: <pre class=prod><dfn>brightness()</dfn> = brightness( [ <<number>> | <<percentage>> ]? )</pre>
392+
: <pre class=prod><dfn>brightness()</dfn> = brightness( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
395393
::
396394
Applies a linear multiplier to input image, making it appear more or less bright. A value of ''0%'' will create an image that is completely black. A value of ''100%'' leaves the input unchanged. Other values are linear multipliers on the effect. Values of amount over 100% are allowed, providing brighter results. The markup equivalent of this function is <a href="#brightnessEquivalent">given below</a>.
397395

398-
Negative values are not allowed.
399-
400396
Default value when omitted is ''1''.
401397

402398
The <a for=svg>initial value</a> for interpolation is ''1''.
403-
: <pre class=prod><dfn>contrast()</dfn> = contrast( [ <<number>> | <<percentage>> ]? )</pre>
399+
: <pre class=prod><dfn>contrast()</dfn> = contrast( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
404400
::
405401
Adjusts the contrast of the input. A value of ''0%'' will create an image that is completely gray. A value of ''100%'' leaves the input unchanged. Values of amount over 100% are allowed, providing results with more contrast. The markup equivalent of this function is <a href="#contrastEquivalent">given below</a>.
406402

407-
Negative values are not allowed.
408-
409403
Default value when omitted is ''1''.
410404

411405
The <a for=svg>initial value</a> for interpolation is ''1''.
@@ -424,12 +418,10 @@ Note: For some filter functions the default value for omitted values differes fr
424418
The [=ink overflow rectangle=] for a drop shadow is the extent of the offsets,
425419
plus the extent of the blur (if any) as described for ''blur()''.
426420

427-
: <pre class=prod><dfn>grayscale()</dfn> = grayscale( [ <<number>> | <<percentage>> ]? )</pre>
421+
: <pre class=prod><dfn>grayscale()</dfn> = grayscale( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
428422
::
429423
Converts the input image to grayscale. The passed parameter defines the proportion of the conversion. A value of ''100%'' is completely grayscale. A value of ''0%'' leaves the input unchanged. Values between ''0%'' and ''100%'' are linear multipliers on the effect. Values of amount over ''100%'' are allowed but UAs must clamp the values to ''1''. The markup equivalent of this function is <a href="#grayscaleEquivalent">given below</a>.
430424

431-
Negative values are not allowed.
432-
433425
Default value when omitted is ''1''.
434426

435427
The <a for=svg>initial value</a> for interpolation is ''0''.
@@ -443,42 +435,34 @@ Note: For some filter functions the default value for omitted values differes fr
443435
Default value when omitted is ''0deg''.
444436

445437
The <a for=svg>initial value</a> for interpolation is ''0deg''.
446-
: <pre class=prod><dfn>invert()</dfn> = invert( [ <<number>> | <<percentage>> ]? )</pre>
438+
: <pre class=prod><dfn>invert()</dfn> = invert( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
447439
::
448440
Inverts the samples in the input image. The passed parameter defines the proportion of the conversion. A value of 100% is completely inverted. A value of ''0%'' leaves the input unchanged. Values between ''0%'' and ''100%'' are linear multipliers on the effect. Values of amount over ''100%'' are allowed but UAs must clamp the values to ''1''. The markup equivalent of this function is <a href="#invertEquivalent">given below</a>.
449441

450-
Negative values are not allowed.
451-
452442
Default value when omitted is ''1''.
453443

454444
The <a for=svg>initial value</a> for interpolation is ''0''.
455-
: <pre class=prod><dfn>opacity()</dfn> = opacity( [ <<number>> | <<percentage>> ]? )</pre>
445+
: <pre class=prod><dfn>opacity()</dfn> = opacity( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
456446
::
457447
Applies transparency to the samples in the input image. The passed parameter defines the proportion of the conversion. A value of ''0%'' is completely transparent. A value of ''100%'' leaves the input unchanged. Values between ''0%'' and ''100%'' are linear multipliers on the effect. This is equivalent to multiplying the input image samples by amount. Values of amount over ''100%'' are allowed but UAs must clamp the values to ''1''. The markup equivalent of this function is <a href="#opacityEquivalent">given below</a>.
458448

459-
Negative values are not allowed.
460-
461449
Default value when omitted is ''1''.
462450

463451
The <a for=svg>initial value</a> for interpolation is ''1''.
464452

465453
Note: The opacity filter function is not meant to be a shorthand of the 'opacity' property. Furthermore, it allows setting the transparency of intermediate filter primitive results before passing to the next filter primitive. If the opacity filter function is set as last filter primitive, the value of the 'opacity' property is multiplied on top of the value of the filter function, which may result in a more transparent content.
466454

467-
: <pre class=prod><dfn>saturate()</dfn> = saturate( [ <<number>> | <<percentage>> ]? )</pre>
455+
: <pre class=prod><dfn>saturate()</dfn> = saturate( [ <<number [0,∞]>> | <<percentage [0,∞]>> ]? )</pre>
468456
::
469457
Saturates the input image. The passed parameter defines the proportion of the conversion. A value of ''0%'' is completely un-saturated. A value of ''100%'' leaves the input unchanged. Other values are linear multipliers on the effect. Values of amount over ''100%'' are allowed, providing super-saturated results. The markup equivalent of this function is <a href="#saturateEquivalent">given below</a>.
470458

471-
Negative values are not allowed.
472-
473459
Default value when omitted is ''1''.
474460

475461
The <a for=svg>initial value</a> for interpolation is ''1''.
476-
: <pre class=prod><dfn>sepia()</dfn> = sepia( [ <<number>> | <<percentage>> ]? )</pre>
462+
: <pre class=prod><dfn>sepia()</dfn> = sepia( [ <<number [0]>> | <<percentage>> ]? )</pre>
477463
::
478464
Converts the input image to sepia. The passed parameter defines the proportion of the conversion. A value of ''100%'' is completely sepia. A value of ''0%'' leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. Values of amount over ''100%'' are allowed but UAs must clamp the values to ''1''. The markup equivalent of this function is <a href="#sepiaEquivalent">given below</a>.
479465

480-
Negative values are not allowed.
481-
482466
Default value when omitted is ''1''.
483467

484468
The <a for=svg>initial value</a> for interpolation is ''0''.

0 commit comments

Comments
 (0)