Format of Reference Pages
In this User's Guide, all functions and class methods have a reference page that describes their usage. To understand how to implement a class method in your script, it helps to understand the layout of the reference pages.
The Syntax section of a reference page shows how the method or function is called by your script, including the arguments and return values. As an example, look at the CImage:PolyFitImage method page:
Syntax
Here is how to understand what is written:
bSuccess is the returned value. the name bSuccess is a dummy that should be replaced by your own variable, should you want to use the value returned by PolyFitImage. You can omit the dummy value and = sign if you do not want to use the returned value. In this case, bSuccess begins with the letter "b" which indicates that the return value is a boolean variable (true or false). Names are often prefixed with the letters b, n, or s to indicate that the returned value is a boolean, number, or string. This protocol is not adhered to all the time, especially when the type of value is either obvious or may actually be any of these types.
CImage: is the name of the class that owns the PolyFitImage method. When you call a class member, like PolyFitImage, from your script you must prefix it with the name of the actual class object and not the name of the class. For example, if you created a CImage object like this: I = CImage:new(), then I is the instance of the class object that must prefix the call to PolyFitImage. Putting it together, our script would look like this: I:PolyFitImage. If a different CImage exists and is named I2, then you would call the same member for the other instance using the syntax I2:PolyFitImage.
Within parentheses () are the parameters of the method. In the example above, the first two parameters, ct and rt, are required. The second two parameters are optional. If they are not specified, then default values are used.
Often the parameter list contains a reference to another class object, like the CRect in PolyFitImage. For a class object reference like this, pass the name of an instance of the class. For example, if you used R=NewRect(1,2,100,200) to create an instance of a CRect, then you would pass R as the CRect argument.
In summary, your actual usage of this method might look like any of the following:
bSuccess = I:PolyFitImage( 2, 3, true, R )
bSuccess = I:PolyFitImage( 2, 3, false )
bSuccess = I:PolyFitImage( 2, 3 )
I:PolyFitImage( 2, 3 )
This section is present on most of the description pages. It usually gives a short description of how to implement the method followed by a script. In the script, the line containing the actual method of interest is highlighted. Comments are included in green, like this -- this is a comment, as you would see them in the Script Editor. For the PolyFitImage example, here is what is meant by a script:
|
-- create a new CImage |
|
-- load the image |
|
-- perform the operation on image I |
|
|
|
|
The Related Topics lists links to other topics having related methods or a similar purpose, just as shown below.