Skip to content

Enable CairoSharp to use native-cairo capabilities to write SVG output to streams #9

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Enable CairoSharp to use native-cairo capabilities to write SVG output to streams #9

wants to merge 2 commits into from

Conversation

MatthiasSchilder
Copy link

Added wrapping of cairo_svg_surface_create_for_stream (cairo API docs).

I've extended the WinFormDemo-application to show usage.

image

Clicking on "tosvgstream" will create a SvgSurface, which is bound to a .NET memorystream. After writing is finished, the stream is reset, read and its string content is printed to Console:

image

Please feel free to make any proposals for improvement or just do them yourself.

@MatthiasSchilder
Copy link
Author

Added another commit which deals with the situation that the write_func delegate may be garbage-collected, even when the native code still needs it. This made the construction of a SvgSurface a little bit unaesthetic (initialization via constructor when you want to write to a file vs. via static method when you want to write to a stream), but I did not find another solution.

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

Successfully merging this pull request may close these issues.

1 participant