AnnotateImage

Declaration: Frm2DImg.AnnotateImage (ImgHandle: integer; PosX, PosY: double; ArrowDir: TDirection; ArrowLeng: integer; fgColor, bgColor: TColor; Text: string; Refresh: boolean): integer;
The function AnnotateImage adds a text annotation to the image. You can choose to draw the text as an opaque or transparent label and you can add an arrow pointing to the focus point of the annotation. The parameter ImgHandle specifies the image to be annotated and may take integer values between 0 and 16. The handle 0 refers to the main image of the 2D Imager, the handles 1 to 16 to the images of the image repository (if available).

The parameters PosX and PosY define the position of the focus point (in real world coordinates). If the parameter ArrowLeng is greater than zero, an additional arrow is drawn from the text label to the focus point (the text label is therefore shifted accordingly). The arrow length is given in pixels at the current zoom state. Please note that zooming in and out will change the arrow length as well. The direction of the arrow is given by the parameter ArrowDir.

The parameters fgColor and bgColor control the colors of the arrow and the text. If the fgColor and bgColor are the same, the text is transparent, otherwise the text is rendered in a colored rectangle. The text to be displayed is specified by the parameter Text. Please note that the first 50 texts may be of arbitrary length, any further annotations beyond the 50th are restricted in text length.

The parameter Refresh controls whether the image is redrawn after adding the annotation. As the redrawing is a time-consuming process, it is recommended to set Refresh to FALSE for all but the last call of the function (the last call then triggers the redrawing).

The function returns the following error codes:

 0 ... everything is OK
-1 ... invalid ImgHandle
-2 ... ArrowLeng must not be negative
-3 ... Text must not be empty
-4 ... position is outside of the data (warning only)