Product manual
With this in mind we add declarations for these three properties to the script:
(
function() {
var algo = new Object;
algo.apiVersion = 1; // Must be currently '1'
algo.name = "My cool RGB script";
algo.author = "Your name";
return algo;
}
)()
Functions
Now we are getting to the actual business of producing data for the RGB Matrix. The current API
version uses two functions to achieve this:
rgbMapStepCount(width, height)
rgbMap(width, height, rgb, step)
No assumptions on the calling order or argument immutability should be made, i.e. do not cache
the values from either function and assume that they are valid until the worlds end. The
parameters might change at any point (usually when the user changes the matrix size, color or
direction) thus invalidating any cached values.
rgbMapStepCount(width, height)
When QLC+ calls this function, it wants to know the number of different RGB maps returned by
the rgbMap() function, when the RGB matrix size is width times height pixels. It must always
return the same result when called with the same width and height parameters again and the
result must not change over time.
Parameters:
width: The width of the grid
height: The height of the grid
Return value: Number of steps produced by rgbMap() with the given width and height
parameters
So, now we add this support function to the script:
(
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_jabberwocky;
}
return algo;
}
)()
Page 40










