Download RV Manual - Tweak Software
Transcript
CHAPTER 1. OVERVIEW
}
Listing 1.1: Example Use of Environment Variables
Its also possible to open a process stream to an external program and read its output. This example calls
the unix ls command on a file (or directory) that is passed into the function and returns the output as a
string. On windows you would need to use an appropriate command path and arguments for that platform.
This example is fairly advanced:
\: get_ls_output (string; string file_to_ls)
{
use io; // this is where the streams live
let cmd = process("/bin/ls", ["-al", file_to_ls], int64.max);
istream lsout = cmd.out();
cmd.close_in();
osstream result; // osstream is an output string stream
while (true)
{
let line = read_line(lsout, ’\n’);
if (line == "") break;
print(result, "%s\n" % line);
}
cmd.close();
return string(result);
}
Listing 1.2: Example Use of Process Stream
1.5
Setting and Getting the Image Processing Graph State
The UI needs to communicate with the core part of RV. This is done in two ways: by calling special command
functions (commands) which act directly on the core (e.g. play() causes it to start playing), or by setting
variables in the underlying image processing graph which control how images will be rendered.
Inside each session there is a directed acyclic graph (DAG) which determines how images and audio will
be evaluated for display. The DAG is composed of nodes which are themselves collections of properties.
A node is something that produces images and/or audio as output from images and audio inputs (or
no inputs in some cases). An example from RV is the color node; the color node takes images as input
and produces images that are copies of the input images with the hue, saturation, exposure, and contrast
potentially changed.
A property is a state variable. The node’s properties as a whole determine how the node will change its
inputs to produce its outputs. You can think of a node’s properties as parameters that change its behavior.
RV’s session file format (.rv file) stores all of the nodes associated with a session including each node’s
properties. So the DAG contains the complete state of an RV session. When you load an .rv file into RV,
you create a new DAG based on the contents of the file. Therefore, to change anything in RV that affects
how an image looks, you must change a property in some node in its DAG.
There are a few commands which RV provides to get and set properties: setIntProperty(), getIntProperty(),
setFloatProperty(), getFloatProperty(), setStringProperty(), and getStringProperty().
Finally, there is one last thing to know about properties: they are arrays of values. So a property may
contain zero values (its empty) or one value or an array of values. The get and set functions above all deal
with arrays of numbers even when a property only has a single value.
5