ClassesClasses | | Operators

set_colorT_set_colorSetColorSetColor (Operator)

Name

set_colorT_set_colorSetColorSetColor — Set output color.

Signature

set_color( : : WindowHandle, Color : )

Herror T_set_color(const Htuple WindowHandle, const Htuple Color)

void SetColor(const HTuple& WindowHandle, const HTuple& Color)

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

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

void HWindow::SetColor(const char* Color) const

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

void HWindow.SetColor(HTuple color)

void HWindow.SetColor(string color)

Description

set_colorset_colorSetColorSetColorSetColor defines the colors for region output in the window. The available colors can be queried with the operator query_colorquery_colorQueryColorQueryColorQueryColor. In addition, the ColorColorColorColorcolor may be specified as hexadecimal RGB triplet or RGBA quadruplet in the form '#rrggbb'"#rrggbb""#rrggbb""#rrggbb""#rrggbb" and '#rrggbbaa'"#rrggbbaa""#rrggbbaa""#rrggbbaa""#rrggbbaa". 'rr', 'gg', 'bb', and 'aa' are hexadecimal numbers between '00' and 'ff', respectively. 'aa' denotes the alpha value of a color and can be used to display transparent regions.

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 transparent 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 they consist of more than one connected component.

The defined colors are used until set_colorset_colorSetColorSetColorSetColor, set_rgbset_rgbSetRgbSetRgbSetRgb, set_rgbaset_rgbaSetRgbaSetRgbaSetRgba, set_hsiset_hsiSetHsiSetHsiSetHsi or set_grayset_graySetGraySetGraySetGray is called again.

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

ColorColorColorColorcolor is used in operators with region output like disp_regiondisp_regionDispRegionDispRegionDispRegion, disp_linedisp_lineDispLineDispLineDispLine, disp_rectangle1disp_rectangle1DispRectangle1DispRectangle1DispRectangle1, or disp_arrowdisp_arrowDispArrowDispArrowDispArrow.

