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)
With tp_getset things will show up in the class __dict__ which helps
with auto completion and also allows us to compare things with
the annotation stubs.
Instead of using the module state API just import the module
end fetch the error type. This lets us get rid of the PyState API
which isn't available under PyPy3 and also reduces the difference
between Python 2 and 3.
When taking enum values from Python we cast the signed values to the
enum type, which in case the enum type is unsigned leads to a defined
overflow.
When going the opposite way and creating Python enum values from
C enum values we have to do the reverse. Since casts from unsigned int
to signed int are undefined for > INT_MAX we need to do the type
conversion manually.
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.
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.
Turns out the buffer/memoryview API can only be used in implementations
of the buffer protocol of some object and the current approach
worked by accident and for some unknown reason leaked the exporter as
well.
This creates a new Python class implementing the buffer interface,
which takes the buffer information and is only used to keep the
image surface alive and to hand out memory views.
In case the last view dies, the proxy will die and unref the image
surface.
This adds a new Python type for each C level enum type.
The enum type is an int sublcass with its own repr implementation
to get something nice like cairo.Antialias.DEFAULT.
The module level constants are now aliases for the type attributes,
e.g. cairo.ANTIALIAS_DEFAULT == cairo.Antialias.DEFAULT.
This only adds the types and does not make function return them
(except in one case to see how it works). More work will follow
in the following commits.
This extends the cairo.Error exception type to have a status attribute
containing the cairo_status_t constants. This is what cairocffi
implements and will also make testing for specific error cases easier.
Also adds an cairo.CairoError alias to be compatible with the default
cairocffi naming.
Switch some functions which raise cairo.Error on programming errors
to ValueError, so we have a valid status value in all cases.
This reverts commit e00cd9d634.
Fedora builds pycairo with xpyb and has some packages depending on it.
So we have to keep it and figure out how to build it.
It's Python 2 only and was never enabled for py2/3 on debian/ubuntu
so this should not change much.
Handle instantiating of XCBSurface like is currently done for
XlibSurface. Getting an instance through the C-API still works.
If support gets added back we should look into xcffib, which is
what cairocffi uses. It also has the advandage that we don't
have to link against it and can use it at runtime.