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

Add way of using map-to-image #52

Open
stuaxo opened this issue Feb 20, 2015 · 3 comments
Open

Add way of using map-to-image #52

stuaxo opened this issue Feb 20, 2015 · 3 comments
Labels

Comments

@stuaxo
Copy link

stuaxo commented Feb 20, 2015

I might be wrong, but it looks like there is no cairocffi way of using cairo-map-to-image, (unless this is the same as passing data to ImageSurface constructor?) - map-to-image and set-dirty and flush seem to be a way to get cairo to act on some existing data.

@SimonSapin
Copy link
Member

Hi. I don’t know what cairo-map-to-image is, and Google Search is not very helpful. Can you explain?

@stuaxo
Copy link
Author

stuaxo commented Feb 20, 2015

The first mention I can find is here:
http://cairographics.org/news/cairo-1.11.4/

Think I found some other info the other day, will need to keep looking .. think it's for making a cairo surface that just uses existing memory as opposed to just copying existing data in.

Here is a RUBY info here, though not quite sure whats going on..
http://ruby-doc.org//gems/docs/c/cairo-1.12.9/Cairo/Surface.html#method-i-map_to_image

A patch to add it to some LUA bindings...
awesomeWM/oocairo@8ea8648

Can't actually find any examples that use it so far + haven't been able to test it..

@SimonSapin
Copy link
Member

Ok, I see. This is the cairo_surface_map_to_image function. It does not have bindings in cairocffi yet. I’d review a pull request to add it. It would not be a lot of code, but it looks a bit tricky to get right as the returned surface needs to clean itself up with cairo_surface_unmap_image instead of cairo_surface_destroy.

I’m not sure when it is useful, but it does not look like it creates a surface from an existing memory buffer (that’s ImageSurface.create_for_data or passing data to the ImageSurface constructor) since it works with an existing surface.

@liZe liZe added the feature label Aug 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants