Translating Coordinates for a Region

Several of the LEADTOOLS methods and classes for creating and working with a region use coordinates from an external representation of the region, such as a shape drawn in a device context.

To compensate for possible differences in view perspective, scaling, and display offsets, these LEADTOOLS methods or classes require that you provide translation information in a RasterRegionXForm class. (For details on how information is translated, refer to the structure description.)

In most cases, the external representation of a region is scaled and positioned relative to the display coordinates of a LEADTOOLS painting method. Therefore, the following table describes the fields to set in the RasterRegionXForm class, based on the parameters of the Paint method:

Property

Description

ViewPerspective

The view perspective of the external representation. With LEADTOOLS painting methods, the view perspective is always TopLeft.

XScalarNumerator

The numerator for the X scaling factor.

When translating information from the image, you can use the width of the painting method's destination rectangle for this value. Methods that translate in this direction are FrameRegion, GetRegionBounds, and GetGdiRegionData

When translating information to the image, you can use the width of the painting method's source rectangle for this value. (By default, it is the image width.) Methods that translate in this direction are AddEllipseToRegion, AddGdiDataToRegion, AddPolygonToRegion, AddRectangleToRegion, and AddRoundRectangleToRegion.

XScalarDenominator

The denominator for the X scaling factor.

When translating information from the image, you can use the width of the painting method's source rectangle for this value. (By default, it is the image width.)

When translating information to the image, you can use the width of the painting method's destination rectangle for this value.

Refer to the XScalarNumerator property to see which methods translate which direction.

YScalarNumerator

The numerator for the Y scaling factor.

When translating information from the image, you can use the height of the painting method's destination rectangle for this value.

When translating information to the image, you can use the height of the painting method's source rectangle for this value. (By default, it is the image height.)

Refer to the XScalarNumerator property to see which methods translate which direction.

YScalarDenominator

The denominator for the Y scaling factor.

When translating information from the image, you can use the height of the painting method's source rectangle for this value. (By default, it is the image height.)

When translating information to the image, you can use the height of the painting method's destination rectangle for this value.

Refer to the XScalarNumerator property to see which methods translate which direction.

XOffset

The X offset of the external representation.

When translating information from the image, you can use the left value of the painting method's destination rectangle.

When translating information to the image, you can negate the left value of the painting method's destination rectangle (-left).

Refer to the XScalarNumerator property to see which methods translate which direction.

YOffset

The Y offset of the external representation.

When translating information from the image, you can use the top value of the painting method's destination rectangle.

When translating information to the image, you can negate the top value of the painting method's destination rectangle (-top).

Refer to the XScalarNumerator property to see which methods translate which direction.

All region methods accept a NULL pointer for this structure. In that case, no transformation occurs. The scalar fields default to 1, the offsets default to 0, and the view perspective defaults to the image's view perspective.

Related topics:

Help Version 19.0.2017.10.19
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document