![Yoctopuce Yocto-Display User Manual Download Page 310](http://html1.mh-extra.com/html/yoctopuce/yocto-display/yocto-display_user-manual_3418946310.webp)
22. High-level API Reference
304
www.yoctopuce.com
YDisplayLayer
displaylayer
→
drawText()
Draws a text string at the specified position.
js
function drawText(
x
,
y
,
anchor
,
text
)
cpp
int drawText( int
x
, int
y
, Y_ALIGN
anchor
, string
text
)
m
-(int) drawText : (int)
x
: (int)
y
: (Y_ALIGN)
anchor
: (NSString*)
text
pas
function drawText(
x
: LongInt,
y
: LongInt,
anchor
: TYALIGN,
text
: string): LongInt
vb
function drawText( ) As Integer
cs
int drawText( int
x
, int
y
, ALIGN
anchor
, string
text
)
java
int drawText( int
x
, int
y
, ALIGN
anchor
, String
text
)
uwp
Task<int> drawText( int
x
, int
y
, ALIGN
anchor
, string
text
)
py
def drawText(
x
,
y
,
anchor
,
text
)
php
function drawText(
$x
,
$y
,
$anchor
,
$text
)
es
function drawText(
x
,
y
,
anchor
,
text
)
cmd
YDisplay
target
[-layer
layerId
] drawText
x
y
anchor
text
The point of the text that is aligned to the specified pixel position is called the anchor point, and can be
chosen among several options. Text is rendered from left to right, without implicit wrapping.
Parameters :
x
the distance from left of layer to the text anchor point, in pixels
y
the distance from top of layer to the text anchor point, in pixels
anchor
the text anchor point, chosen among the
Y_ALIGN
enumeration:
Y_ALIGN_TOP_LEFT
,
Y_ALIGN_CENTER_LEFT
,
Y_ALIGN_BASELINE_LEFT
,
Y_ALIGN_BOTTOM_LEFT
,
Y_ALIGN_TOP_CENTER
,
Y_ALIGN_CENTER
,
Y_ALIGN_BASELINE_CENTER
,
Y _ A L I G N _ B O T T O M _ C E N T E R
,
Y _ A L I G N _ T O P _ D E C I M A L
,
Y _ A L I G N _ C E N T E R _ D E C I M A L
,
Y _ A L I G N _ B A S E L I N E _ D E C I M A L
,
Y_ALIGN_BOTTOM_DECIMAL
,
Y_ALIGN_TOP_RIGHT
,
Y_ALIGN_CENTER_RIGHT
,
Y_ALIGN_BASELINE_RIGHT
,
Y_ALIGN_BOTTOM_RIGHT
.
text
the text string to draw
Returns :
YAPI_SUCCESS
if the call succeeds.
On failure, throws an exception or returns a negative error code.
Summary of Contents for Yocto-Display
Page 1: ...Yocto Display User Manual...
Page 2: ......
Page 40: ...34 www yoctopuce com...
Page 52: ...46 www yoctopuce com...
Page 84: ...78 www yoctopuce com...
Page 92: ...86 www yoctopuce com...
Page 130: ...124 www yoctopuce com...
Page 422: ...416 www yoctopuce com...