Skip to content
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

Rendering a Cairo drawing to a printer. #240

Open
PaulJohnson opened this issue Mar 5, 2018 · 0 comments
Open

Rendering a Cairo drawing to a printer. #240

PaulJohnson opened this issue Mar 5, 2018 · 0 comments

Comments

@PaulJohnson
Copy link
Contributor

Raised following this question on StackExchange.

The PrintOperation module has a printOptDrawPage signal which provides its callback with a printContext value. This has a function printContextGetCairoContext which returns a Cairo Context. However the library documentation doesn't have an entry for this Context type. See also Issue #215.

Daniel Wagner responded with the following options for fixing this:

I think one of two patches would be sensible here:

  1. Expose a renderWith-alike that consumes a Cairo. Let the user connect up printContextGetCairoContext with the new renderWith-alike.

  2. Don't expose printContextGetCairoContext at all; replace it with

     printContextRender :: PrintContextClass self => self -> Render a -> IO a
    

    and have printContextRender merge the call to printContextGetCairoContext with the renderWith-style cleanup.

I like option (1) for its clean backwards-compatibility story; but I like (2) a lot better from the API-design side of things. Since this module probably hasn't seen much use for the reasons you're describing, I'd lean towards patch (2).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant