The RGNXFORM structure provides data for translating between region coordinates and external representations of those coordinates.
The view perspective of the external representation. Valid values are TOP_LEFT, BOTTOM_LEFT, TOP_RIGHT, BOTTOM_RIGHT, TOP_LEFT90, TOP_LEFT270, BOTTOM_LEFT180, TOP_LEFT180, LEFT_TOP, BOTTOM_LEFT90, RIGHT_BOTTOM, and BOTTOM_LEFT270. For descriptions, refer to Accounting for View Perspective.
The numerator for the X scaling factor.
The denominator for the X scaling factor.
The numerator for the Y scaling factor.
The denominator for the Y scaling factor.
The X offset of the external representation.
The Y offset of the external representation.
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:
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):
L_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):
L_PointFromBitmap(pBitmap, XForm.uViewPerspective, Xa, Ya)
Mulitply by scalars:
Xb = (Xa * XForm.nXScalarNum) / XForm.nXScalarDen
Yb = (Ya * XForm.nYScalarNum) / XForm.nYScalarDen
Xc = Xb + XForm.nXOffset
Yc = Yb + XForm.nYOffset
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries