This topic should serve Xojo (@Geoff_Perlman, @William_Yu, @Greg_O_Lone, @Javier_Menendez) to get an overview which requirements we users have today to the Graphics object.
This topic is a continuation of “https://forum.xojo.com/t/graphics-what-users-need-today/54071”. I know that there are dozens of feature requests in the feedback. Maybe the overview will help the company better.
The suggestions mentioned here have been standard in the graphics libraries of macOS / iOS, Windows, Linux, Android and Web 2.0 (when switching to jCanvas) for years. I have added the links to the API’s of all platforms supported by Xojo (in the future): macOS, Window, Linux, iOS, Android, Web 2.0.
I have tried to specify my requirements for Xojo so that the team can easily implement them in Xojo for all available desktop platforms. We can already do some things with Declares itself, but it is extremely difficult to address the Direct2D context on Windows at this time. And if it works, it breaks with the Xojo implementation and you have to rebuild all the drawing routines that are already built into Xojo (the explanation would go too far here).
I ask Xojo to read this post carefully. I have really tried to collect all information completely and also think that it is the right places within the API’s, so that an adaptation of the Graphics object to today’s standards should not be so difficult.
I ask for detailed additions from other users.
Topic
This time it is about the “AffineTransform Matrix”. The “old” iOS Framework contains parts of this already. And this matrix is extremely helpful, e.g. when it comes to scaling the graphics context. Therefore the wish would be to make the function available in the Graphics object on desktop platforms.
Feedback: <https://xojo.com/issue/22602> (Add Support For Drawing With A Transformation Matrix)
Please give this feedback case a few points. Thank you very much.
It would also be wonderful to get access to the matrix itself to manipulate its points, for example to change the rotation point!
I know Object2D exists, but that requires a lot of writing, and simple methods inside the Graphics object, like in iOSGraphics, would keep the code much clearer.
We want the following methods in the Desktop Graphics object, which already exist in iOSGraphics:
Graphics.Rotate
This is already available in iOS.
macOS / iOS: CGAffineTransform
Windows: Matrix3x2F::Rotation, Direct2D Transforms Overview
Linux: cairo_rotate
Android: CanvasTransform.Rotate
Web 2.0 (jCanvas): rotateCanvas
Graphics.Scale
This is already available in iOS.
Graphics.ScaleX/ScaleY already exists, maybe you should make a method out of it like in the iOS Framework.
macOS / iOS: CGAffineTransform
Windows: Matrix3x2F::Scale, Direct2D Transforms Overview
Linux: cairo_scale
Android: CanvasTransform.Scale
Web 2.0 (jCanvas): scaleCanvas
Graphics.Translate
This is already available in iOS.
macOS / iOS: CGAffineTransform
Windows: Matrix3x2F::Translation, Direct2D Transforms Overview
Linux: cairo_translate
Android: CanvasTransform.Translate
Web 2.0 (jCanvas): translateCanvas
Please note that these functions must also be integrated into PDFGraphics.
Graphics.SaveState
This is already available in iOS & PDFGraphics.
macOS / iOS: saveGState
Windows: SaveDrawingState
Linux: cairo_save
Android: CanvasState.Save
Graphics.RestoreState
This is already available in iOS & PDFGraphics.
macOS / iOS: restoreGState
Windows: RestoreDrawingState
Linux: cairo_restore
Android: CanvasState.Restore
If Rotate, Scale and Translate could be included in the Graphics object, Object2D would be almost superfluous.