HALCON Reference Manual 10.0.2
Table of Contents / Graphics / Parameters ClassesClassesClasses | | | Operators

set_colorset_colorset_colorSetColorSetColor (Operator)

Name

set_colorset_colorset_colorSetColorSetColor — Set output color.

Signature

set_color( : : WindowHandle, Color : )

Herror set_color(const Hlong WindowHandle, const char* Color)

Herror T_set_color(const Htuple WindowHandle, const Htuple Color)

Herror set_color(const HTuple& WindowHandle, const HTuple& Color)

void HWindow::SetColor(const HTuple& Color) const

void HOperatorSetX.SetColor(
[in] VARIANT WindowHandle, [in] VARIANT Color)

void HWindowX.SetColor([in] VARIANT Color)

static void HOperatorSet.SetColor(HTuple windowHandle, HTuple color)

void HWindow.SetColor(HTuple color)

void HWindow.SetColor(string color)

Description

set_colorset_colorset_colorSetColorSetColor defines the colors for region output in the window. The available colors can be queried with the operator query_colorquery_colorquery_colorQueryColorQueryColor. 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 operator set_system(::'graphic_colors',...:)set_system("graphic_colors",...)set_system("graphic_colors",...)SetSystem("graphic_colors",...)SetSystem("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 operator 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_colorset_colorset_colorSetColorSetColor, set_pixelset_pixelset_pixelSetPixelSetPixel, set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi or set_grayset_grayset_graySetGraySetGray is called again.

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

ColorColorColorColorcolor is used in operators with region output like disp_regiondisp_regiondisp_regionDispRegionDispRegion, disp_linedisp_linedisp_lineDispLineDispLine, disp_rectangle1disp_rectangle1disp_rectangle1DispRectangle1DispRectangle1, disp_arrowdisp_arrowdisp_arrowDispArrowDispArrow etc. It is also used by operators with gray value output in certain output modes (e.g. '3d_plot_lines','histogram', 'contourline', etc. See set_paintset_paintset_paintSetPaintSetPaint).

Parallelization

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

Window_id.

ColorColorColorColorcolor (input_control)  string(-array) HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Output color names.

Default value: 'white' "white" "white" "white" "white"

Suggested values: 'black'"black""black""black""black", 'white'"white""white""white""white", 'red'"red""red""red""red", 'green'"green""green""green""green", 'blue'"blue""blue""blue""blue", 'cyan'"cyan""cyan""cyan""cyan", 'magenta'"magenta""magenta""magenta""magenta", 'yellow'"yellow""yellow""yellow""yellow", 'dim gray'"dim gray""dim gray""dim gray""dim gray", 'gray'"gray""gray""gray""gray", 'light gray'"light gray""light gray""light gray""light gray", 'medium slate blue'"medium slate blue""medium slate blue""medium slate blue""medium slate blue", 'coral'"coral""coral""coral""coral", 'slate blue'"slate blue""slate blue""slate blue""slate blue", 'spring green'"spring green""spring green""spring green""spring green", 'orange red'"orange red""orange red""orange red""orange red", 'orange'"orange""orange""orange""orange", 'dark olive green'"dark olive green""dark olive green""dark olive green""dark olive green", 'pink'"pink""pink""pink""pink", 'cadet blue'"cadet blue""cadet blue""cadet blue""cadet blue"

Example (HDevelop)

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

Example (C)

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) ;

Example (HDevelop)

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

Example (HDevelop)

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

Example (HDevelop)

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

Result

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

Possible Predecessors

query_colorquery_colorquery_colorQueryColorQueryColor

Possible Successors

disp_regiondisp_regiondisp_regionDispRegionDispRegion

Alternatives

set_rgbset_rgbset_rgbSetRgbSetRgb, set_hsiset_hsiset_hsiSetHsiSetHsi

See also

get_rgbget_rgbget_rgbGetRgbGetRgb, disp_regiondisp_regiondisp_regionDispRegionDispRegion, set_fixset_fixset_fixSetFixSetFix, set_paintset_paintset_paintSetPaintSetPaint

Module

Foundation


Table of Contents / Graphics / Parameters ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH