Skip to content

Commit

Permalink
[filter-effects] Use color value range between 0..1 consistently acro…
Browse files Browse the repository at this point in the history
…ss spec. Issue #192
  • Loading branch information
dirkschulze committed Dec 24, 2017
1 parent 1b8eb0a commit 537cfe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions filter-effects/Overview.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2547,9 +2547,9 @@ It is possible to create bandwidth-limited noise by synthesizing only one octave

The C code below shows the exact algorithm used for this filter effect. The <a>filter primitive subregion</a> is to be passed as the arguments fTileX, fTileY, fTileWidth and fTileHeight.

For fractalSum, you get a turbFunctionResult that is aimed at a range of -1 to 1 (the actual result might exceed this range in some cases). To convert to a color value, use the formula <code>colorValue = ((turbFunctionResult * 255) + 255) / 2</code>, then clamp to the range 0 to 255.
For fractalSum, you get a turbFunctionResult that is aimed at a range of -1 to 1 (the actual result might exceed this range in some cases). To convert to a color value, use the formula <code>colorValue = (turbFunctionResult + 1) / 2</code>, then clamp to the range 0 to 1.

For turbulence, you get a turbFunctionResult that is aimed at a range of 0 to 1 (the actual result might exceed this range in some cases). To convert to a color value, use the formula <code>colorValue = (turbFunctionResult * 255)</code>, then clamp to the range 0 to 255.
For turbulence, you get a turbFunctionResult that is aimed at a range of 0 to 1 (the actual result might exceed this range in some cases). To convert to a color value, use the formula <code>colorValue = turbFunctionResult</code>, then clamp to the range 0 to 1.

The following order is used for applying the pseudo random numbers. An initial seed value is computed based on the <a element-attr>seed</a> attribute. Then the implementation computes the lattice points for R, then continues getting additional pseudo random numbers relative to the last generated pseudo random number and computes the lattice points for G, and so on for B and A.

Expand Down

0 comments on commit 537cfe4

Please sign in to comment.