Implementing Annotations

Note:

This topic is for Document/Medical only.

LEADTOOLS maintains annotations separately from bitmaps. Annotations, which are based on vectored drawing functions, are associated with a bitmap only as an overlay of the displayed image. Ordinarily, your application code is responsible for maintaining the relationships between images and annotations. For example, the annotation example that ships with LEADTOOLS, creates an annotation file that has the same name as its associated image file, but with a different extension. When the image file is loaded, the program looks for an associated annotation file and loads it as well.

The LEAD control implements annotations by turning on automated features. You can set the following property to let a user add annotations (in design mode) or view annotations (in run mode). You can also use this property to make the annotations invisible.

AnnUserMode property

In design mode, the following property lets you select an annotation tool:

AnnTool property

Run mode activation of a hot spot or button annotation generates the following event where you can add your own code:

AnnClicked event

If your application requires you to uniquely identify an annotation object, you can use the following methods to maintain numeric tags, and retrieve an object based on that tag:

AnnSetTag method

AnnGetTag method

AnnGetObjectFromTag method

The following method lets you identify the type of the specified annotation object:

AnnGetType method

To determine the number of items present in an object, use the following:

AnnEnumerate event

AnnEnumerate method

The following events let you add code to adapt your application to the automated annotation features:

AnnChange event

AnnCreate event

AnnDestroy event

AnnDrawn event

AnnSelect event

The following properties let you get the boundaries of the bounding rectangle of the specified annotation object:

AnnBoundingRectHeight property

AnnBoundingRectLeft property

AnnBoundingRectTop property

AnnBoundingRectWidth property

The following methods let you flip, reverse, rotate, or move annotations programmatically:

AnnFlip method

AnnReverse method

AnnRotate method

AnnMove method

AnnRectHeight property

AnnRectLeft property

AnnRectTop property

AnnRectWidth property

AnnBringToFront method

AnnSendToBack method

The following properties and methods let you create, manipulate and destroy annotation objects:

AnnAutoUpdate property

AnnCreate method

AnnCreateItem method

AnnDefine method

AnnDestroy method

AnnGetVisible method

AnnInsert method

AnnRectLeft property

AnnRectHeight property

AnnRectLeft property

AnnRectWidth property

AnnSetAutoDefaults method

AnnSetSelected method

AnnSetVisible method

AnnRemove method

AnnAlpha property

AnnAutoCursor property

AnnAutoSnapCursor property

AnnCalibrateRuler method

AnnFillMode property

AnnGetAutoBackColor method

AnnGetFillMode method

AnnGetFillModeExt method

AnnGetOptions method

AnnRectLeft property

AnnRectTop property

AnnRectHeight property

AnnRectWidth property

AnnGetRotateOptions method

AnnGetShowFlags method

AnnGetTextOptions method

AnnSetAutoBackColor method

AnnSetFillMode method

AnnSetFillModeExt method

AnnSetOptions method

AnnSetRotateOptions method

AnnSetShowFlags method

AnnSetTextOptions method

AnnSetVisible method

AnnShowBorder property

AnnShowRotateHandles property

AnnShowText property

AnnTextColor property

AnnTextEdit method

LEADTOOLS provides support for displaying annotations within a magnifying glass. For more information on this, refer to Customizing Magnifying Glass Painting.

The following methods let you group or ungroup annotations:

AnnGetGrouping method

AnnGroup method

AnnSetGrouping method

AnnUngroup method

For more information on grouping and ungrouping annotations, refer to Grouping and Ungrouping Annotation Objects.

The following methods and properties provide selection capabilities:

AnnCut method

AnnGetContainer method

AnnGetSelectCount method

AnnGetSelected method

AnnGetTopContainer method

AnnGetType method

AnnHitTestExt method

AnnInsert method

AnnRemove method

AnnSelectPoint method

AnnSelectRectHeight property

AnnSelectRect method

AnnSelectRectLeft property

AnnSelectRectTop property

AnnSelectRectWidth property

AnnSetSelected method

AnnShowLockedIcon property