Color name 75% alpha 50% alpha 25% alpha 'black' '#000000c0' '#000000c0' '#00000080' '#00000080' '#00000040' '#00000040' 'white' '#ffffffc0' '#ffffffc0' '#ffffff80' '#ffffff80' '#ffffff40' '#ffffff40' 'red' '#ff0000c0' '#ff0000c0' '#ff000080' '#ff000080' '#ff000040' '#ff000040' 'green' '#00ff00c0' '#00ff00c0' '#00ff0080' '#00ff0080' '#00ff0040' '#00ff0040' 'blue' '#0000ffc0' '#0000ffc0' '#0000ff80' '#0000ff80' '#0000ff40' '#0000ff40' 'dim gray' '#696969c0' '#696969c0' '#69696980' '#69696980' '#69696940' '#69696940' 'gray' '#bebebec0' '#bebebec0' '#bebebe80' '#bebebe80' '#bebebe40' '#bebebe40' 'light gray' '#d3d3d3c0' '#d3d3d3c0' '#d3d3d380' '#d3d3d380' '#d3d3d340' '#d3d3d340' 'cyan' '#00ffffc0' '#00ffffc0' '#00ffff80' '#00ffff80' '#00ffff40' '#00ffff40' 'magenta' '#ff00ffc0' '#ff00ffc0' '#ff00ff80' '#ff00ff80' '#ff00ff40' '#ff00ff40' 'yellow' '#ffff00c0' '#ffff00c0' '#ffff0080' '#ffff0080' '#ffff0040' '#ffff0040' 'medium slate blue' '#7b68eec0' '#7b68eec0' '#7b68ee80' '#7b68ee80' '#7b68ee40' '#7b68ee40' 'coral' '#ff7f50c0' '#ff7f50c0' '#ff7f5080' '#ff7f5080' '#ff7f5040' '#ff7f5040' 'slate blue' '#6a5acdc0' '#6a5acdc0' '#6a5acd80' '#6a5acd80' '#6a5acd40' '#6a5acd40' 'spring green' '#00ff7fc0' '#00ff7fc0' '#00ff7f80' '#00ff7f80' '#00ff7f40' '#00ff7f40' 'orange red' '#ff4500c0' '#ff4500c0' '#ff450080' '#ff450080' '#ff450040' '#ff450040' 'dark olive green' '#556b2fc0' '#556b2fc0' '#556b2f80' '#556b2f80' '#556b2f40' '#556b2f40' 'pink' '#ffc0cbc0' '#ffc0cbc0' '#ffc0cb80' '#ffc0cb80' '#ffc0cb40' '#ffc0cb40' 'cadet blue' '#5f9ea0c0' '#5f9ea0c0' '#5f9ea080' '#5f9ea080' '#5f9ea040' '#5f9ea040' 'goldenrod' '#daa520c0' '#daa520c0' '#daa52080' '#daa52080' '#daa52040' '#daa52040' 'orange' '#ffa500c0' '#ffa500c0' '#ffa50080' '#ffa50080' '#ffa50040' '#ffa50040' 'gold' '#ffd700c0' '#ffd700c0' '#ffd70080' '#ffd70080' '#ffd70040' '#ffd70040' 'forest green' '#228b22c0' '#228b22c0' '#228b2280' '#228b2280' '#228b2240' '#228b2240' 'cornflower blue' '#6495edc0' '#6495edc0' '#6495ed80' '#6495ed80' '#6495ed40' '#6495ed40' 'navy' '#000080c0' '#000080c0' '#00008080' '#00008080' '#00008040' '#00008040' 'turquoise' '#40e0d0c0' '#40e0d0c0' '#40e0d080' '#40e0d080' '#40e0d040' '#40e0d040' 'dark slate blue' '#483d8bc0' '#483d8bc0' '#483d8b80' '#483d8b80' '#483d8b40' '#483d8b40' 'light blue' '#add8e6c0' '#add8e6c0' '#add8e680' '#add8e680' '#add8e640' '#add8e640' 'indian red' '#cd5c5cc0' '#cd5c5cc0' '#cd5c5c80' '#cd5c5c80' '#cd5c5c40' '#cd5c5c40' 'violet red' '#d02090c0' '#d02090c0' '#d0209080' '#d0209080' '#d0209040' '#d0209040' 'light steel blue' '#b0c4dec0' '#b0c4dec0' '#b0c4de80' '#b0c4de80' '#b0c4de40' '#b0c4de40' 'medium blue' '#0000cdc0' '#0000cdc0' '#0000cd80' '#0000cd80' '#0000cd40' '#0000cd40' 'khaki' '#f0e68cc0' '#f0e68cc0' '#f0e68c80' '#f0e68c80' '#f0e68c40' '#f0e68c40' 'violet' '#ee82eec0' '#ee82eec0' '#ee82ee80' '#ee82ee80' '#ee82ee40' '#ee82ee40' 'firebrick' '#b22222c0' '#b22222c0' '#b2222280' '#b2222280' '#b2222240' '#b2222240' 'midnight blue' '#191970c0' '#191970c0' '#19197080' '#19197080' '#19197040' '#19197040'
Examples of possible color strings

Execution Information

Parameters

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

ColorColorColorColorcolor (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (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", '#003075'"#003075""#003075""#003075""#003075", '#e53019'"#e53019""#e53019""#e53019""#e53019", '#ffb529'"#ffb529""#ffb529""#ffb529""#ffb529", '#f28d26bb'"#f28d26bb""#f28d26bb""#f28d26bb""#f28d26bb"

Example (HDevelop)

set_color(WindowHandle, ['red', '#00ff00a0'])
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', '#00ff00a0'])
disp_circle(WindowHandle, [100,200,300], [200,300,100], [100,100,100])

Example (HDevelop)

set_color(WindowHandle, ['red', '#00ff00a0'])
disp_circle(WindowHandle, [100,200,300], [200,300,100], [100,100,100])

Example (HDevelop)

set_color(WindowHandle, ['red', '#00ff00a0'])
disp_circle(WindowHandle, [100,200,300], [200,300,100], [100,100,100])

Result

set_colorset_colorSetColorSetColorSetColor 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_colorQueryColorQueryColorQueryColor

Possible Successors

disp_regiondisp_regionDispRegionDispRegionDispRegion

Alternatives

set_rgbset_rgbSetRgbSetRgbSetRgb, set_hsiset_hsiSetHsiSetHsiSetHsi

See also

get_rgbget_rgbGetRgbGetRgbGetRgb, disp_regiondisp_regionDispRegionDispRegionDispRegion, set_paintset_paintSetPaintSetPaintSetPaint

Module

Foundation


ClassesClasses | | Operators