We all know the power of the Matrix, (not the movie) the Transformation Matrix. This combines a few factors including scaling, sheer, translation and rotation. These can be applied individually but when all combine the outcome is usually more fine tuned and neater than individual application.

After successfully applying the transform matrix to our HTML5 divs on rotated text we thought how can we extend this to the JavaFx. I tried using similar commands as is in the HTML5 syntax but applying it how i assumed it could be applied in Java i.e objectName.transform( matrix(0.56,1.0,-1.0,0.56,711, 15)); How wrong I was!

I also looked up the API for the Type Text and found that it was possible to set practically everything else but the matrix. For example you had methods like setScale, setRotate, setTranslate, etc but no setMatrix or something of the sort.

However I did notice that there was a getTransforms even if there isnt a setTransforms which i thought was a little bit strange. Anyway, after exploring the getTransforms method I noticed that you could not only use it to get already set Transforms done through the methods above you can also use it to add Transformations of your own.

Using this method gave all the available transforms that could be applied, including the shear and the use of the matrix which is disguised as Affine. This takes 6 values or 12 depending on how fine tuned you want your transformation to be. The best part about the Affine transform is that it allowed you to apply all the known transforms in one method. Hence making it a powerful method. *Have you tried it?*

### Related Posts:

#### Chika Okereke

#### Latest posts by Chika Okereke (see all)

- PDF to JavaFX conversion – Applying Slide Transitions in JavaFX - August 7, 2012
- PDF to JavaFX conversion – Applying Fade-In Transitions in JavaFX - July 30, 2012
- PDF to JavaFx conversion – Applying Transform matrix to Text - June 20, 2012
- PDF to HTML5 conversion – Text rotation - June 18, 2012
- PDF to FXML conversion – Creating a FXML application with NetBeans: Adding images - May 8, 2012