Ticket #381 (closed enhancement: fixed)

Opened 14 months ago

Last modified 6 months ago

Expose cairo functionality without needing pycairo

Reported by: springmeyer Owned by: springmeyer
Priority: normal Milestone: 0.7.0
Component: Boost.Python Binding Version: SVN Trunk
Severity: Normal Keywords:
Cc: Patch Needs Improvement: yes
Needs Docmentation: no Has Patch?: yes
Design Decision Needed: no

Description (last modified by springmeyer) (diff)

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)

Attachments

further_cairo_rendering_abstraction.patch (6.6 kB) - added by springmeyer 14 months ago.
Patch to further abstract cairo rendering and allow use of cairo formats via python even if pycairo is not used/available

Change History

Changed 14 months ago by springmeyer

Patch to further abstract cairo rendering and allow use of cairo formats via python even if pycairo is not used/available

Changed 14 months ago by springmeyer

  • has_patch set
  • patch_need_improvement set

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?

Changed 11 months ago by springmeyer

  • description modified (diff)

Changed 11 months ago by springmeyer

  • description modified (diff)

Changed 9 months ago by springmeyer

  • milestone changed from 0.6.2 to 0.7.0

Changed 8 months ago by springmeyer

  • milestone changed from 0.8.0 to 0.7.0

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

Changed 8 months ago by springmeyer

modified patch applied in 1531 to 0.7 branch.

Changed 8 months ago by springmeyer

  • version changed from 0.6.0 to SVN Trunk
  • milestone changed from 0.7.0 to 0.8.0

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

Changed 6 months ago by springmeyer

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 0.8.0 to 0.7.0

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

Note: See TracTickets for help on using tickets.