Product manual

rgbMap(width, height, rgb, step)
This function is the actual brains of the script. It produces two-dimensional arrays whose size
MUST be height times width. I.e. the array returned from this function must contain height items
and each of these items must be an array that contains width items that must be 32bit integers,
representing an RGB color as understood by QRgb without alpha channel (0x00RRGGBB). The
rgb parameter is an integer-representation of the color selected by user in the RGB Matrix Editor.
The step parameter tells the step number requested by the RGB Matrix function and is
guaranteed to be within (0, rgbMapStepCount(w, h) - 1).
Parameters:
width: The width of the grid
height: The height of the grid
rgb: The color selected by user
step: Current step number to produce (between 0 and rgbMapStepCount(w, h) - 1)
Return value: An array containing [height] arrays each containing [width] integers
Just like the previous function, we also add this other one to the script. Now we have a full and
ready template for any RGB script for your indulgence.
(
function() {
var algo = new Object;
algo.apiVersion = 1;
algo.name = "My cool RGB script";
algo.author = "Your name";
algo.rgbMapStepCount = function(width, height) {
...
return number_of_steps_when_width_is_oranges_and_height_is_jabberwock;
}
algo.rgbMap = function(width, height, rgb, step) {
...
return a_2d_array_of_arrays;
}
return algo;
}
)()
Development Tool
There is a development tool available in the QLC+ source repository that makes it easier to
debug & test your custom scripts with a web browser. To use the tool, you must download the
following two files to a directory on your hard disk, open the devtool.html file with your browser
and follow its instructions:
devtool.html
devtool.js
(Right-click and "Copy Link Location" works probably best)
Page 41