|  | VISION Documentation (LDV) |  | Last update: 29/10/00
Download documentation | 3. D E S C R I P T I O N |

To summarise, here is what happens between VISION and an LDV:

0. Init (done a single time at the first user call using LDVs). VISION loads the GetLDVCapabilities function of each LDV, calls the function and memorizes the capabilities of each LDV to limit future hard drive accesses, then launches each LDV

1. VISION loads the LDV

2. VISION calls the PreRun function

3. VISION calls the Run (or Preview) function

4. VISION unloads the LDV

3.1 LDV Capabilities

Prototype | LDV_INFOS * cdecl GetLDVCapabilities(VAPI *vapi)
Parameters | [IN] vapi: pointer on the VAPI interface provided by VISION. This pointer must be memorized for future use.
Return | A pointer on the structure LDV_INFOS stored in the LDV (the skeleton declares the LdvInfos variable of the type LDV_INFOS)
Responsibilities | This function is completely written in the skeleton. The works to be done is to fill the structure of the type <ahref="struct.htm#LDV_INFOS">LDV_INFOS of the LDV skeleton.

3.2 PreRun function

Prototype | LDV_STATUS cdecl PreRun(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
Parameters | [IN] in: pointer on the structure LDV_IMAGE describing the image of VISION [IN / OUT] params: pointeur on a structure LDV_PARAMS indicating the area to modify
Return | A success or error code

Responsibilities

Must mention to VISION the memory to allocate and the part to be saved by the UNDO function:

1. If the LDV needs it (LDVF_OPINPLACE not defined in the structure LDV_CAPS), out->Raster.fd_w and out->Raster.fd_h must contain the size of the image to allocate for the destination. This is this image that will be displayed by VISION in the associated window.
2. If needed, indicate in the fields, x1, x2, y1 and y2 of the structure LDV_PARAMS, the area to be backed up in the UNDO buffer of the image to be able to undo. Before the call, VISION sets these fields according to the user selection (block or full image)

By default:

1. VISION will allow no memory for the LDV and will suppose the transformation will take place "in place"
2. VISION will backup in the UNDO buffer the part specified by the fields x1, x2, y1 and y2 of the structure LDV_PARAMS (full image or selection if a block is selected)

3.3 Run function

Prototype | LDV_STATUS cdecl Run(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
Parameters | [IN] in: pointer on the structure LDV_IMAGE describing the source image of VISION [IN] params: pointer on a structure LDV_PARAMS indicating the area to modify [OUT] out: pointer of the destination image , allocate by VISION with a previous call to PreRun
Return | A success or error code

Responsibilities / Comments

Must do the operation forecasted for the LDV.
VISION choses automatically the most adapted format while trying to minimise the memory, taking into account the format(s) handled by the LDV (knowing the most economical is LDVF_SPECFORMAT)
The LDV can modify another area than the one given in the fields x1, y1, x2 and y2 of params if it was mentionned previously by the PreRun function
NEVER allocate in the LDV memory for VISION, because it will be freed as soon as VISION will unload the LDV (even if you do not do it explicitely, the compiler of the system will do it). On the other hand, nothing prevents you from allocating memory for internal usage related to this function, but do not forget to free it!

3.4 Preview function

Prototype | LDV_STATUS cdecl Preview(LDV_IMAGE *in, LDV_PARAMS *params, LDV_IMAGE *out)
Parameters | Identical to those of the function Run
Return | A success or error code
Responsibilities / Comments | This function is identical to the function Run, but it operates on smaller images (112 x 112 on average). If the function Run is fast enough to display the result in less than 1 second, the Preview function should simply call it. Otherwise, it is possible to do some approximations or pre-computation to be back below a second.

3.5 The associated INI file

The INI file associated to an LDV has two purposes:

1. Gather all the information related to the language such as its name and description
2. Define parameters of the LDV

3.5.1 Language information

LDVs are multi-lingual, i.e., if a language has been defined in preferences, VISION is able to use this information also for the LDVs, provided the information is available. The .LDV and the associated .INI are located in the LDV directory of VISION. For instance, the file INVERT.INI is associated to the file INVERT.LDV. In the LDV folder, the more standard LDVs must be found, i.e., in English. If, for instance, you have defined "Français" in the preferences of VISION, you just have to create the directory "Français" in the folder LDV, and to include the file INVERT.INI translated in French in this directory, for VISION to seek this file instead of the one included directly in the LDV directory.

In the [Informations] section, VISION expects the following entries:

Name of entry | Size | Description
ShortName | Max. 15 characters | Short name of the module appearing in the list of modules to select
LongName | Max. 31 characters | Name appearing when details are required on this LDV
Description | Max. 79 characters | Complete description of the module on 3 lines

3.5.2 Parameters of the LDV

VISION allows to enter up to 4 parameters in an LDV. These parameters are entered using GEM sliders that appear or not according to the number of input parameters of the LDV.
For VISION to accept to display a parameter, a section named [ParameterN] (1 <= N <= 4) must be created with the following entries:

Name of entry | Description
Name | Name of this parameter (max. 15 characters). If the name is not given, this parameter will not appear
Type | 0: 16 bits integer(-32768 --> +32767) 1: float (not handled currently)
MinValue | Minimum allowed value for this parameter
DefautValue | Default value given in VISION GUI
MaxValue | Maximum allowed value for this parameter

|  | VISION Documentation (LDV) |  | Last update: 29/10/00
Download documentation | 3. D E S C R I P T I O N |