ClassesClasses | | Operators

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

Page not available for the currently selected syntax (programming language).

dev_disp_textdev_disp_textDevDispTextDevDispText (Operator)

Name

dev_disp_textdev_disp_textDevDispTextDevDispText — Display text in in the current graphics window.

Signature

dev_disp_text( : : String, CoordSystem, Row, Column, Color, GenParamName, GenParamValue : )

Herror dev_disp_text(const char* String, const char* CoordSystem, const Hlong Row, const Hlong Column, const char* Color, const char* GenParamName, const char* GenParamValue)

Herror T_dev_disp_text(const Htuple String, const Htuple CoordSystem, const Htuple Row, const Htuple Column, const Htuple Color, const Htuple GenParamName, const Htuple GenParamValue)

void DevDispText(const HTuple& String, const HTuple& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue)

static void HWindow::DevDispText(const HTuple& String, const HString& CoordSystem, const HTuple& Row, const HTuple& Column, const HTuple& Color, const HTuple& GenParamName, const HTuple& GenParamValue)

static void HWindow::DevDispText(const HString& String, const HString& CoordSystem, Hlong Row, Hlong Column, const HString& Color, const HString& GenParamName, const HString& GenParamValue)

static void HWindow::DevDispText(const char* String, const char* CoordSystem, Hlong Row, Hlong Column, const char* Color, const char* GenParamName, const char* GenParamValue)

static void HOperatorSet.DevDispText(HTuple stringVal, HTuple coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

static void HWindow.DevDispText(HTuple stringVal, string coordSystem, HTuple row, HTuple column, HTuple color, HTuple genParamName, HTuple genParamValue)

static void HWindow.DevDispText(string stringVal, string coordSystem, int row, int column, string color, string genParamName, string genParamValue)

Description

dev_disp_textdev_disp_textDevDispTextDevDispTextDevDispText displays text in the current graphics window at the position (RowRowRowRowrow,ColumnColumnColumnColumncolumn).

If only a single position is defined, one text line is displayed for each element of StringStringStringStringstringVal. Also, '\n'"\n""\n""\n""\n" will be interpreted as a newline character, i.e., a line break is performed.

If multiple positions are defined, only a single string or one string for each position is allowed in StringStringStringStringstringVal. In this case, line breaks have to be forced with '\n'"\n""\n""\n""\n".

Newlines ('\n'"\n""\n""\n""\n") at the end of StringStringStringStringstringVal are ignored.

The position of the text may be specified in window coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'window'"window""window""window""window") or in image coordinates (CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'image'"image""image""image""image"), which is useful when using zoomed images.

In addition to supplying (RowRowRowRowrow,ColumnColumnColumnColumncolumn) coordinates, it is also possible to pass predefined values to RowRowRowRowrow and ColumnColumnColumnColumncolumn to display the text at a fixed position in the window (only if CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem = 'window'"window""window""window""window").:

'top'"top""top""top""top", 'left'"left""left""left""left" 'top'"top""top""top""top", 'center'"center""center""center""center" 'top'"top""top""top""top", 'right'"right""right""right""right"
'center'"center""center""center""center", 'left'"left""left""left""left" 'center'"center""center""center""center", 'center'"center""center""center""center" 'center'"center""center""center""center", 'right'"right""right""right""right"
'bottom'"bottom""bottom""bottom""bottom", 'left'"left""left""left""left" 'bottom'"bottom""bottom""bottom""bottom", 'center'"center""center""center""center" 'bottom'"bottom""bottom""bottom""bottom", 'right'"right""right""right""right"

The parameter ColorColorColorColorcolor also accepts tuples of values. In that case, the specified colors are used cyclically for every new text position or for every new line of text if a single position is used.

Generic Parameters

disp_textdisp_textDispTextDispTextDispText may display the StringStringStringStringstringVal within a box (default). This behavior and the look of the box are defined with the generic parameters in GenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue.

'box'

If 'box'"box""box""box""box" is set to 'true'"true""true""true""true", the text is written within a box. The look of the box and its optional shadow can be configured with the generic parameters below.

possible values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

default value: 'true'"true""true""true""true"

'box_color'

Sets the color of the box.

possible values: a string containing the color name (e.g. 'white'"white""white""white""white", 'red'"red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#fce9d4'"#fce9d4""#fce9d4""#fce9d4""#fce9d4" (which is a light orange)

'shadow'

If 'shadow'"shadow""shadow""shadow""shadow" is set to 'true'"true""true""true""true", an additional shadow is displayed beneath the box (if 'box'"box""box""box""box" is 'true'"true""true""true""true").

possible values: 'true'"true""true""true""true" and 'false'"false""false""false""false"

default value: 'true'"true""true""true""true" if 'box_color'"box_color""box_color""box_color""box_color" is set to a color without alpha value, 'false'"false""false""false""false" otherwise

'shadow_color'

Sets the color of the shadow if 'shadow'"shadow""shadow""shadow""shadow" is 'true'"true""true""true""true".

possible values: a string containing the color name (e.g. 'black'"black""black""black""black", 'red'"red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")

default value: '#f28d26'"#f28d26""#f28d26""#f28d26""#f28d26" (which is a darker orange) if 'box_color'"box_color""box_color""box_color""box_color" is not set, 'white'"white""white""white""white" otherwise

'border_radius'

Controls the roundness of the box's corners. For sharp corners set it to 0, for smoother corners to higher values.

possible values: positive real numbers or 0

default value: 2

'box_padding'

Controls to which amount in pixels the box is extended around the text.

possible values: positive real number

default value: 0

'shadow_sigma'

Controls to which amount the shadow beneath the box is blurred. Set it to 0 for a sharp shadow.

possible values: positive real number or 0

default value: 1.5

'shadow_dx' and 'shadow_dy'

Controls the offset of the shadow in column ('shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx") and row ('shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy") direction in pixels.

possible values: any real number

default_value: 2

Attention

Using the code export feature of HDevelop, the code that is generated for this operator may have a different behavior than the related HALCON operator. For a detailed description of the code export of HDevelop graphics operators into the different programming languages see in the “HDevelop User's Guide” the chapter Code Export -> General Aspects of Code Generation -> Graphics Windows.

Parameters

StringStringStringStringstringVal (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

A tuple of strings containing the text message to be displayed. Each value of the tuple will be displayed in a single line.

Default value: 'hello' "hello" "hello" "hello" "hello"

CoordSystemCoordSystemCoordSystemCoordSystemcoordSystem (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

If set to 'window', the text position is given with respect to the window coordinate system. If set to 'image', image coordinates are used (this may be useful in zoomed images).

Default value: 'window' "window" "window" "window" "window"

List of values: 'image'"image""image""image""image", 'window'"window""window""window""window"

RowRowRowRowrow (input_control)  point.y(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The vertical text alignment or the row coordinate of the desired text position.

Default value: 12

List of values: 12, 'bottom'"bottom""bottom""bottom""bottom", 'center'"center""center""center""center", 'top'"top""top""top""top"

ColumnColumnColumnColumncolumn (input_control)  point.x(-array) HTupleHTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)

The horizontal text alignment or the column coordinate of the desired text position.

Default value: 12

List of values: 12, 'center'"center""center""center""center", 'left'"left""left""left""left", 'right'"right""right""right""right"

ColorColorColorColorcolor (input_control)  string(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

A tuple of strings defining the colors of the texts.

Default value: 'black' "black" "black" "black" "black"

List of values: 'black'"black""black""black""black", 'blue'"blue""blue""blue""blue", 'coral'"coral""coral""coral""coral", 'cyan'"cyan""cyan""cyan""cyan", 'forest green'"forest green""forest green""forest green""forest green", 'green'"green""green""green""green", 'lime green'"lime green""lime green""lime green""lime green", 'magenta'"magenta""magenta""magenta""magenta", 'red'"red""red""red""red", 'slate blue'"slate blue""slate blue""slate blue""slate blue", 'yellow'"yellow""yellow""yellow""yellow"

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name(-array) HTupleHTupleHtuple (string) (string) (HString) (char*)

Generic parameter names.

Default value: []

List of values: 'border_radius'"border_radius""border_radius""border_radius""border_radius", 'box'"box""box""box""box", 'box_color'"box_color""box_color""box_color""box_color", 'box_padding'"box_padding""box_padding""box_padding""box_padding", 'shadow'"shadow""shadow""shadow""shadow", 'shadow_color'"shadow_color""shadow_color""shadow_color""shadow_color", 'shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx", 'shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy", 'shadow_sigma'"shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.value(-array) HTupleHTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

Generic parameter values.

Default value: []

List of values: 5.0, 'black'"black""black""black""black", 'blue'"blue""blue""blue""blue", 'false'"false""false""false""false", 'forest green'"forest green""forest green""forest green""forest green", 'red'"red""red""red""red", 'true'"true""true""true""true", 'white'"white""white""white""white"

Example (HDevelop)

dev_open_window (0, 0, 512, 512, 'black', WindowHandle)
dev_disp_text ('Display some text in a box', 'window', 12, 12, \
               'black', [], [])

Result

If the values of the specified parameters are correct, dev_disp_textdev_disp_textDevDispTextDevDispTextDevDispText returns 2 (H_MSG_TRUE). Otherwise an exception is raised and an error code returned.

Possible Predecessors

dev_open_windowdev_open_windowDevOpenWindowDevOpenWindowDevOpenWindow, set_fontset_fontSetFontSetFontSetFont, get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents

Alternatives

disp_textdisp_textDispTextDispTextDispText, write_stringwrite_stringWriteStringWriteStringWriteString

See also

get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtents, set_fontset_fontSetFontSetFontSetFont

Module

Foundation


ClassesClasses | | Operators