Graphics.TransformationMatrix Property

Feedback Case Number: 64370

I just have to say that I’m absolutely loving all the new drawing capabilities that were added to the Graphics object, since my last license upgrade. It is dream come true :smiley:

What would the possibility be of adding a TransformationMatrix property to the Graphics object, to allow users to manipulate the transformation matrix directly.

Access to the transformation matrix will give users the ability to do very advanced rendering and smooth interpolated animations, using techniques such as matrix interpolation and matrix multiplication.

Are there anyone else who feels they would get a benefit from having access to such a TransformationMatrix property on the Graphics object?

1 Like

Hi @Alwyn_Bester

That’s basically what you get when using the Rotate, Scale and Translate methods on the Graphics class itself :+1:

True @Javier_Menendez, but as I read @Alwyn_Bester post, he wants access to the single points of the matrix.

Yes, I realize the matrix is basically built up through successive Rotate, Scale and Translate calls, but there are many benefits to being able to work directly with the matrix, and it really simplifies things when you start working with animation.

For example, if you wanted to store the current state, you simply save the matrix, and restore it at a later time, without having to worry about which calls were made to rotate, scale and translate, or in which order they were made.

With the matrices you can also do amazing animation effects by interpolating from one matrix to the next matrix, by “stepping” through the matrix values. To achieve the same effect with individual Rotate, Scale and Translate calls becomes very tedious and complicated.

1 Like

You have saveState and restoreState, so you don’t have to recompute anything.
But in any case being able to have Transformation matrix available could let us create some more complex solution (as animation and other)
Actually for this I use a graphics subclass with its own matrix (full matrix not simplified one)

1 Like

You solution for a graphics subclass with its own matrix sounds interesting Antonio.

If I wanted to create such a subclass of Graphics, with a matrix property, I assume this would only be to store the final matrix created by successive transformations?

Or can you also set this matrix, and then it applies the appropriate transformation operations in the correct sequence to the rendering? … and if so… how do you determine which operations to apply based on the matrix only?

The matrix stores only the final result, you can’t recreate the original sequence based on the result (think about a matrix that represents a translation along the x-axis: you can get that with one operation or with many operations that lead to that final translation)

In my implementation you can set the matrix (for more complex operations) and theoretically (I don’t need it) you can keep an history of your operations (or matrix) to show them step by step

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.