L_AnnSetAutoHilightPen

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetAutoHilightPen(hAutomation, crHilight)

Sets the color of the pen that is used for highlighting.

Parameters

HANNOBJECT hAutomation

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

COLORREF crHilight

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

Returns

Value Meaning
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:

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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

This sample changes the annotation highlight pen for the existing automation object,
and for all automation objects that will be created.

L_INT AnnSetAutoHilightPenExample(HANNOBJECT hAutomation) 
{ 
   L_INT nRet; 
   // Change the highlight pen for the existing automation object 
   nRet = L_AnnSetAutoHilightPen(hAutomation, RGB(0xC0, 0xC0, 0xC0)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Change the default highlight pen--all newly created automation objects will have this for the default highlight pen 
   nRet = L_AnnSetAutoHilightPen(NULL, RGB(0xC0, 0xC0, 0xC0)); 
   if(nRet != SUCCESS) 
      return nRet; 
   return SUCCESS; 
} 

Help Version 21.0.2023.2.15
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.