Translating Coordinates for a Bitmap Region - Raster Imaging C API Help

Translating Coordinates for a Bitmap Region

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 L_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 L_FrameBitmapRgn, L_GetBitmapRgnBounds, and L_GetBitmapRgnHandle.

 

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 L_SetBitmapRgnEllipse, L_SetBitmapRgnHandle, L_SetBitmapRgnPolygon, L_SetBitmapRgnRect, and L_SetBitmapRgnRoundRect.

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.

Regions are not supported on Windows CE.

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

Help Version 20.0.2018.7.30
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help