ClassesClassesClassesClasses | | | | Operators

set_grayset_graySetGrayset_graySetGraySetGray (Operator)


set_grayset_graySetGrayset_graySetGraySetGray — Define gray values for region output.


set_gray( : : WindowHandle, GrayValues : )

Herror set_gray(const Hlong WindowHandle, const Hlong GrayValues)

Herror T_set_gray(const Htuple WindowHandle, const Htuple GrayValues)

Herror set_gray(const HTuple& WindowHandle, const HTuple& GrayValues)

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

void SetGray(const HTuple& WindowHandle, const HTuple& GrayValues)

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

void HWindow::SetGray(Hlong GrayValues) const

void HOperatorSetX.SetGray(
[in] VARIANT WindowHandle, [in] VARIANT GrayValues)

void HWindowX.SetGray([in] VARIANT GrayValues)

static void HOperatorSet.SetGray(HTuple windowHandle, HTuple grayValues)

void HWindow.SetGray(HTuple grayValues)

void HWindow.SetGray(int grayValues)


set_grayset_graySetGrayset_graySetGraySetGray 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_imagedisp_imageDispImagedisp_imageDispImageDispImage in conjunction with set_paint(::WindowHandle,'gray':)set_paint(WindowHandle,"gray")SetPaint(WindowHandle,"gray")set_paint(WindowHandle,"gray")SetPaint(WindowHandle,"gray")SetPaint(WindowHandle,"gray"). These entries can be modified by set_lutset_lutSetLutset_lutSetLutSetLut. 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_lutset_lutSetLutset_lutSetLutSetLut, 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_lutset_lutSetLutset_lutSetLutSetLut are possible), it can be set with set_color(::WindowHandle,'gray':)set_color(WindowHandle,"gray")SetColor(WindowHandle,"gray")set_color(WindowHandle,"gray")SetColor(WindowHandle,"gray")SetColor(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_grayset_graySetGrayset_graySetGraySetGray, set_colorset_colorSetColorset_colorSetColorSetColor, set_rgbset_rgbSetRgbset_rgbSetRgbSetRgb, set_hsiset_hsiSetHsiset_hsiSetHsiSetHsi are called, the overwrite the existing values. If not all gray values are displayable on the output device, the number range of GrayValuesGrayValuesGrayValuesGrayValuesGrayValuesgrayValues (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_grayquery_grayQueryGrayquery_grayQueryGrayQueryGray. Furthermore, the number of actually displayed gray values can be changed with set_system(::'num_gray_*',...:)set_system("num_gray_*",...)SetSystem("num_gray_*",...)set_system("num_gray_*",...)SetSystem("num_gray_*",...)SetSystem("num_gray_*",...). This must be done before opening the first window. With 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.



WindowHandleWindowHandleWindowHandleWindowHandleWindowHandlewindowHandle (input_control)  window HWindow, HTupleHTupleHTupleHWindowX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong) (Hlong)


GrayValuesGrayValuesGrayValuesGrayValuesGrayValuesgrayValues (input_control)  integer(-array) HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Gray values for region output.

Default value: 255

Suggested values: 0, 1, 2, 10, 16, 32, 64, 100, 120, 128, 250, 251, 252, 253, 254, 255

Typical range of values: 0 ≤ GrayValues GrayValues GrayValues GrayValues GrayValues grayValues ≤ 255

Example (HDevelop)


Example (C)

Htuple GrayValues ;
create_tuple(&GrayValues,2) ;
set_i(GrayValues,100,0) ;
set_i(GrayValues,200,0) ;
T_set_gray(WindowHandle,GrayValues) ;
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)


Example (HDevelop)


Example (HDevelop)


Example (HDevelop)



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

Possible Successors


See also

get_pixelget_pixelGetPixelget_pixelGetPixelGetPixel, set_colorset_colorSetColorset_colorSetColorSetColor



ClassesClassesClassesClasses | | | | Operators