setDrawColor
Top  Previous  Next

setDrawColor ( integer Image, floating R [ integer G =R, integer B =R ] )

Use this function to set a current draw color for an image. The draw color is used by the
drawPencil, drawBrush, drawLine, drawArrow, drawRect, drawEllipse, and drawText functions.

Parameters
 
Image  
 
An integer between 1 and 99 specifying the image frame number.  
 
R  
 
A floating variable or constant specifying the intensity of the draw color or the value of or its first component. Depending on the type of the active image, this parameter will be interpreted differently:  
 
Grayscale (8, 16, 32 bpp) or floating image
the intensity of the gray color
Palettized or multiphase image
the index in the image palette
RGB (16, 24, 32, 48 bpp) image
the red component of the color
Complex image
the active component of the complex intensity
 
 
G  
 
An optional integer specifying the green component of the draw color for an image of an RGB type.  
Default value: same as R  
 
B  
 
An optional integer specifying the blue component of the draw color for an image of an RGB type.  
Default value: same as R  
 
Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  
 
Example

The following set of statements creates a blank RGB image, sets the draw color to yellow and applies a brush to the center of the image:  
 
createIm (1, IM_RGB, 256, 256)  
setDrawColor(1,255,255,0)  
drawBrush (1,128,128)  
 
Remark

if the type of the active image changes, ImageWarp can modify the current draw color. In order to keep the specified color, do not change the active image frame while working with drawing functions.