drawText

The drawText method draws text on the image or video.

NOTE: To draw text, Media Server requires that a font is available. To specify where to look for fonts, set the parameter FontDirectory. To specify the font to use, set the font argument when you call the function.

Syntax

drawText ( text, x, y, font, fontHeight, textColor [, backgroundcolor] )

Arguments

Argument Description
text The text to draw on the image.
x The point to start drawing at (x co-ordinate, in pixels).
y

The point to start drawing at (y co-ordinate, in pixels).

TIP: The top left corner of the frame has co-ordinates 0,0.

font The filename of the font to use. The font file must be located in the directory specified by FontDirectory, or one of its subdirectories. If you omit the file extension, Media Server uses the first file with a matching name.
fontHeight The height of the text, in pixels.
textColor The color of the text. See the function rgb.
backgroundcolor The color of the background added behind the text. See the function rgb. If you omit this argument, Media Server does not add a background color behind the text.

Returns

Nothing.

Example

The following example draws the text "ABCD", in white on a black background, at the top-left corner of the image or video:

drawText("ABCD", 0, 0, "Arial", 50, rgb(255,255,255), rgb(0,0,0))

You can also write text contained in records, like this:

drawText(record.NumberPlateData.plateread, 0, 0, "Arial", 50, rgb(255,255,255))