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 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
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
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.

See Also

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

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.