replace. Replacing color in the area specified by coordinates table

^image.replace(old color;new color)[coordinates table]
^image.replace(old color;new color)

The method is used to replace one color with another within the area restricted by coordinates table. If the table is not specified, the color will be replaced in the whole image.

$paint_nodes[^table::create{x   y
10   20
90   20
90   80
10   80



Browser will display a black square, crossed diagonally with white lines, with a pink rectangle within it. Since method replace tells to replace with pink only black color, the lines will remain white.

Copyright © 1997–2017 Art. Lebedev Studio | Last updated: 25.02.2011