GraphicTransform- Modifies the graphic transformation coefficients
Modifies the geometric transformation coefficients applied to the graphic's coordinate system during the rendering of figures.
- GraphicTransform(TX, TY)
Parameters:
- TX (float): transformation coefficient on the horizontal axis (X).
- TY (float): transformation coefficient on the vertical axis (Y).
Description:
The `GraphicTransform` instruction defines the transformation factors applied to the graphic coordinates before the actual drawing of figures. This function allows altering the geometric behavior of the entire graphic by directly affecting the X and Y axes, enabling: horizontal scaling; vertical scaling; specular inversion (mirroring); proportional or non-proportional deformation; flipping of the drawing.
Transformation values are applied by multiplying the coordinates along each axis. Additionally, an automatic offset is calculated that allows keeping the drawing within the visible graphic area. The instruction is independent of GraphicScale and GraphicOffset.
Standard values:
- TX = 1: no horizontal transformation;
- TY = 1: no vertical transformation.
The value (1,1) therefore represents the default neutral configuration.
Effects of values:
Values greater than 1: Enlarge the graphic along the corresponding axis.
Values between 0 and 1: Reduce the graphic along the corresponding axis.
Negative values: Invert the axis direction, producing a mirroring effect.
Associated constants:
The current transformation values are available through two constants: TransformX and TransformY. These constants allow dynamic reading or reuse of the current configuration.
Examples:
Draw two mirrored lines
Line(0,0, 20,50)
GraphicTransform(-1,1)
Line(0,0, 20,50)
The second line will be reflected along the horizontal axis.
Vertically compress a rectangle
GraphicTransform(1,0.5)
Rectangle(10,10, 40,30)
The figure's height will be reduced by 50%.
Vertically flip a figure
GraphicTransform(1,-1)
Triangle(30,30, 50,60, 10,60)
The triangle will be rendered with vertical inversion relative to the origin.
Horizontally enlarge
GraphicTransform(2,1)
Ellipse(20,20,15,10)
The ellipse will appear stretched along the X axis.