You can manipulate the mouse when working with annotations using the following:

AnnMouseDown event

AnnMouseMove event

AnnMouseUp event

SetMousePos method

The following method lets you apply annotations to the bitmap, itself.

AnnRealize method

The following method lets you restore the background of redact objects.

AnnUnrealize method

The following methods let you load annotations from a file or save them to a file:

AnnLoad method

AnnDataPath method

AnnLoadArray method

AnnLoadMemory method

AnnSave method

AnnSaveArray method

AnnSaveMemory method

The following method lets you save annotations in a Wang compatible TIFF tag:

AnnSaveTag method

The following methods and property support Windows clipboard operations:

AnnCopy method

AnnCut method

AnnPasteReady property

AnnPaste method

The following properties and methods let you control and customize the menus and other text strings that appear in automation mode:

AnnAutoDialogFontSize property

AnnAutoMenuEnable property

AnnAutoDrawEnable property

AnnGetAutoText method

AnnSetAutoText method

AnnGetAutoMenuItemEnable method

AnnSetAutoMenuItemEnable method

For information on modifying the annotation automation menu through the AnnMenu object, refer to Annotation Menu.

To undo changes made to objects or automation operations, use the following methods and properties:

AnnAddUndoNode method

AnnUndo method

AnnUndoDepth property

AnnUndoEnable property

For more information on undoing operations, refer to Undoing Automation Operations.

The following methods let you handle a region:

AnnGetArea method

AnnGetRgnHandle method

The following methods let you work with the Ruler object:

AnnGetDistance method

AnnGetBitmapDpiX method

AnnGetBitmapDpiY method

AnnGetGaugeLength method

AnnSetGaugeLength method

The following methods let you handle the annotation object characteristics:

AnnAlpha property

AnnAutoSnapCursor property

AnnCalibrateRuler method

AnnFillMode property

AnnGetAutoBackColor method

AnnGetBackColor method

AnnGetFillMode method

AnnGetFillModeExt method

AnnGetFillPattern method

AnnGetFontBold method

AnnGetFontItalic method

AnnGetFontName method

AnnGetFontSize method

AnnGetFontStrikeThrough method

AnnGetFontUnderline method

AnnGetForeColor method

AnnGetLineStyle method

AnnGetLineWidth method

AnnGetMetafile method

AnnGetNodes method

AnnGetOptions method

AnnGetPolyFillMode method

AnnGetPredefinedMetafile method

AnnGetRotateOptions method

AnnGetSelected method

AnnGetText method

AnnGetTextOptions method

AnnGetUnit method

AnnHitTest method

AnnSelectPoint method

AnnSetAutoBackColor method

AnnSetBackColor method

AnnSetFillMode method

AnnSetFillModeExt method

AnnSetFillPattern method

AnnSetFontBold method

AnnSetFontItalic method

AnnSetFontName method

AnnSetFontSize method

AnnSetFontStrikeThrough method

AnnSetFontUnderline method

AnnSetForeColor method

AnnSetLineStyle method

AnnSetLineWidth method

AnnSetMetafile method

AnnSetNameOptions method

AnnSetNameOptions method

AnnSetNodes method

AnnSetOptions method

AnnSetPolyFillMode method

AnnSetPredefinedMetafile method

AnnSetRotateOptions method

AnnSetText method

AnnSetTextOptions method

AnnShowBorder property

AnnShowRotateHandles property

AnnShowText property

AnnTextColor property

AnnTextEdit method

The following methods let you use ROP2:

AnnGetROP2 method

AnnSetROP2 method

The following properties and methods let you control and customize the rotation options:

AnnSetRotateOptions method

AnnGetRotateOptions method

AnnShowRotateHandles property

The following methods let you handle the bitmap:

AnnGetBitmap method

AnnGetTransparentColor method

AnnSetBitmap method

AnnSetBitmapDpiX method

AnnSetBitmapDpiY method

AnnSetTransparentColor method

AnnGetTransparent method

AnnSetTransparent method

AnnGetSecondaryBitmap method

