RGNXFORM

Summary

The RGNXFORM structure provides data for translating between region coordinates and external representations of those coordinates.

Syntax

typedef struct _RGNXFORM 
{ 
   L_UINT uViewPerspective; 
   L_INT nXScalarNum; 
   L_INT nXScalarDen; 
   L_INT nYScalarNum; 
   L_INT nYScalarDen; 
   L_INT nXOffset; 
   L_INT nYOffset; 
} RGNXFORM, *pRGNXFORM; 

Members

uViewPerspective

The view perspective of the external representation. Valid values are:

For descriptions, refer to Accounting for View Perspective.

nXScalarNum

The numerator for the X scaling factor.

nXScalarDen

The denominator for the X scaling factor.

nYScalarNum

The numerator for the Y scaling factor.

nYScalarDen

The denominator for the Y scaling factor.

nXOffset

The X offset of the external representation.

nYOffset

The Y offset of the external representation.

Comments

pRGNXFORM is a pointer to an RGNXFORM structure. Generally, where a function parameter type is pRGNXFORM, you can declare an RGNXFORM variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pRGNXFORM variable is necessary only if your program requires a pointer.

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.

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.

This topic provides a general description of how fields in the structure work. For a description of common usage, refer to Translating Coordinates for a Bitmap Region.

When assigning an external representation to a bitmap (pointed to by pBitmap), every point (Xa, Ya) in the an external representation is transformed (by structure XForm) to point (Xc, Yc) in the bitmap's region as follows:

Add offsets:

Xb = Xa + XForm.nXOffset   
Yb = Ya + XForm.nYOffset 

Multiply by scalars:

Xc = (Xb * XForm.nXScalarNum) / XForm.nXScalarDen   
Yc = (Yb * XForm.nYScalarNum) / XForm.nYScalarDen 

Compensate for view perspective (updating Xc and Yc in place):

LBitmapBase::PointToBitmap(pBitmap, XForm.uViewPerspective, Xc, Yc) 

When retrieving an external representation from a bitmap (pointed to by pBitmap), every point (Xa, Ya) in the bitmap's region is transformed (by structure XForm) to point (Xc, Yc) in the external region as follows:

Compensate for view perspective (updating Xa and Ya in place):

LBitmapBase::PointFromBitmap(pBitmap, XForm.uViewPerspective, Xa, Ya) 

Multiply by scalars:

Xb = (Xa * XForm.nXScalarNum) / XForm.nXScalarDen   
Yb = (Ya * XForm.nYScalarNum) / XForm.nYScalarDen 

Add offsets:

Xc = Xb + XForm.nXOffset   
Yc = Yb + XForm.nYOffset 

Usage

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

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