L_AnnSetAutoHilightPen

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_AnnSetAutoHilightPen(hAutomation, crHilight)

HANNOBJECT hAutomation;

/* handle to an automation object */

COLORREF crHilight;

/* color of pen used for highlighting */

Sets the color of the pen that is used for highlighting. This function is available in Document/Medical toolkits

Parameter

Description

hAutomation

Handle to the annotation automation object. Pass NULL to change the default, which affects newly created automation objects.

crHilight

A COLORREF value representing the color of the pen used for highlighting.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Use this function to change the color of the pen that is used for highlighting and selecting. More specifically, this pen is used in the following situations:

image\sqrblit.gif In automated annotation design mode, after selecting ANY tool and clicking and dragging the mouse to draw an outline. The resulting outline is displayed using the highlight pen.

image\sqrblit.gif In automated annotation design mode, after choosing the Select tool and clicking on an existing annotation object. While the left mouse button is held down, the selected object is displayed using the highlight pen.

The highlighting is implemented by taking the "exclusive-or" (XOR) of the highlight pen color and the underlying image pixels.

The default highlight pen has a COLORREF value of 0xFFFFFF (white). This color works well for most images. However, images that have many mid-range gray colors will not effectively show a highlight. To understand why this is so, consider an image that contains only the color gray 0x808080. The highlight color will be determined as follows:

 Highlight Color  = (0xFFFFFF) XOR (0x808080)

   = 0x7F7F7F

The highlight color (0x7F7F7F) (gray) and the underlying image color (0x808080) (gray) are almost the same color, and nearly indistinguishable to the naked eye. In cases like this, the highlight will not be visible.

To avoid this, choose a different highlight pen color so that the XOR operation with the underlying color will give a result that is visibly different from the underlying color.

A good choice is 0xC0C0C0 (silver). Using this color the highlight color will be determined as follows:

 Highlight Color = (0xC0C0C0) XOR (0x808080)

   = 0x404040

The resulting highlight color (0x404040) is another gray, but is more visible and stands out much more clearly against the underlying image color (0x808080), allowing for easy differentiation between the two.

Note that several of the automated mode annotation cursors are displayed using an XOR operation. These cursors will not be visible if an image has many mid-range values. To avoid this, define new cursors and use the L_AnnSetAutoCursor function. The main annotation demo (ANNOT32.EXE) demonstrates how to change the highlight pen and the annotation cursors.

Each automation object can have its own highlight pen color. To change the default highlight pen for newly created automation objects, pass NULL for the hAutomation parameter. The only way to restore the default color is to call L_AnnSetAutoHilightPen and set the color back to the original value (0xFFFFFF).

Required DLLs and Libraries

LTANN

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Windows 95 / 98 / Me, Windows 2000 / XP.

See Also

Functions:

L_AnnGetAutoBackColor, L_AnnGetAutoContainer, L_AnnGetAutoCursor, L_AnnGetAutoDialogFontSize, L_AnnGetAutoDrawEnable, L_AnnGetAutoMenuEnable, L_AnnGetAutoMenuItemEnable, L_AnnGetAutoMenuState, L_AnnGetAutoOptions, L_AnnGetAutoText, L_AnnGetAutoTextLen, L_AnnGetAutoUndoEnable, L_AnnSetAutoBackColor, L_AnnSetAutoContainer, L_AnnSetAutoCursor, L_AnnSetAutoDefaults, L_AnnSetAutoDialogFontSize, L_AnnSetAutoDrawEnable, L_AnnSetAutoMenuEnable, L_AnnSetAutoMenuItemEnable, L_AnnSetAutoMenuState, L_AnnSetAutoOptions, L_AnnSetAutoText, L_AnnSetAutoUndoEnable, L_AnnGetFillModeExt, L_AnnSetFillModeExt, L_AnnGetOptions, L_AnnSetOptions

Topics:

Grayscale Images

 

Changing the Annotation Automation Pen Highlight Color

 

Displaying Annotations

 

Implementing Automation

 

Annotation Automation Object

 

Altering Annotation Object Settings

 

Using Color Values in LEADTOOLS

 

Color Halftone and Halftone Images

Example

// This sample changes the annotation highlight pen for the existing automation object,
// and for all automation objects that will be created
L_VOID SampleAnnSetHilightPen(HANNOBJECT hAutomation)
{
   // Change the highlight pen for the existing automation object
   L_AnnSetAutoHilightPen(hAutomation, RGB(0xC0, 0xC0, 0xC0));

   // Change the default highlight pen--all newly created automation objects will have this for the default highlight pen
   L_AnnSetAutoHilightPen(NULL, RGB(0xC0, 0xC0, 0xC0));
}