AnnSetSecondaryBitmap method

Use the AnnSetOptions method and the AnnGetOptions method to control the following features:

image\sqrblit.gif Rubber Stamp Display Style

image\sqrblit.gif XP Style Annotation Toolbar

image\sqrblit.gif Alpha Background Fill Option

image\sqrblit.gif Annotation Rotate Option

image\sqrblit.gif Annotation Side Handles

image\sqrblit.gif Annotation Multiselect

image\sqrblit.gif Annotation Cursors

image\sqrblit.gif ESC to Cancel

image\sqrblit.gif Calibrate Ruler Feature

image\sqrblit.gif Dot Dash Lines

image\sqrblit.gif Text Annotation Options

For more information about these features, refer to New Annotation Features of Version 14.5.

When painting annotations on a bitmap, normally, the image is painted first, and then the annotations are rendered. This can cause flicker, and, it allows the portion under the annotation objects, for example a Redact object, to be visible. To avoid this flicker, enable double buffer image display by setting the DoubleBuffer property to TRUE.

The following methods and properties let you select annotation objects relative to a window:

AnnSelectPoint method

AnnSelectRect method

AnnSelectRectHeight property

AnnSelectRectLeft property

AnnSelectRectTop property

AnnSelectRectWidth property

You can use LEADTOOLS DLL functions to further customize the automated annotation features. Keep in mind, however, that the COM Object relies on particular ways of identifying, scaling and positioning annotation objects. Modifying the behavior with DLL functions can break the automated features. The following methods, properties can be helpful when using DLL functions:

AnnContainer property

AnnGetContainer method

AnnGetTopContainer method

AnnAutomation property

AnnGetSelectCount method

AnnGetSelectList method

AnnGetPointCount method

AnnGetPointX method

AnnGetPointY method

User Interface for Annotations

In design mode, you can select tools using the AnnTool property and draw annotation objects over the image in the window. You can then use the right mouse button to get a pop-up menu that is tailored to each object type. You can include the Annotation Toolbar to make tool selection easier. The toolbar and the pop-up menu appear as shown in the following example:

 

 

 

The popup menu is context sensitive. It lists only the properties that can be changed on the selected object or objects. If you use the popup menu to change a property, the value that you specify is applied to the current selection, and it becomes the default for the next object.

The following topics describe the automated annotation features for particular objects and tools:

image\sqrblit.gif Setting Defaults

image\sqrblit.gif Selection Pointer Tool

image\sqrblit.gif Line Tool

image\sqrblit.gif Rectangle Tool

image\sqrblit.gif Ellipse Tool

image\sqrblit.gif Polyline Tool

image\sqrblit.gif Polygon Tool

image\sqrblit.gif Pointer Tool

image\sqrblit.gif Freehand Line Tool

image\sqrblit.gif Highlight Tool

image\sqrblit.gif Redaction Tool

image\sqrblit.gif Text Tool

image\sqrblit.gif Note Tool

image\sqrblit.gif Stamp Tool

image\sqrblit.gif Hot spot Tool

image\sqrblit.gif Button Tool

image\sqrblit.gif Audio Clip Tool

image\sqrblit.gif Ruler Tool

image\sqrblit.gif Cross product Tool

image\sqrblit.gif Point Tool

image\sqrblit.gif Protractor Tool

image\sqrblit.gif PushPin Tool

image\sqrblit.gif Freehand Hot Spot Tool

image\sqrblit.gif Rubber Stamp Tools

image\sqrblit.gif Curve Tool

image\sqrblit.gif Closed Curve Tool

image\sqrblit.gif Rich Text Tool

image\sqrblit.gif PolyRuler Tool

image\sqrblit.gif Encrypt Tool

image\sqrblit.gif Text Pointer Tool

See Also

image\sqrblit.gif Grouping and Ungrouping Annotation Objects

image\sqrblit.gif Annotation Toolbar

image\sqrblit.gif Annotation Menu

image\sqrblit.gif New Annotation Features of Version 14.5

image\sqrblit.gif Calibrating Annotation Ruler Objects