The library "color.s7i" contains the following declarations:
const type: color is new struct
var integer: red_part is 0;
var integer: green_part is 0;
var integer: blue_part is 0;
const func color: (in color: col1) + (in color: col2) is func
var color: sum is color.value;
sum.red_part := (col1.red_part + col2.red_part) div 2;
sum.green_part := (col1.green_part + col2.green_part) div 2;
sum.blue_part := (col1.blue_part + col2.blue_part) div 2;
The type color is declared as
struct with three elements.
The three integer elements describe the intensities of the primary
colors red, green and blue used in the RGB additive color model.
Additionally the + operator is defined to do additive mixing of two colors.
The syntax of the + operator is defined in the library "syntax.s7i" as:
$ syntax expr: .(). + .() is -> 7;
A totally new operator symbol, such as 'additiveMixing', could be used instead of +.
In this case the syntax of 'additiveMixing' would be:
$ syntax expr: .(). additiveMixing .() is -> 7;
Memory for color objects is managed automatically without garbage collection.
Additionally it is not necessary to call constructors to initialize color objects.