L_AnnSetROP2

#include "l_bitmap.h"

L_LTANN_API L_INT L_AnnSetROP2(hObject, uROP2, uFlags)

HANNOBJECT hObject;

/* handle to the annotation object */

L_UINT uROP2;

/* constant that specifies a ROP code */

L_UINT uFlags;

/* flags that determine which objects to process */

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

This function is available in the Document and Medical Imaging toolkits.

Parameter

Description

hObject

Handle to the annotation object.

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

 

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.

 

The default value is ANNROP2_COPY.

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

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:

ANNOBJECT_CROSSPRODUCT

ANNOBJECT_CURVE

ANNOBJECT_CURVECLOSED

ANNOBJECT_ELLIPSE

ANNOBJECT_FREEHAND

ANNOBJECT_FREEHANDHOTSPOT

ANNOBJECT_LINE

ANNOBJECT_POINTER

ANNOBJECT_POINT

ANNOBJECT_POLYGON

ANNOBJECT_POLYLINE

ANNOBJECT_POLYRULER

ANNOBJECT_PROTRACTOR

ANNOBJECT_RECT

ANNOBJECT_RULER

ANNOBJECT_STAMP

ANNOBJECT_TEXTPOINTER

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

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 2000 / XP/Vista.

See Also

Functions:

L_AnnGetROP2, L_AnnSetBackColor, L_AnnSetForeColor, L_AnnGetSelected, L_AnnSetSelected, L_AnnGetTransparent, L_AnnSetTransparent, L_AnnGetFillMode, L_AnnSetFillMode, L_AnnGetOptions, L_AnnSetOptions

Topics

Annotation Functions (Document/Medical only) Displaying Annotations

 

Annotation Objects - Automated Features

 

Implementing an Automated Annotation Program

 

Implementing a Non-automated Annotation Program

 

Altering Annotation Object Settings

 

Annotation Functions (Document/Medical only): Getting and Setting the ROP2 Property

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;
}