# Re: type of feFunc*

From: Tavmjong Bah <tavmjong@free.fr>
Date: Tue, 07 Dec 2010 11:34:40 +0100

Message-ID: <1291718080.1705.508.camel@LeChien>
```
Hello Olaf,

I have been tasked with responding to your email of 13 Jun 2010
concerning the definition of the attribute type for the elements feFunc*
defined in:

http://www.w3.org/TR/SVG11/filters.html#feComponentTransferTypeAttribute

(ISSUE-2338: http://www.w3.org/Graphics/SVG/WG/track/issues/2338 ).

My proposed rewording of this section follows. Please let me know if
this rewording is satisfactory (your original email is at the bottom).

Thanks,

Tav

==================================================

type = "identity | table | discrete | linear | gamma"

Indicates the type of component transfer function. The type of
function determines the applicability of the other attributes.

In the following, C is the initial component, C' is the remapped
component; both in the closed interval [0, 1].

* For identity:

C' = C

* For table, the function is defined by linear interpolation between
values given in the attribute ‘tableValues’.  The table has n+1
values (i.e., v_0 to v_n) specifying the start and end values for
n evenly sized interpolation regions. Interpolations use the
following formula:

For a value C < 1 find k such that:

k/n <= C < (k+1)/n

The result C' is given by:

C' = v_k + (C - k/n)*n * (v_k+1 - v_k)

If C = 1 then C' = v_n.

* For discrete, the function is defined by the step function defined
by attribute ‘tableValues’, which provides a list of n values (i.e.,
v0 to v_n-1) in order to identify a step function consisting of n
steps of the same width. The step function is defined by the
following formula:

For a value C < 1 find k such that:

k/n <= C < (k+1)/n

The result C' is given by:

C' = vk

If C = 1 then C' = v_n-1.

* For linear, the function is defined by the following linear equation:

C' = slope * C + intercept

* For gamma, the function is defined by the following exponential
function:

C' = amplitude * pow(C, exponent) + offset

==============================

Original email:

Hello www-svg,

within the definition of the attribute type for the elements feFunc*
http://www.w3.org/TR/SVG11/filters.html#feComponentTransferTypeAttribute
there seem to be some variables in the formulas undefined.

Is my interpretation correct, that C and C' correspond to the relative
channel value the subelement represents?
Between 0 and 1? Colors have to be transformed to this range?
C before, C' after transformation?
For example for feFuncR this means the relative value of the red
channel?

And what exactly is N?
My assumption is, that it is N = n. Is this correct?
At least the formulas for table and discrete look useful for
C from the interval [0;1)
For C = 1 the formulas have the problem,
that the v(n+1) for table does not exist and v(n) not for discrete.
k is one too large, there is a need to provide another formula for C=1
- something like: use formulas for [0;1) and v(n) for C=1 for table and
v(n-1) for C=1 for discrete.
For the table type this is only a formal problem, because (C-k/N) = 0
anyway, whatever v(n+1) might be; the result is C' = v(n).
Nevertheless the formula should not contain the undefined v(n+1).
For the discrete type C'=v(n) for C=1 resulting in k=N is a problem,
because the v(i) are defined in such a way, that the last value is
v(n-1).

Best wishes

Olaf
```
Received on Tuesday, 7 December 2010 10:35:21 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:23 UTC