You are here: Start » AVL.NET » AVL.DrawString Method

AVL.DrawString Method

Draws a string on an image.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax

public static void DrawString(
	ref AvlNet.Image ioImage,
	string inString,
	AvlNet.Location inLocation,
	AvlNet.CoordinateSystem2D? inLocationAlignment,
	AvlNet.Anchor2D inLocationAnchor,
	AvlNet.Pixel inColor,
	AvlNet.DrawingStyle inDrawingStyle,
	float inSize,
	float inOrientationAngle,
	AvlNet.Pixel? inBackgroundColor
)

Parameters

Name Type Range Default Description
ioImageAvlNet.Image
inStringstring
inLocationAvlNet.Location
inLocationAlignmentAvlNet.CoordinateSystem2D?
inLocationAnchorAvlNet.Anchor2DMiddleCenterDefault value: MiddleCenter.
inColorAvlNet.Pixel
inDrawingStyleAvlNet.DrawingStyle
inSizefloat12.0fHeight of a character. Default value: 12.0f.
inOrientationAnglefloat0.0fDefault value: 0.0f.
inBackgroundColorAvlNet.Pixel?

Description

The operation draws a string on the ioImage aligning the inLocationAnchor location of the text at the inLocation of the ioImage. The height of the font is fixed and equals 16 pixels.

Usage of DrawString with various settings.

Examples

Following example draws appropriate message when no object is found in template matching-like inspection. It is a part of the bigger Basic Template Matching Example.

                AVL.DrawString(
                    ref inspectingImage,
                    "No object found",
                    new Location(inspectingImage.Width / 2, inspectingImage.Height / 2),
					Anchor2D.MiddleCenter, 
                    new Pixel(255.0f, 0.0f, 0.0f, 255.0f),
                    style, 40.0f, 0.0f);

See also