set_colorT_set_colorSetColorSetColorset_color (算子名称)
名称
set_colorT_set_colorSetColorSetColorset_color
— Set output color.
参数签名
描述
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
.
运行信息
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
参数表
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