Class «display»
This article is automatically translated from Russian by Google Translator.
Provides access to the display of the robot.
Screen size: 240*320 pixels.
Method | Description |
Print the specified text on the screen, starting from the specified coordinate. | |
Clear the drawing window. | |
Draw an arc of an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. | |
Draw an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. | |
Draw a line with the beginning and the end at the given coordinates. | |
Draw a point at given coordinates. | |
Draw a rectangle with the upper left corner at the specified coordinates and having the specified width and height. | |
Close and clear the drawing window. | |
Redraw the window to draw. The changes to the display will only happen after this method is called. | |
Remove from the screen all text added to it by calls to the "addLabel" method. | |
Set the screen background to the color you specify. | |
Set the color of the brush used to draw the graphical primitives. | |
Set the thickness of the brush used to draw the graphical primitives, in pixels. | |
Display the image generated in the one-dimensional array on the controller. | |
Display the image previously loaded on the robot. |
addLabel
Print the specified text on the screen, starting from the specified coordinate. If there was already text in the specified coordinates, it will be replaced by the new text.
The changes on the display will occur only after calling the method "redraw".
Parameters:
text
— display text,x
,y
— screen coordinates.
Example
clear
Clear the drawing window.
drawArc
Draw an arc of an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. The changes on the display will occur only after calling the method "redraw".
Parameters:
x
,y
— the coordinates of the upper left corner of the rectangle on the screen,l
— rectangle width,h
— rectangle height,from
— initial angle bounding the arc,to
— finite angle bounding the arc.
Example
drawEllipse
Draw an ellipse inscribed into a rectangle with the upper left corner at specified coordinates and having a given width and height. The changes on the display will occur only after calling the method "redraw".
Parameters:
x
,y
— coordinates of the upper left corner of the rectangle,l
— rectangle width,h
— rectangle height.
Example
drawLine
Draw a line with the beginning and the end at the given coordinates. The changes on the display will occur only after calling the method "redraw".
Parameters:
x0
,y0
— line origin coordinates,x1
,y1
— line end coordinates.
Example
drawPoint
Draw a point at given coordinates. The changes on the display will occur only after calling the method "redraw".
Parameters:
point coordinates
x
,y
.
Example
drawRect
Draw a rectangle with the upper left corner at the specified coordinates and having the specified width and height. The changes on the display will occur only after calling the method "redraw".
Parameters:
x
,y
— coordinates of the upper left corner of the rectangle,l
— rectangle width,h
— rectangle height.
Example
hide
Close and clear the drawing window.
redraw
Redraw the window to draw. The changes to the display will only happen after this method is called.
removeLabels
Remove from the screen all text added to it by calls to the "addLabel" method.
setBackground
Set the screen background to the color you specify.
Available colors:
white,
red, darkRed,
green, darkGreen,
blue, darkBlue,
cyan, darkCyan,
magenta, darkMagenta,
yellow, darkYellow,
gray, darkGray, lightGray,
black.
As a parameter, you must specify the color.
Example
setPainterColor
Set the color of the brush used to draw the graphical primitives.
Available colors:
white,
red, darkRed,
green, darkGreen,
blue, darkBlue,
cyan, darkCyan,
magenta, darkMagenta,
yellow, darkYellow,
gray, darkGray, lightGray,
black.
As a parameter, you must specify the color.
Example
setPainterWidth
Set the thickness of the brush used to draw the graphical primitives, in pixels.
As a parameter, you must specify the thickness d
.
Example
show
Display the image generated in the one-dimensional array on the controller.
Parameters:
array
— a one-dimensional integer array with dimensionswidth
×height
width
иheight
— the width and height of the image, respectivelyThe format in which each element of the array is represented should be passed as the format parameter. The formats currently supported are: «rgb32», «grayscale8», «rgb888».
Example
Examples of using show()
on an image taken withgetPhoto()
.
showImage
Display the image previously loaded on the robot.
The name of the image file (in BMP, GIF, JPG, JPEG, PNG, PBM, PGM, PPM, TIFF, XBM, XPM formats) must be specified as a parameter, the path is specified either as absolute or relative to the trik
folder.
Example
Last updated