/usr/share/doc/sludge/SLUDGEDevKitHelp/setBackgroundEffect.html is in sludge-doc 2.2.1-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<TITLE>setBackgroundEffect and doBackgroundEffect</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<BODY>
<HR>
<div align="center"><img id="headerGraphic" src="images/sludge300.png" alt="SLUDGE"/></div>
<h2>setBackgroundEffect and doBackgroundEffect</h2>
<HR>
<H3>Syntax:</H3>
<P>
<pre class="syntax">setBackgroundEffect (<i>add, divide, array [, array...]</i>);</pre>
</P>
<P>
<pre class="syntax">doBackgroundEffect ();</pre>
</P>
<H3>Purpose:</H3>
<P>
The setBlankColour function is used to specify an effect which can be applied to the background image. The doBackgroundEffect function applies the current effect to the background. The parameters for the function are an <i>add</i> value, a <i>divide</i> value and one or more arrays (which you can think of as a matrix, should you wish). When an effect is applied, the following procedure happens for each pixel: SLUDGE adds up the colour values of each pixel and its surrounding pixels, weighted using the arrays you've specified. For example, if you specified one array, containing just the value 1, it would get the original red, green and blue values of that pixel. If you specified one array, containing the values 1 three times, it would get red, green and blue totals equivalent to the red, green and blue values of the pixel itself, plus the red, green and blue values of the pixels either side. These values are then divided by the <i>divide</i> value and finally the <i>add</i> value is added to each. These red, green and blue values are then used as the new colour for the pixel (clamped to the range 0 to 255). So to get an average of each pixel and it's left-hand and right-hand neighbours, you could say setBackgroundEffect (0, 3, newStack (1, 1, 1)). If multiple arrays are specified, these are used to also add the red, green and blue values from pixels the line above or below the pixel having its colour changed.
</P>
<H3>Return value:</H3>
<P>
No return values.
</P>
<H3>Example:</H3>
<P>
<pre># Exactly the same as darkBackground - sets each pixel to half its current red, green and blue values
setBackgroundEffect (0, 2, newStack (1));
# Negative - sets each pixel to 255 minus its current red, green and blue values
setBackgroundEffect (255, 1, newStack (-1));
# Double vision - each pixel becomes the average of two pixels 13 pixels apart
setBackgroundEffect (0, 2, newStack (1,0,0,0,0,0,0,0,0,0,0,0,1));
# Soften - take a weighted average of pixels surrounding each pixel
setBackgroundEffect (0, 14, newStack (1,2,1), newStack (2,2,2), newStack (1,2,1));
# Brighten
setBackgroundEffect (10, 7, newStack (8));
# Emboss
setBackgroundEffect (128, 2, newStack (1,0), newStack(0,-1));
# Colour emboss
setBackgroundEffect (32, 2, newStack (1,0,0), newStack (0,2,0), newStack(0,0,-2));</pre>
</P>
<H3>See also:</H3>
<P>
<a href="The_Background_Image.html">The Background Image</a>
</P>
<P>
<a href="darkBackground.html">darkBackground</a>
</P>
<P class="copyright-notice">SLUDGE and this SLUDGE documentation are <A HREF="Copyright.html">copyright</A> Hungry Software and contributors 2000-2012
</P>
<HR>
</BODY>
</html>
|