set_colorT_set_colorSetColorSetColorset_color (算子名称)

名称

set_colorT_set_colorSetColorSetColorset_color — Set output color.

参数签名

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

void HWindow::SetColor(const wchar_t* Color) const   ( Windows only)

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

void HWindow.SetColor(HTuple color)

void HWindow.SetColor(string color)

def set_color(window_handle: HHandle, color: MaybeSequence[str]) -> None

描述

set_colorset_colorSetColorSetColorSetColorset_color defines the colors for region output in the window. The available colors can be queried with the operator query_colorquery_colorQueryColorQueryColorQueryColorquery_color. In addition, the ColorColorColorColorcolorcolor may be specified as hexadecimal RGB triplet or RGBA quadruplet in the form '#rrggbb'"#rrggbb""#rrggbb""#rrggbb""#rrggbb""#rrggbb" and '#rrggbbaa'"#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.

The parameter ColorColorColorColorcolorcolor can contain a single color or a tuple with up to 256 colors. 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_colorSetColorSetColorSetColorset_color, set_rgbset_rgbSetRgbSetRgbSetRgbset_rgb, set_rgbaset_rgbaSetRgbaSetRgbaSetRgbaset_rgba, set_hsiset_hsiSetHsiSetHsiSetHsiset_hsi or set_grayset_graySetGraySetGraySetGrayset_gray is called again.

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

ColorColorColorColorcolorcolor is used in operators with region output like disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, disp_linedisp_lineDispLineDispLineDispLinedisp_line, disp_rectangle1disp_rectangle1DispRectangle1DispRectangle1DispRectangle1disp_rectangle1, or disp_arrowdisp_arrowDispArrowDispArrowDispArrowdisp_arrow.

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

运行信息

参数表

WindowHandleWindowHandleWindowHandleWindowHandlewindowHandlewindow_handle (input_control)  window HWindow, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Window handle.

ColorColorColorColorcolorcolor (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Output color names.

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

Suggested values: 'black'"black""black""black""black""black", 'white'"white""white""white""white""white", 'red'"red""red""red""red""red", 'green'"green""green""green""green""green", 'blue'"blue""blue""blue""blue""blue", 'cyan'"cyan""cyan""cyan""cyan""cyan", 'magenta'"magenta""magenta""magenta""magenta""magenta", 'yellow'"yellow""yellow""yellow""yellow""yellow", 'dim gray'"dim gray""dim gray""dim gray""dim gray""dim gray", 'gray'"gray""gray""gray""gray""gray", 'light 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""medium slate blue", 'coral'"coral""coral""coral""coral""coral", 'slate blue'"slate blue""slate blue""slate blue""slate blue""slate blue", 'spring green'"spring green""spring green""spring green""spring green""spring green", 'orange red'"orange red""orange red""orange red""orange red""orange red", 'orange'"orange""orange""orange""orange""orange", 'dark olive green'"dark olive green""dark olive green""dark olive green""dark olive green""dark olive green", 'pink'"pink""pink""pink""pink""pink", 'cadet blue'"cadet blue""cadet blue""cadet blue""cadet blue""cadet blue", '#003075'"#003075""#003075""#003075""#003075""#003075", '#e53019'"#e53019""#e53019""#e53019""#e53019""#e53019", '#ffb529'"#ffb529""#ffb529""#ffb529""#ffb529""#ffb529", '#f28d26bb'"#f28d26bb""#f28d26bb""#f28d26bb""#f28d26bb""#f28d26bb"

例程 (HDevelop)

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

结果

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

可能的前置算子

query_colorquery_colorQueryColorQueryColorQueryColorquery_color

可能的后置算子

disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region

可替代算子

set_rgbset_rgbSetRgbSetRgbSetRgbset_rgb, set_hsiset_hsiSetHsiSetHsiSetHsiset_hsi

参考其它

get_rgbget_rgbGetRgbGetRgbGetRgbget_rgb, disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, set_paintset_paintSetPaintSetPaintSetPaintset_paint

模块

Foundation