drawLine
Top  Previous  Next

drawLine (integer Image, integer X1, integer Y1, integer X2, integer Y2
[, floating R, integer G =R, integer B =R, integer Width ] )  

Use this function to draw a straight-line segment on an image. Equivalent to using the Line Tool.

Parameters
 
Image  
 
An integer between 1 and 116 specifying the image frame number. Values in the range of 100-116 correspond to hidden frames.  
 
X1, Y1, X2, Y2  
 
Positive integers specifying the coordinates of the end points of the line in pixels.  
 
R  
 
An optional floating variable or constant specifying the color or intensity of the line. Depending on the type of the image, this parameter will be interpreted differently:  
 
Grayscale (8, 16, 32 bpp) or floating image
the intensity of the pixel
Palettized or multiphase image
the index in the image palette
RGB (16, 24, 32, 48 bpp) image
the red component of the pixel
Complex image
the first component of the pixel
 
 
Default value: established by setDrawColor.  
 
G  
 
An optional integer specifying the green component of line color for an image of an RGB type  
Default value: same as R  
 
B  
 
An optional integer specifying the blue component of the line color for an image of an RGB type. For any other image type this parameter is disregarded.  
Default value: same as R  
 
Width  
 
An optional integer between 0 and 100 specifying the width of the line in pixels.  
Default value: established by setPencil.  
 
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 16-bit grayscale image and draws a diagonal line with the intensity 40000.  
createIm (1, IM_GRAY16, 256, 256)  
drawLine (1, 0, 0, 255, 255, 40000)