Translation

Constructor

Translation <id> (double tx, tx)

Action

Specifies a translation 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

Scales the next graphic objects.

Predefined children

  • DoubleProperty: sx, sy, cx, cy.


Homography

Constructors

  • Homography <id> (double m11, double m12, double 13, double m21, double m22, double 23, double m31, double m32, double 33)
  • 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, m21, m22, m23, m31, m32, m33.
  • 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 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)
  }
}

run root
run syshook