Applying Actions

Actions are processes that can be applied to the images attached to cells within the container/image viewer. LEADTOOLS supports several standard or "built-in" actions and custom or "user-defined" actions. The built-in actions LEADTOOLS supports are listed below:

Window Leveling: Maps grayscale intensities using a user defined color map (LUT).

Alpha: A window-leveling factor used when the window leveling lookup table is not linear.

Scale: Increases or decreases the size of the image in the cell.

Offset: Changes the offset of the image within the cell.

Magnifying Glass: Magnifies the image in the cell.

Stack: Scrolls the images within the cell.

Custom actions are completely controlled by the user, including any mouse movement and keystroke association. The user handles these custom actions through a DISPCONTAINERACTIONCALLBACK callback function. This callback function must be set, by calling L_DispContainerSetActionCallback. To determine the current callback being used to handle custom actions, call L_DispContainerGetActionCallback.

Regardless of whether the action is built-in or custom, any action must be added to a container before it can be used. To add an action to a container, call L_DispContainerAddAction. Since the Image Viewer supports custom actions, there is no limit on how many actions a container can have. However, an action cannot be added to a container twice. To determine how many actions are currently in a particular container, call L_DispContainerGetActionCount.

Once the action has been added, assign it to a mouse button using L_DispContainerSetAction. An action can be assigned to more than one mouse button. If an action has been assigned to a mouse button, it is considered "active". To determine whether a specific action is active, call L_DispContainerIsActionActive. The L_DispContainerSetAction function also lets the user decide whether the applied action will affect one cell, selected cells, or all cells in the container, and whether the action is applied during mouse movement or after mouse button release.

In addition to assigning an action to a mouse button, an action can also be assigned to a keystroke combination. To set the keystroke combination for an action, call L_DispContainerSetKeyboardAction. To get the current keystroke combination associated with a specific action, call L_DispContainerGetKeyboardAction.

Each action has both general and specific properties. The general properties, like the cursor, are common to all cells within the container. These are applied at the container level. Specific properties, such as the width used by the window level action, are used to manually change values used by the action. These are applied at the cell level. The properties used by each action are contained in an action-specific structure. Action properties that apply to the entire container can be found in the DISPCONTAINERACTIONPROPS structure. Each of the action-specific structures contains a DISPCONTAINERACTIONPROPS structure, as well as other properties, related to the specific action. Some of the additional properties related to the specific properties are also applied at the container level and are therefore "general" properties, while others are applied at the cell level and are therefore "specific" properties. For more information on the properties of the various actions, refer to the structures listed below:

DISPWLEVELACTIONPROPS

DISPALPHAACTIONPROPS

DISPMAGACTIONPROPS

DISPOFFSETACTIONPROPS

DISPSCALEACTIONPROPS

DISPSTACKACTIONPROPS

DISPOWNERACTIONPROPS

The current properties associated with a specific action. Can be retrieved by calling L_DispContainerGetActionProperties. To change the properties for a specific action, call L_DispContainerSetActionProperties.

When an action is no longer needed in a container, it can be removed by calling L_DispContainerRemoveAction.