Skip to content

set_graySetGraySetGrayset_grayT_set_grayπŸ”—

Short descriptionπŸ”—

set_graySetGraySetGrayset_grayT_set_gray β€” Define gray values for region output.

SignatureπŸ”—

set_gray( window WindowHandle, integer GrayValues )void SetGray( const HTuple& WindowHandle, const HTuple& GrayValues )static void HOperatorSet.SetGray( HTuple windowHandle, HTuple grayValues )def set_gray( window_handle: HHandle, gray_values: MaybeSequence[int] ) -> None

Herror T_set_gray( const Htuple WindowHandle, const Htuple GrayValues )

void HWindow::SetGray( const HTuple& GrayValues ) const

void HWindow::SetGray( Hlong GrayValues ) const

void HWindow.SetGray( HTuple grayValues )

void HWindow.SetGray( int grayValues )

DescriptionπŸ”—

set_graySetGray defines the gray values for region output. Gray values are defined as the range of the color lookup table that is used for gray value output with disp_imageDispImage in conjunction with set_paint(::WindowHandle,'gray':). These entries can be modified by set_lutSetLut. So a β€˜gray value’ is the color in which a pixel with the same value is displayed (not necessarily really gray). In general, when changing the color lookup table with set_lutSetLut, the colors of the displayed image will change too.

If a gray value is needed as a color for image output (i.e. no color changes with set_lutSetLut are possible), it can be set with set_color(::WindowHandle,'gray':).

If only a single gray value is passed, all output will take place in that gray value. If a tuple of gray values is passed, all output will take place in gray values modulo the number of tuple elements. In the example below, the first circle is displayed with gray value 100, the second with 200 and the third with 100 again. Every output operator starts with the first gray value. Note, that the number of output gray values 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 gray value, even if the consist of more than one connected components.

When the operators set_graySetGray, set_colorSetColor, set_rgbSetRgb, set_hsiSetHsi are called, the overwrite the existing values. If not all gray values are displayable on the output device, the number range of GrayValuesgrayValuesgray_values (0..255) is dithered to the range of displayable gray values. In any case 0 is displayed as black and 255 as white. The displayable gray values can be queried with the operator query_grayQueryGray. With texttt{set_check(::’~color’:)} error messages can be suppressed if a gray value can’t be displayed on the screen. In that case, a similar gray value is displayed.

Execution informationπŸ”—

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

ParametersπŸ”—

WindowHandlewindowHandlewindow_handle (input_control) window β†’ (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

GrayValuesgrayValuesgray_values (input_control) integer(-array) β†’ (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Gray values for region output.

Default: 255255
Suggested values: 0, 1, 2, 10, 16, 32, 64, 100, 120, 128, 250, 251, 252, 253, 254, 2550, 1, 2, 10, 16, 32, 64, 100, 120, 128, 250, 251, 252, 253, 254, 255
Value range: 0 ≀ GrayValues ≀ 255

ExampleπŸ”—

(HDevelop)

set_gray(WindowHandle,[100,200])
disp_circle(WindowHandle,[100,200,300],[200,300,100],[100,100,100])

ResultπŸ”—

set_hsiSetHsi returns 2 (H_MSG_TRUE) if the window is valid and the given gray value is displayable. Otherwise an exception is raised.

Combinations with other operatorsπŸ”—

Combinations

Possible successors

disp_regionDispRegion

See also

set_colorSetColor

ModuleπŸ”—

Foundation