L_AnnSetROP2

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetROP2(hObject, uROP2, uFlags)

Sets the binary raster operation (ROP2) code for one or more annotation objects.

Parameters

HANNOBJECT hObject

Handle to the annotation object.

L_UINT uROP2

Constant that specifies the ROP2 code for one or more objects. ROP2 codes specify how pen or brush colors are to be combined with the colors in the image. Possible ROP2 code values are:

Value Meaning
ANNROP2_COPY [0x0000] Draw the object using the object's color. This is the default value.
ANNROP2_AND [0x0001] Draw the object, performing an AND operation using the object's color and the background color. This creates a highlight effect. White objects become transparent.
ANNROP2_XOR [0x0002] Draw the object, performing an XOR operation using the object's color and the background color. This creates an inverted effect. Black objects become transparent.

L_UINT uFlags

Flags that determine which objects to process. Most of the flags apply only to container objects. You can combine values when appropriate by using a bitwise OR ( | ). The following are valid values:

Value Meaning
0 Process only the specified object.
ANNFLAG_SELECTED [0x0001] Process only objects that have the selected property set to TRUE. For getting and setting the selected property, use the L_AnnGetSelected and L_AnnSetSelected functions.
ANNFLAG_NOTTHIS [0x0004] Process only one level of objects within the specified container, not the container itself. If there are containers within the container, they are modified, but the objects within them are not.
ANNFLAG_RECURSE [0x0008] Process objects within a container, and within any subcontainers, down to any level.
ANNFLAG_NOTCONTAINER [0x0002] (Used with ANNFLAG_RECURSE) Process objects within containers, not the containers themselves.
ANNFLAG_NOINVALIDATE [0x0010] Do not invalidate the affected rectangle in the window. Use this to avoid generating unwanted paint messages.
ANNFLAG_CHECKMENU [0x0020] Process objects only if the ANNAUTOTEXT_MENU_ROP2 menu item has been selected.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

The L_AnnSetROP2 function can be used to turn a simple rectangle into a hilite-type object. This is the only way to have a hilite object that has different colors for border and interior. To do that, draw a rectangle with a thick border, choose different foreground and background colors (using L_AnnSetForeColor and L_AnnSetBackColor), and call this function with uROP2 set to ANNROP2_AND.

L_AnnSetROP2 is valid only for the following object types:

In addition, the Automation object stores ROP2 settings along with the other object default settings

Note that L_AnnSetROP2 and L_AnnSetFillMode affect each other. If you set uFillMode to ANNMODE_OPAQUE, then uROP2 cannot be ANNROP2_AND. If you set uFillMode to ANNMODE_TRANSLUCENT, then uROP2 has to be ANNROP2_AND. If you set uFillMode to ANNMODE_TRANSPARENT, uROP2 can be anything.

Use the L_AnnGetROP2 function to obtain the ROP2 code being used for one or more annotation objects.

When working with automated annotations, note that it is possible to change the color of the pen that is used for highlighting and selecting by setting the L_AnnSetAutoHilightPen function for that automation object.

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT AnnSetROP2Example(HANNOBJECT hAnnObject) 
{ 
   L_INT nRet; 
   L_UINT uRop2; /* ROP2 code */ 
 
   /* Get the current ROP2 code */ 
   nRet = L_AnnGetROP2(hAnnObject, &uRop2); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   /* if the code is not ANNROP2_AND, make it so */ 
   if(uRop2 != ANNROP2_AND) 
   { 
      /* make sure the FillMode is set to Transparent */ 
      nRet = L_AnnSetFillMode(hAnnObject, ANNMODE_TRANSPARENT, 255, ANNFLAG_RECURSE); 
      if(nRet != SUCCESS) 
         return nRet; 
 
      /* set ROP2 code */ 
      nRet = L_AnnSetROP2(hAnnObject, ANNROP2_AND, ANNFLAG_RECURSE); 
      if(nRet != SUCCESS) 
         return nRet; 
   } 
   return SUCCESS; 
} 
Help Version 20.0.2019.9.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help