In This Topic ▼

Low-Level Coordinate System for Annotations

(Document and Medical Imaging toolkits)

The coordinates for defining and positioning LEADTOOLS annotations are stored in floating point values that are translated to device coordinates only when the annotations are displayed. Each annotation object is defined and positioned relative to its container. The root container sets the frame of reference.

At the time of display, the coordinates are first multiplied by the values of the X and Y scalar properties (scaling factors), and are then offset by the values of the X and Y offset properties. Thus, the scaling factors translate the internal values to the coordinate system of the display space, and the offsets position the scaled object in the display space.

The LEADTOOLS automated annotation functions use this system to match annotations to a displayed image as follows:

  1. Set the root container's coordinates as follows: 0, 0, bitmap width -1, bitmap height -1.

  2. Set the X and Y scaling factors of the root container using the source and destination rectangles of the LEADTOOLS painting function. For example, the X scaling factor would be calculated by dividing the width of the destination rectangle by the width of the source rectangle. For an explanation of the source and destination rectangles, refer to the L_PaintDC function.

  3. Set the X and Y offsets of the root container to the same values as the left and top fields of the painting function's destination rectangle.

  4. Each time the image is zoomed or scrolled, update the scaling factors and offsets of the root container, and redraw annotation objects in the window.

This system provides flexibility in storing and transporting annotations. You can adapt the annotations to any unit of measure, such as twips or millimeters. You can also set the root container's width and height to arbitrary measurements, such as 1000 by 1000, that you adjust when applying the container's annotations to a bitmap image.

Note: Scaling factors and offsets can be applied to objects other than the root container, but that is not necessary for matching the annotations to the displayed image. The scaling factors and offsets of a container apply to all objects within the container.

Scaling factors:

Offsets:

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

LEADTOOLS Raster Imaging C API Help