Translation

Constructor

Translation <id> (double tx, double ty)

Action

Specifies a translation on X axis tx and on Y axis ty for the next graphic objects.

Predefined children

  • DoubleProperty: tx, ty.


Rotation

Constructor

Rotation <id> (double a, double cx, double cy)

Action

Specifies a rotation with a center [cx, cy] and an angle a for the next graphic objects.

Predefined children

  • DoubleProperty: a (deg), cx, cy.


SkewX

Constructor

SkewX <id> (double a)

Action

Skews the x of the next graphic objects.

Predefined children

  • DoubleProperty: a.


SkewY

Constructor

SkewY <id> (double a)

Action

Skews the y of the next graphic objects.

Predefined children

  • DoubleProperty: a.


Scaling

Constructor

Scaling <id> (double sx, double sy, double cx, double cy)

Action

Specifies a scaling with a center [cx, cy] and scaling factors on X axis sx and on Y axis sy for the next graphic objects.

Predefined children

  • DoubleProperty: sx, sy, cx, cy.


Homography

Constructors

  • Homography <id> (double m11, double m12, double m13, double m14, double m21, double m22, double m23, double m24, double m31, double m32, double m33, double m34, double m41, double m42, double m43, double m44)
  • Homography <id>

Action

Specifies a transformation matrix for the next graphic objects.
Transformations can be accumulated on the left or the right of the matrix by using the leftXxxBy or rightXxxBy children. The accumulated scaling factors and rotation angle of the matrix can be observed.

Predefined children

  • DoubleProperty: m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44.
  • leftTranslateBy & rightTranslateBy -> DoubleProperty: dx, dy.
  • leftScaleBy & rightScaleBy -> DoubleProperty: cx, cy, sx, sy.
  • leftRotateBy & rightRotateBy -> DoubleProperty: cx, cy, da.
  • leftSkewXBy & rightSkewXBy -> DoubleProperty: cx, cy, da.
  • leftSkewYBy & rightSkewYBy -> DoubleProperty: cx, cy, da.
  • DoubleProperty (output only): accsx, accsy, acca.


SimpleTransform

Constructor

This component only proposes a simplified constructor for an homography.

SimpleTransform <id> (double a, double b, double c, double d, double e, double f)

Action

Specifies a transformation matrix for the next graphic objects.

Predefined children

  • DoubleProperty: m11, m12, m13, m21, m22, m23, m31, m32, m33.

Example


use core
use base
use display
use gui

_main_
Component root {
  Frame f ("transform", 0, 0, 500, 500)
  FillColor _(0, 0, 0)
  Text _(200, 250, "Click anywhere to see the difference")
  FillColor _(50, 100, 150)
  FSM fsm {
    State _with {
      Translation _ (50, 50)
      Scaling _ (0.5, 0.5, 0, 0)
      Rotation _ (50, 0, 0)
      Rectangle _ (0, 0, 200, 100, 5, 5)
    }
    State _without {
      Rectangle _ (0, 0, 200, 100, 5, 5)
    }
    _with->_without (f.press)
    _without->_with (f.press)
  }
}