SVG icon indicating copy to clipboard operation
SVG copied to clipboard

Transformations data on a Linux OS

Open gentilinigm opened this issue 1 year ago • 0 comments

Transformations are handled using the System.Drawing.Drawing2D.Matrix class. However, System.Drawing.Drawing2D contains some windows-only code, which generates a warning if used.

I'm using this package as a dependency in my project, but when trying to run the project on a Linux OS I get the following error:

Unhandled exception. System.TypelnitializationException: The type initializer for 'Gdip' threw an exception.
—> System.PlatformNotSupportedException: System.Drav/ing.Common is not supported on non-Windows platforms. See https://aka.ms/systemdrav/ingnonv/inc ov/s for more information.

This is my code:

System.Drawing.Drawing2D.Matrix matrix = element.Transforms[i].Matrix;
Transformation transformation = new Transformation();
transformation.Diagonal(1);
transformation[0, 0] = Convert.ToDouble(matrix.Elements[0]);
transformation[1, 0] = Convert.ToDouble(matrix.Elements[1]);
transformation[0, 1] = Convert.ToDouble(matrix.Elements[2]);
transformation[1, 1] = Convert.ToDouble(matrix.Elements[3]);
transformation[0, 3] = Convert.ToDouble(matrix.Elements[4]);
transformation[1, 3] = Convert.ToDouble(matrix.Elements[5]);

Accessing transformations data is essential for my project, Am I doing something wrong? Do you have any suggestions?

If needed, I can help to transition to another cross-platform Matrix class to handle these types of transformations.

Used Versions

Svg 3.4.7 (nuget) Debian 11 .NET 6

gentilinigm avatar May 14 '24 12:05 gentilinigm