Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

Translating Coordinates for a Bitmap Region

Show in webframe

Several of the LEADTOOLS functions for creating and working with a bitmap 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 functions require that you provide translation information in an RGNXFORM structure. (For details on how information is translated, refer to the structure description.)

In most cases, the external representation of a bitmap region is scaled and positioned relative to the display coordinates of a LEADTOOLS painting function. Therefore, the following table describes the fields to set in the RGNXFORM structure, based on the parameters of the LPaint::PaintDC function:

Sample Field Name

Description

XForm.uViewPerspective

The view perspective of the external representation. With LEADTOOLS painting functions, the view perspective is always TOP_LEFT.

XForm.nXScalarNum

The numerator for the X scaling factor.

 

When translating information from the bitmap, you can use the width of the painting function's destination rectangle for this value. Functions that translate in this direction are LPaint::FrameRgn, LBitmapRgn::GetRgnBounds, and LBitmapRgn::GetRgnHandle.

 

When translating information to the bitmap, you can use the width of the painting function's source rectangle for this value. (By default, it is the bitmap width.) Functions that translate in this direction are LBitmapRgn::SetRgnEllipse, LBitmapRgn::SetRgnHandle, LBitmapRgn::SetRgnPolygon, LBitmapRgn::SetRgnRect, and LBitmapRgn::SetRgnRoundRect.

XForm.nXScalarDen

The denominator for the X scaling factor.

 

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

 

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

 

Refer to the nXScalarNum field to see which functions translate which direction.

XForm.nYScalarNum

The denominator for the Y scaling factor.

 

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

 

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

 

Refer to the nXScalarNum field to see which functions translate which direction.

XForm.nYScalarDen

The denominator for the Y scaling factor.

 

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

 

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

 

Refer to the nXScalarNum field to see which functions translate which direction.

XForm.nXOffset

The X offset of the external representation.

 

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

 

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

 

Refer to the nXScalarNum field to see which functions translate which direction.

XForm.nYOffset

The Y offset of the external representation.

 

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

 

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

 

Refer to the nXScalarNum field to see which functions translate which direction.

All region functions 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 bitmap's view perspective.

Related topics:

Creating a Bitmap Region

Working with the Existing Bitmap Region

Functions Where the Region Preempts the Bitmap

Functions that Transform the Region and the Bitmap

Saving a Region

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.