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.

Built-in Actions

LEADTOOLS supports the following built-in actions:

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

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

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

image\sqrblit.gif Offset: Changes the offset of the image within the cell.

image\sqrblit.gif Magnifying Glass: Magnifies the image in the cell.

image\sqrblit.gif Stack: Scrolls the images within the cell.

image\sqrblit.gif Annotation ruler: adds a ruler object to the cell.

image\sqrblit.gif Annotation rectangle: adds a rectangle object to the cell.

image\sqrblit.gif Annotation ellipse: adds an ellipse object to the cell.

image\sqrblit.gif Annotation angle: adds an angle object to the cell.

image\sqrblit.gif Annotation highlight: adds a highlight object to the cell.

image\sqrblit.gif Annotation arrow: adds an arrow object to the cell.

image\sqrblit.gif Annotation text: adds a text object to the cell.

image\sqrblit.gif Rectangle region: adds a rectangle region to the cell.

image\sqrblit.gif Square region: adds a square region to the cell.

image\sqrblit.gif Elliptical region: adds an elliptical region to the cell.

image\sqrblit.gif Circular region: adds a circular region to the cell.

image\sqrblit.gif Free hand region: adds a free hand region to the cell.

image\sqrblit.gif Polygon region: adds a polygon region to the cell.

image\sqrblit.gif Magic Wand region: adds a magic wand region to the cell.

image\sqrblit.gif Color Range region: adds a color range region to the cell.

Custom Actions

Custom actions are completely controlled by the user, including any mouse movement and keystroke association. These are handled 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.

Adding Actions

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

Next, assign a mouse button or a keyboard key to the action. To assign a mouse button to the action, call  L_DispContainerSetAction, and pass the action and associated mouse button values together. An action can only be assigned to one mouse button.

To assign a keyboard shortcut to the action use the function L_DispContainerSetKeyboardAction. To get the current keystroke combination associated with a specific action, call L_DispContainerGetKeyboardAction.

Once the action has been added, it is considered "active". To determine whether a specific action is active, call L_DispContainerIsActionActive. To check whether the button or the flag is valid to be assigned to the specific action, use the function L_DispContainerIsButtonValid.

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. You can also retrieve the assigned mouse button and flags to the specified action by calling the function L_DispContainerGetActionButton.

Action Properties

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 also 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.

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.

For more information on the properties of the various actions, refer to the following structures:

DISPWLEVELACTIONPROPS

DISPALPHAACTIONPROPS

DISPMAGACTIONPROPS

DISPOFFSETACTIONPROPS

DISPSCALEACTIONPROPS

DISPSTACKACTIONPROPS

DISPOWNERACTIONPROPS

DISPANNOTATIONPROPS

DISPREGIONPROPS