Plus some mime type constants from 1.14 which I forgot.
All the API is only exposed when building with cairo 1.15.10+ (Ubuntu 18.04)
except the font variation stuff which is 1.15.12+ (Ubuntu 18.10)
In case PYCAIRO_NO_IMPORT is defined we declare the api struct as extern and hide the
import function. Also don't make the API struct static so we can access it from outside.
Pycairo installs .pc files which work quite well where the default
prefix is used, like with distro packaging etc. In virtualenvs
the pkg-config look up path needs to be set manually, and in pip
wheels are involved, where we had to disable installing .pc files
as they can get reused for a different prefix.
To make it easier for other python modules to use the C API introduce
a new function get_include() (similar ot what numpy has) which returns
the include path that needs to be passed to the compiler.
Since we can't really get the old header install path from the module
(one could walk up the tree and look for matching files, but that's ugly)
move the header file into the package itself, so that the path can be
dervived from the package path.
To prevent code from breaking which hardcodes the old include path
install a header to the old location which includes the new header
location.
With https://cgit.freedesktop.org/cairo/commit/?id=84fc0ce91d1a57d20500f710abc0e17de82c67df
cairo has moved from using fopen, which supports ANSI paths, to _wfopen, which
supports all Windows paths. The input is changed/limited to utf-8.
To paper over this "API break" (anything outside of ASCII is different)
adjust the encoding based on the cairo library version at runtime.
It's a tuple subclass, so can be used everywhere where it was used before.
In the documentation remove all the optional glyph array lengths, as they
are not strictly needed (one cas just pass slices) and just complicate things.
The pattern argument in the C API might be some internal thing
and not a bug as suspected. Instead of trying to "fix" it by passing
the pattern where the callback was registered at, pass nothing instead.
https://bugs.freedesktop.org/show_bug.cgi?id=101866#c1
In case the pattern instance is needed in the callback it can easily
be passed by using Python closures.
This only adds the type, constructor and the get/set_acquire() methods.
Since for some reason the callbacks don't get passed the pattern, this
uses the callback data to access the Python functions in the callbacks.
The whole thing doesn't look heavily tested in cairo, so I'm waiting
for a response in https://bugs.freedesktop.org/show_bug.cgi?id=101866
before looking into wrapping more functions there.
The plan is to do the same for IOError, but that needs some more work first.
The subclass currently is only exposed in the docs to make it clear that
previously MemoryError was raised.
This keeps the same API as cairo but adds some additional checks
to prevent crashes. Those cases still are undefined but at least
you get some error messages.
* It adds a new ImageSurface subtype so we can do some type checking.
* It swaps the underlying image surface to a dummy finished one
when it gets unmapped so that operations after unmap
on the wrapper don't crash.
* It checks if the source surface is correct when unmapping.
Now that we have enum classes we can put the method
in the right place.
This functions was (and still is) available under
ImageSurface.format_stride_for_width