Helma logo
helma.org » Home > Stories > Image.setColor()

Image.setColor()

Sets the color for current drawing actions.

Syntax
imageObject.setColor(colorNumber)
imageObject.setColor(redNumber, greenNumber, blueNumber)

The colorNumber argument is represented by a 24-bit integer (0–16777215), the redNumber, greenNumber and blueNumber arguments build an RGB tuple with each element ranging from 0 to 255.

Example
var img = new Image("http://helma.org/images/original.jpg");
res.write('<img src="/images/original.jpg">');

A picture showing two funny people

img.setColor(16777215);
img.fillRect(80, 50, 30, 30);
img.setColor(255, 255, 0);
img.fillRect(65, 15, 30, 30);
img.saveAs("/www/images/processed.jpg");
res.write('<img src="/images/processed.jpg">');

A picture ornamented with some clumsy rectangles


... comment


Page last modified on 2002-07-16 17:17 by tobi