set_color ( : : WindowHandle, Color : )

Set output color.

set_color defines the colors for region output in the window. The available colors can be queried with the procedure query_color. The "colors" 'black' and 'white' are available for all screens. If colors are used that are not displayable on the screen, HALCON can choose a similar, displayable color of the output. For this, set_check(::'~color':) must be called. Furthermore, the list of available colors can be set with the procedure set_system(::'graphic_colors',...:). That must be done before opening the first output window. If only a single color is passed, all output is in this color. If a tuple of colors is passed, the output color of regions is modulo to the number of colors. In the example below, the first circle is displayed red, the second in green and the third in red again. HALCON always begins output with the first color passed. Note, that the number of output colors depends on the number of objects that are displayed in one procedure call. If only single objects are displayed, they always appear in the first color, even if the consist of more than one connected components.

The defined colors are used until set_color, set_pixel, set_rgb, set_hsi or set_gray is called again.

Colors are defined seperately for each window. They can only be changed for the valid window.

Color is used in procedures with region output like disp_region, disp_line, disp_rectangle1, disp_arrow etc. It is also used by procedures with grayvalue output in certain output modes (e.g. '3D-plot','histogram', 'contourline', etc. See set_paint).


Parameters

WindowHandle (input_control)
window -> integer
Window_id.

Color (input_control)
string(-array) -> string
Output color names.
Default value: 'white'
Suggested values: ''black'', ''white'', ''red'', ''green'', ''blue'', ''cyan'', ''magenta'', ''yellow'', ''dim gray'', ''gray'', ''light gray'', ''medium slate blue'', ''coral'', ''slate blue'', ''spring green'', ''orange red'', ''orange'', ''dark olive green'', ''pink'', ''cadet blue''


Example
set_color(WindowHandle,['red','green']) 
disp_circle(WindowHandle,[100,200,300],[200,300,100],[100,100,100]).

Result

set_color returns 2 (H_MSG_TRUE) if the window is valid and the passed colors are displayable on the screen. Otherwise an exception handling is raised.


Parallelization Information

set_color is reentrant, local, and processed without parallelization.


Possible Predecessors

query_color


Possible Successors

disp_region


Alternatives

set_rgb, set_hsi


See also

get_rgb, disp_region, set_fix, set_paint


Module

Foundation



Copyright © 1996-2008 MVTec Software GmbH