You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current Swift Cairo API lacks a way to operate an ImageSurface. There's a function to create one, but that's it. You can't import a PNG or arbitrarily access surface data without calling CCairo api.
Are there any technical limitations behind this absence, or is it just something that isn't done yet? If it's the second, I'd like to take a shot at fixing it.
The text was updated successfully, but these errors were encountered:
Also, another related problem is the absence of setSourceSurface method from Swift Context API. This means I need to use C API to render an image onto a DrawingArea. Again, if possible, I'd like to implement this functionality, but I'm not sure where to start.
Yes, it appears that the .gir file that comes with Cairo lacks some functions and documentation. It is possible to add convenience functions manually, see SwiftCairoSurfaceConvenienceAdditions.swift for example (feel free to file pull requests for missing functions).
Also, you can wrap any surface you get from a C function into a Surface or SurfaceRef and then use it with the Swift API, e.g.:
iflet surface =Surface(cairo_image_surface_create_from_png("some.png")){
/// do something with the surface;
/// the Surface class will automatically call cairo_surface_destroy() on deinit
/// (if you don't want that, use SurfaceRef instead)
}
Current Swift Cairo API lacks a way to operate an ImageSurface. There's a function to create one, but that's it. You can't import a PNG or arbitrarily access surface data without calling CCairo api.
Are there any technical limitations behind this absence, or is it just something that isn't done yet? If it's the second, I'd like to take a shot at fixing it.
The text was updated successfully, but these errors were encountered: