From 5b3a1a32e7953cea61fa8b54777d424dbadea2b9 Mon Sep 17 00:00:00 2001 From: Callum Law Date: Tue, 14 Apr 2026 02:14:33 +1200 Subject: [PATCH] [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 --- filter-effects-1/Overview.bs | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/filter-effects-1/Overview.bs b/filter-effects-1/Overview.bs index 70ccd6fc64e..19a81fedd40 100644 --- a/filter-effects-1/Overview.bs +++ b/filter-effects-1/Overview.bs @@ -375,12 +375,10 @@ Unless defined otherwise, omitted values default to the initial value Note: For some filter functions the default value for omitted values differes from their initial value 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 initial value for interpolation is ''0'' (no effect).
- :
blur() = blur( <>? )
+ :
blur() = blur( <>? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''0px''. The initial value for interpolation is ''0px''. @@ -391,21 +389,17 @@ Note: For some filter functions the default value for omitted values differes fr 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:
((3 * sqrt(2 * π) / 4) * σ). - :
brightness() = brightness( [ <> |  <> ]? )
+ :
brightness() = brightness( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''1''. - :
contrast() = contrast( [ <> |  <> ]? )
+ :
contrast() = contrast( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''1''. @@ -424,12 +418,10 @@ Note: For some filter functions the default value for omitted values differes fr The [=ink overflow rectangle=] for a drop shadow is the extent of the offsets, plus the extent of the blur (if any) as described for ''blur()''. - :
grayscale() = grayscale( [ <> |  <> ]? )
+ :
grayscale() = grayscale( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''0''. @@ -443,42 +435,34 @@ Note: For some filter functions the default value for omitted values differes fr Default value when omitted is ''0deg''. The initial value for interpolation is ''0deg''. - :
invert() = invert( [ <> |  <> ]? )
+ :
invert() = invert( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''0''. - :
opacity() = opacity( [ <> |  <> ]? )
+ :
opacity() = opacity( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''1''. 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. - :
saturate() = saturate( [ <> |  <> ]? )
+ :
saturate() = saturate( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''1''. - :
sepia() = sepia( [ <> |  <> ]? )
+ :
sepia() = sepia( [ <> |  <> ]? )
:: 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 given below. - Negative values are not allowed. - Default value when omitted is ''1''. The initial value for interpolation is ''0''.