函数:
int = imaqDrawLineOnImage(Image* dest, const Image* source, DrawMode mode, Point start, Point end, float newPixelValue)
参数:
dest:输出图像
source:输入图像
DrawMode mode:该函数用于绘制直线的方法。可以为 IMAQ_DRAW_VALUE 或 IMAQ_DRAW_INVERT 。
start:线的起点坐标
end:线的终点坐标
newPixelValue:如果将 mode 设置为 IMAQ_DRAW_VALUE ,则 newPixelValue 设置函数绘制直线时的像素值。如果设置 mode 为 IMAQ_DRAW_INVERT ,该函数将忽略此参数。
DrawMode:
typedef enum DrawMode_enum { IMAQ_DRAW_VALUE = 0, // Draws the boundary of the object with the specified pixel value. IMAQ_DRAW_INVERT = 2, // Inverts the pixel values of the boundary of the object. IMAQ_PAINT_VALUE = 1, // Fills the object with the given pixel value. IMAQ_PAINT_INVERT = 3, // Inverts the pixel values of the object. IMAQ_HIGHLIGHT_VALUE = 4, // The function fills the object by highlighting the enclosed pixels with the color of the object. IMAQ_DRAW_MODE_SIZE_GUARD = 0xFFFFFFFF } DrawMode;
作用:
在图片中的指定位置划线。
示例:
startPoint.x = leftMargin[h][w]; startPoint.y = topMargin[h][w]; endPoint.x = leftMargin[h][w]; endPoint.y = bottomMargin[h][w]; imaqDrawLineOnImage(srcImage, srcImage, IMAQ_DRAW_VALUE, startPoint, endPoint, 0.0);