Function GraScale() Foundation
Calculates scaling transformation for a matrix.
GraScale( [<oPS>], <aMatrix>, <aScale>, ;
<aPoint> , [<nMode>] ) --> lSuccess
Constant | Description |
---|---|
GRA_TRANSFORM_REPLACE | Replaces the existing <aMatrix> transformation after the transformation |
GRA_TRANSFORM_ADD | Keeps the existing <aMatrix> transformation and calculates an additional transformation |
|
The return value of GraScale() is .T. (true) when the scaling transformation was calculated, otherwise it is .F. (false). If the return value equals .F., the cause of error can be determined using GraError().
The function GraScale() performs the matrix calculations required for scaling graphic segments (enlarging, reducing or creating a mirror image). A matrix must be passed to the function to hold the values resulting from the calculations. The matrix is a three dimensional array which must be generated by GraInitMatrix() before it is used for matrix calculations.
Graphic segments which are scaled must have been previously generated from graphic primitives. The functions GraSegOpen() and GraSegClose() are used to define a graphic segment. GraScale() performs calculations for the scaling and the function GraSegDraw() makes the scaling visible. Scaling factors larger than 1 enlarge a segment, factors between 0 and 1 reduce a segment and negative values produce a mirror image.
// In the example a box is drawn, followed by the display
// of three scaling transformations. Each scaling has
// a different point of reference which is identified by a
// marker. After each transformation a key must be
// pressed.
#include "Gra.ch"
PROCEDURE Main
LOCAL aMatrix := GraInitMatrix()
LOCAL nSegment, i
SetColor("N/W") // fill window with pale gray
CLS
nSegment := graSegOpen() // create segment
GraBox( NIL, {200,150}, {300,230}, GRA_OUTLINE )
GraSegClose()
GraSegDraw(NIL, nSegment) // draw segment
Inkey(0)
// scale
GraScale( NIL, aMatrix, {2,2}, {200,150} )
GraSegDraw(NIL, nSegment, aMatrix) // point of reference is
GraMarker( NIL, {200,150} ) // lower left corner
Inkey(0)
GraScale( NIL, aMatrix, {2,2}, {250,190} )
GraSegDraw(NIL, nSegment, aMatrix) // point of reference is
GraMarker( NIL, {250,190} ) // the mid-point of box
Inkey(0)
GraScale( NIL, aMatrix, {2,2}, {150,100} )
GraSegDraw(NIL, nSegment, aMatrix) // point of reference is left
GraMarker( NIL, {150,100} ) // below the box
Inkey(0)
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.