dev_disp_textdev_disp_textDevDispTextDevDispTextdev_disp_text (Operator)
Name
dev_disp_textdev_disp_textDevDispTextDevDispTextdev_disp_text
— Display text in in the current graphics window.
Signature
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 HWindow::DevDispText(const wchar_t* String, const wchar_t* CoordSystem, Hlong Row, Hlong Column, const wchar_t* Color, const wchar_t* GenParamName, const wchar_t* GenParamValue)
(Windows only)
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)
def dev_disp_text(string: MaybeSequence[str], coord_system: str, row: MaybeSequence[Union[int, float, str]], column: MaybeSequence[Union[int, float, str]], color: MaybeSequence[str], gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[str, int, float]]) -> None
Description
dev_disp_textdev_disp_textDevDispTextDevDispTextDevDispTextdev_disp_text
displays text in the current graphics window
at the position (RowRowRowRowrowrow
,ColumnColumnColumnColumncolumncolumn
).
If only a single position is defined, one text line is displayed for each
element of StringStringStringStringstringValstring
. Also, '\n'"\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 StringStringStringStringstringValstring
. In this case, line breaks have
to be forced with '\n'"\n""\n""\n""\n""\n".
Newlines ('\n'"\n""\n""\n""\n""\n") at the end of
StringStringStringStringstringValstring
are ignored.
The position of the text may be specified in window coordinates
(CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system
= 'window'"window""window""window""window""window") or in image coordinates
(CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system
= 'image'"image""image""image""image""image"), which is useful when using
zoomed images.
In addition to supplying (RowRowRowRowrowrow
,ColumnColumnColumnColumncolumncolumn
) coordinates, it is
also possible to pass predefined values to RowRowRowRowrowrow
and ColumnColumnColumnColumncolumncolumn
to display the text at a fixed position in the window
(only if CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system
= 'window'"window""window""window""window""window").:
'top'"top""top""top""top""top", 'left'"left""left""left""left""left" |
'top'"top""top""top""top""top", 'center'"center""center""center""center""center" |
'top'"top""top""top""top""top", 'right'"right""right""right""right""right" |
'center'"center""center""center""center""center", 'left'"left""left""left""left""left" |
'center'"center""center""center""center""center", 'center'"center""center""center""center""center" |
'center'"center""center""center""center""center", 'right'"right""right""right""right""right" |
'bottom'"bottom""bottom""bottom""bottom""bottom", 'left'"left""left""left""left""left" |
'bottom'"bottom""bottom""bottom""bottom""bottom", 'center'"center""center""center""center""center" |
'bottom'"bottom""bottom""bottom""bottom""bottom", 'right'"right""right""right""right""right"
|
The parameter ColorColorColorColorcolorcolor
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_textDispTextDispTextDispTextdisp_text
may display the StringStringStringStringstringValstring
within a box (default).
This behavior and the look of the box are defined with the generic parameters
in GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value
.
- 'box'
-
If 'box'"box""box""box""box""box" is set to 'true'"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""true" and 'false'"false""false""false""false""false"
default value: 'true'"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""white",
'red'"red""red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")
default value: '#fce9d4'"#fce9d4""#fce9d4""#fce9d4""#fce9d4""#fce9d4" (which is a light orange)
- 'shadow'
-
If 'shadow'"shadow""shadow""shadow""shadow""shadow" is set to 'true'"true""true""true""true""true", an additional shadow
is displayed beneath the box (if 'box'"box""box""box""box""box" is 'true'"true""true""true""true""true").
possible values: 'true'"true""true""true""true""true" and 'false'"false""false""false""false""false"
default value: 'true'"true""true""true""true""true" if 'box_color'"box_color""box_color""box_color""box_color""box_color" is set to a color
without alpha value, 'false'"false""false""false""false""false" otherwise
- 'shadow_color'
-
Sets the color of the shadow if 'shadow'"shadow""shadow""shadow""shadow""shadow" is 'true'"true""true""true""true""true".
possible values: a string containing the color name (e.g. 'black'"black""black""black""black""black",
'red'"red""red""red""red""red", or '#aa00bba0'"#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0""#aa00bba0")
default value: '#f28d26'"#f28d26""#f28d26""#f28d26""#f28d26""#f28d26" (which is a darker orange) if
'box_color'"box_color""box_color""box_color""box_color""box_color" is not set, 'white'"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""shadow_dx") and
row ('shadow_dy'"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
StringStringStringStringstringValstring
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (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"
"hello"
CoordSystemCoordSystemCoordSystemCoordSystemcoordSystemcoord_system
(input_control) string →
HTuplestrHTupleHtuple (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"
"window"
List of values: 'image'"image""image""image""image""image", 'window'"window""window""window""window""window"
RowRowRowRowrowrow
(input_control) point.y(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (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""bottom", 'center'"center""center""center""center""center", 'top'"top""top""top""top""top"
ColumnColumnColumnColumncolumncolumn
(input_control) point.x(-array) →
HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (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""center", 'left'"left""left""left""left""left", 'right'"right""right""right""right""right"
ColorColorColorColorcolorcolor
(input_control) string(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
A tuple of strings defining the colors of the texts.
Default value:
'black'
"black"
"black"
"black"
"black"
"black"
List of values: 'black'"black""black""black""black""black", 'blue'"blue""blue""blue""blue""blue", 'coral'"coral""coral""coral""coral""coral", 'cyan'"cyan""cyan""cyan""cyan""cyan", 'forest green'"forest green""forest green""forest green""forest green""forest green", 'green'"green""green""green""green""green", 'lime green'"lime green""lime green""lime green""lime green""lime green", 'magenta'"magenta""magenta""magenta""magenta""magenta", 'red'"red""red""red""red""red", 'slate blue'"slate blue""slate blue""slate blue""slate blue""slate blue", 'yellow'"yellow""yellow""yellow""yellow""yellow"
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
(input_control) attribute.name(-array) →
HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Generic parameter names.
Default value: []
List of values: 'border_radius'"border_radius""border_radius""border_radius""border_radius""border_radius", 'box'"box""box""box""box""box", 'box_color'"box_color""box_color""box_color""box_color""box_color", 'box_padding'"box_padding""box_padding""box_padding""box_padding""box_padding", 'shadow'"shadow""shadow""shadow""shadow""shadow", 'shadow_color'"shadow_color""shadow_color""shadow_color""shadow_color""shadow_color", 'shadow_dx'"shadow_dx""shadow_dx""shadow_dx""shadow_dx""shadow_dx", 'shadow_dy'"shadow_dy""shadow_dy""shadow_dy""shadow_dy""shadow_dy", 'shadow_sigma'"shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma""shadow_sigma"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value
(input_control) attribute.value(-array) →
HTupleMaybeSequence[Union[str, int, float]]HTupleHtuple (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""black", 'blue'"blue""blue""blue""blue""blue", 'false'"false""false""false""false""false", 'forest green'"forest green""forest green""forest green""forest green""forest green", 'red'"red""red""red""red""red", 'true'"true""true""true""true""true", 'white'"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_textDevDispTextDevDispTextDevDispTextdev_disp_text
returns 2 (H_MSG_TRUE). Otherwise, an
exception is raised and an error code returned.
Possible Predecessors
dev_open_windowdev_open_windowDevOpenWindowDevOpenWindowDevOpenWindowdev_open_window
,
set_fontset_fontSetFontSetFontSetFontset_font
,
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents
Alternatives
disp_textdisp_textDispTextDispTextDispTextdisp_text
,
write_stringwrite_stringWriteStringWriteStringWriteStringwrite_string
See also
get_string_extentsget_string_extentsGetStringExtentsGetStringExtentsGetStringExtentsget_string_extents
,
set_fontset_fontSetFontSetFontSetFontset_font
Module
Foundation