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).
|
WindowHandle (input_control) |
window -> HTuple.long |
| Window_id. | |
|
Color (input_control) |
string(-array) -> HTuple.char * |
| Output color names. | |
| Default value: 'white' | |
Htuple Colors, WindowHandleTuple ; create_tuple(Colors,2) ; set_s(Colors,"red",0) ; set_s(Colors,"green",1) ; create_tuple(&WindowHandleTuple,1) ; set_i(WindowHandleTuple, WindowHandle,0) ; T_set_color(WindowHandleTuple,Colors) ; disp_circle(WindowHandle,(double)100.0,(double)200.0,(double)100.0) ; disp_circle(WindowHandle,(double)200.0,(double)300.0,(double)100.0) ; disp_circle(WindowHandle,(double)300.0,(double)100.0,(double)100.0) ;
::set_color returns H_MSG_TRUE if the window is valid and the passed colors are displayable on the screen. Otherwise an exception handling is raised.
::get_rgb, ::disp_region, ::set_fix, ::set_paint
System