diagrams / diagrams-lib

Diagrams standard library
https://diagrams.github.io/
Other
138 stars 62 forks source link

Document DImage transformation #306

Open robinp opened 6 years ago

robinp commented 6 years ago

In https://archives.haskell.org/projects.haskell.org/diagrams/haddock/Diagrams-TwoD-Image.html, I wanted to prescale the DImage before converting to Diagram with image, so I sticked in the transform in the constructor (it was a simple scalingX <> scalingY).

But that apparently did something strange. I got the desired effect by applying the scaling to the Diagram itself.

Would be nice to document what the Transformation piece of the constructor is for.

bergey commented 6 years ago

There is a comment in the code from 2015 "should we use the transform here?". On a quick reading, I think yes, we should. It seems now the Transformable instance does the obvious thing, but then we throw out the Transformation when creating the Diagram. This doesn't seem right.

On 2017-12-24 at 12:28, Robin Palotai notifications@github.com wrote:

In https://archives.haskell.org/projects.haskell.org/diagrams/haddock/Diagrams-TwoD-Image.html, I wanted to prescale the DImage before converting to Diagram with image, so I sticked in the transform in the constructor (it was a simple scalingX <> scalingY).

But that apparently did something strange. I got the desired effect by applying the scaling to the Diagram itself.

Would be nice to document what the Transformation piece of the constructor is for.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.*

byorgey commented 6 years ago

@bergey I think I agree with you. Does https://github.com/diagrams/diagrams-lib/pull/307 look reasonable to you?