rasterio / affine

Affine transformation matrices
https://affine.readthedocs.io/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
159 stars 28 forks source link

Add Affine.to_cairo, to output data in column major order suitable for cairo.Matrix(...) #101

Open stuaxo opened 7 months ago

stuaxo commented 7 months ago

Trying to use Affine with cairo really confused, me until I found the comment in the cairo code, which made me wonder if there was a difference in the order -

https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src/cairo-matrix.c#L318

This probably needs a from_cairo, docs, and maybe some tests with round-trips.

The tests should probably be skipped if pycairo is not installed.

sgillies commented 7 months ago

@stuaxo I'm glad you are interested in the affine package. However, I'm not willing to add this method. It is just a single line of code that can be easily added to any project that needs it.

stuaxo commented 7 months ago

That makes sense.

It may be useful to add to documentation.

The main reason I went for Draft and not an ordinary PR is that I wasn't sure if the change was correct, and that applies if I make a documentation PR.

Does it look like it makes sense, or have I just stumbled on something that works because I made a mistake elsewhere ?