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

Expose cairo functionality without needing pycairo #381

Closed
artemp opened this issue Oct 11, 2011 · 5 comments
Closed

Expose cairo functionality without needing pycairo #381

artemp opened this issue Oct 11, 2011 · 5 comments

Comments

@artemp
Copy link
Member

artemp commented Oct 11, 2011

The ability to pass Pycairo objects to mapnik is excellent (allows for drawing multiple times to canvas). But difficulty of installation of pycairo and the extra complexity of passing pycairo objects to mapnik rendering and creating cairo contexts/surfaces, highlight the need to be able to write to cairo formats without pycairo using an API as simple as the current method of writing to AGG-based formats.

The attached patch makes it possible to write to cairo formats with only cairo/cairomm installed and using the python api like:

{{{
mapnik.render(map,'output.pdf') # extension will be used to select cairo renderer

or

mapnik.render(map,'output.png','ARGB32') # keyword will be used to select cairo renderer's PNG output (which can be non-Antialiased)
}}}

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] patch attached attempts to abstract the rendering to cairo file formats, and exposes the rendering to Cairo image formats (PNG) in non-antialiased mode.

This needs review and more thought:

  • How should rendering threads be handled in render_to_file when cairo is used?
  • Should this be further abstracted to avoid doing if type == "pdf" in the python bindings...
  • Should cairo formats be exposed in 'save_to_string' methods?
  • Should the Image object be extended to support/abstract cairo methods?

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] going to have a looksie at this before 0.7.0 if I have time

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] modified patch applied in 1531 to 0.7 branch.

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] pushing to 0.8.0 as we'll need to integrate this into trunk

@artemp
Copy link
Member Author

artemp commented Oct 11, 2011

[springmeyer] looks like I added this to trunk in r1546 and forgot to close.

@artemp artemp closed this as completed Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant