-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent Graphics.Transform API #60
Comments
And I actually missed this page, which does document the Transform behavior: But after reading it I think my stance is the same, it makes it sound like they can be interchanged.
|
Hi, thank you for the comments! I think the documentation comments for the overloads (which should show up in your IDE) should help clarify that the first overload transforms the coordinate system, while the others return a new transformed /// <summary>
/// Transform the coordinate system with the specified transformation matrix [ [a, c, e], [b, d, f], [0, 0, 1] ].
/// </summary>
// ...
public void Transform(double a, double b, double c, double d, double e, double f, string tag = null) /// <summary>
/// Creates a new <see cref="Graphics"/> object in which all the graphics actions have been transformed using an arbitrary transformation function. Raster images are replaced by grey rectangles.
/// </summary>
// ...
/// <returns>A new <see cref="Graphics"/> object in which all graphics actions have been linearised and transformed using the <paramref name="transformationFunction"/>.</returns>
public Graphics Transform(Func<Point, Point> transformationFunction, double linearisationResolution) I have updated the online docs to further clarify the difference:
I hope this makes things easier to understand, let me know otherwise! |
Thanks for the clarification and updating the docs! One other thing you could do is mark overload 2 and 3 with the https://www.jetbrains.com/help/resharper/ReturnValueOfPureMethodIsNotUsed.html |
That's an interesting suggestion! I did some reading, and it would seem that there is a lot of controversy around the In the end, I suppose we don't really care whether the methods are pure or not, but rather that the returned value is used (the two things are overlapping, but not equivalent). What would be really needed is something like a Philosophical issues aside, I will keep this in mind for the next update, but I need to do some thinking on where to actually add the attribute - e.g., only to methods that are actually pure (which would be the semantically correct way of doing it), or to all methods whose return value should not be ignored (which would make it easier to eventually replace it with the |
I have now (VectSharp v2.5.1) added the I'm closing this for now, feel free to reopen if you notice something I missed or if you have other suggestions! |
Thanks! |
First off, thanks for the great library. I find it much simpler and nicer to work with than other svg libraries. For the most part the interface and documentation is very straightforward.
I did get hung up on the
Graphics.Transform
methods. They are method overloads so I would expect them to behave the same, however the method on l423 affects subsequent actions and the one on 1070 returns a graphics object with all the previous actions transformed. This wasn't immediately obvious from either the api or documentation.VectSharp/VectSharp/Graphics.cs
Line 423 in 7da0227
VectSharp/VectSharp/Graphics.cs
Line 1070 in 7da0227
The text was updated successfully, but these errors were encountered: