CLabels:Class Description CLabels:delete

CLabels:new


The new method constructs a new instance of a CLabels object. The CLabels class includes properties that control calculation of centroid positions. Various constructor overloads are available to create a new CLabels and initialize the properties.

Syntax

C = CLabels:new()

  • Creates a default CLabels with properties initialized to default values. You will need to attach this to a CImageView object.

C = CLabels:new( CImageView )

  • Creates a CLabels object and attaches it to the CImageView object.

C = CLabels:new( CLabels2 )

Remarks

If you use any constructor that does not use a CImageView object as an argument, then you must specify one using Attach method before labels can be drawn on an image.

Example

Suppose a CImageView V exists and displays 1 or more images. The following script fragment illustrates two forms of the new constructor. Both produce the same result:

 

L = CLabels:new( V )

-- create a new CLabels L attached to V

x = 192 ; y = 390

-- target coordinates

str = "My label text"

-- label coordinates

I = V:GetImage()

-- I is the current displayed image in V

L:Add( I, x, y str )

-- draw the label on the image

  

The following script fragment does the same thing but uses the 2-step attachment to a CImageView:

 

L = CLabels:new()

-- create a new CLabels L

x = 192 ; y = 390

-- target coordinates

str = "My label text"

-- label coordinates

L:Attach( V )

-- attach to the CImageView V

I = V:GetImage()

-- I is the current displayed image in V

L:Add( I, x, y str )

-- draw the label on the image

Related Topics

CLabels, delete