Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pycairo for openSUSE:Factory checked in at 2023-10-26 17:11:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pycairo (Old) and /work/SRC/openSUSE:Factory/.python-pycairo.new.24901 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pycairo" Thu Oct 26 17:11:49 2023 rev:13 rq:1120301 version:1.25.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pycairo/python-pycairo.changes 2023-07-26 13:22:35.639534046 +0200 +++ /work/SRC/openSUSE:Factory/.python-pycairo.new.24901/python-pycairo.changes 2023-10-26 17:11:54.502736485 +0200 @@ -1,0 +2,17 @@ +Tue Oct 24 00:45:54 UTC 2023 - Soc Virnyl Estela <uncomfy+openbuildserv...@uncomfyhalomacro.pl> + +- update to 1.25.1: + * fix a crash in pypy3.10 + * Fix the build with CPython 3.13.0a1 + +- introduced from 1.25.0: + * update to cairo 1.18.0 (for windows only) + * new apis: + - Status.SVG_FONT_ERROR + - FontOptions.get_color_mode(), FontOptions.set_color_mode(), ColorMode + - FontOptions.set_color_palette(), FontOptions.get_color_palette(), COLOR_PALETTE_DEFAULT + - FontOptions.set_custom_palette_color(), FontOptions.get_custom_palette_color() + - TAG_CONTENT, TAG_CONTENT_REF + - Pattern.get_dither(), Pattern.set_dither(), Dither + +------------------------------------------------------------------- Old: ---- pycairo-1.24.0.tar.gz New: ---- pycairo-1.25.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pycairo.spec ++++++ --- /var/tmp/diff_new_pack.EPDc3v/_old 2023-10-26 17:11:55.638778208 +0200 +++ /var/tmp/diff_new_pack.EPDc3v/_new 2023-10-26 17:11:55.642778355 +0200 @@ -19,7 +19,7 @@ %{?sle15_python_module_pythons} %define oldpython python Name: python-pycairo -Version: 1.24.0 +Version: 1.25.1 Release: 0 Summary: Python Bindings for Cairo License: LGPL-2.1-or-later OR MPL-1.1 ++++++ pycairo-1.24.0.tar.gz -> pycairo-1.25.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/NEWS new/pycairo-1.25.1/NEWS --- old/pycairo-1.24.0/NEWS 2023-06-19 09:29:06.000000000 +0200 +++ new/pycairo-1.25.1/NEWS 2023-10-21 17:09:16.000000000 +0200 @@ -1,5 +1,29 @@ Since version 1.11.0 Pycairo uses `Semantic Versioning <http://semver.org/>`__ +.. _v1.25.1: + +1.25.1 - 2023-10-21 +------------------- + +* Fix a crash with pypy3.10 :pr:`344` +* Fix the build with CPython 3.13.0a1 :pr:`343` + +.. _v1.25.0: + +1.25.0 - 2023-09-26 +------------------- + +* Update to cairo 1.18.0 for the Windows wheel +* Provide a Windows arm64 wheel +* New APIs: + + * :attr:`Status.SVG_FONT_ERROR` :pr:`334` + * :meth:`FontOptions.get_color_mode`, :meth:`FontOptions.set_color_mode`, :class:`ColorMode` :pr:`336` + * :meth:`FontOptions.set_color_palette`, :meth:`FontOptions.get_color_palette`, :attr:`COLOR_PALETTE_DEFAULT` :pr:`338` + * :meth:`FontOptions.set_custom_palette_color`, :meth:`FontOptions.get_custom_palette_color` :pr:`339` + * :attr:`TAG_CONTENT`, :attr:`TAG_CONTENT_REF` :pr:`340` + * :meth:`Pattern.get_dither`, :meth:`Pattern.set_dither`, :class:`Dither` :pr:`341` + .. _v1.24.0: 1.24.0 - 2023-06-19 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/PKG-INFO new/pycairo-1.25.1/PKG-INFO --- old/pycairo-1.24.0/PKG-INFO 2023-06-19 09:47:29.276270400 +0200 +++ new/pycairo-1.25.1/PKG-INFO 2023-10-21 17:10:48.872660900 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pycairo -Version: 1.24.0 +Version: 1.25.1 Summary: Python interface for cairo Home-page: https://pycairo.readthedocs.io Maintainer: Christoph Reiter @@ -27,7 +27,7 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works with **Python 3.8+** and **PyPy3**. Pycairo, including this documentation, is -licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.dev/ids>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -43,10 +43,6 @@ ---- -.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg - :align: right - :width: 200px - .. code:: python import cairo @@ -68,6 +64,10 @@ context.line_to(x3, y3) context.stroke() +.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg + :width: 320px + :align: center + ---- Features of the Pycairo bindings: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/README.rst new/pycairo-1.25.1/README.rst --- old/pycairo-1.24.0/README.rst 2023-06-18 19:39:11.000000000 +0200 +++ new/pycairo-1.25.1/README.rst 2023-10-21 15:53:59.000000000 +0200 @@ -7,7 +7,7 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works with **Python 3.8+** and **PyPy3**. Pycairo, including this documentation, is -licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.dev/ids>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -23,10 +23,6 @@ ---- -.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg - :align: right - :width: 200px - .. code:: python import cairo @@ -48,6 +44,10 @@ context.line_to(x3, y3) context.stroke() +.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg + :width: 320px + :align: center + ---- Features of the Pycairo bindings: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/__init__.pyi new/pycairo-1.25.1/cairo/__init__.pyi --- old/pycairo-1.24.0/cairo/__init__.pyi 2023-06-17 23:25:37.000000000 +0200 +++ new/pycairo-1.25.1/cairo/__init__.pyi 2023-10-21 15:53:59.000000000 +0200 @@ -44,6 +44,13 @@ .. versionadded:: 1.18.0 Only available with cairo 1.15.10+ """ +COLOR_PALETTE_DEFAULT: int = ... +""" +The default color palette index. See :meth:`FontOptions.set_color_palette` + +.. versionadded:: 1.25.0 Only available with cairo 1.17.8+ +""" + version: str = ... """the pycairo version, as a string""" @@ -350,6 +357,71 @@ ON: "HintMetrics" = ... """Hint font metrics""" +class ColorMode(_IntEnum): + """ + Specifies if color fonts are to be rendered using the color glyphs or + outline glyphs. Glyphs that do not have a color presentation, and non-color + fonts are not affected by this font option. + + .. versionadded:: 1.25 Only available with cairo 1.17.8+ + """ + + DEFAULT: "ColorMode" = ... + """ + Use the default color mode for font backend and target device. + """ + + NO_COLOR: "ColorMode" = ... + """ + Disable rendering color glyphs. Glyphs are always rendered as outline glyphs + """ + + COLOR: "ColorMode" = ... + """ + Enable rendering color glyphs. If the font contains a color presentation for + a glyph, and when supported by the font backend, the glyph will be rendered + in color. + """ + +class Dither(_IntEnum): + """ + Dither is an intentionally applied form of noise used to randomize + quantization error, preventing large-scale patterns such as color banding in + images (e.g. for gradients). Ordered dithering applies a precomputed + threshold matrix to spread the errors smoothly. + + :class:`Dither` is modeled on pixman dithering algorithm choice. As of + Pixman 0.40, FAST corresponds to a 8x8 ordered bayer noise and GOOD and BEST + use an ordered 64x64 precomputed blue noise. + + .. versionadded:: 1.25 Only available with cairo 1.18.0+ + """ + + NONE: "Dither" = ... + """ + No dithering. + """ + + DEFAULT: "Dither" = ... + """ + Default choice at cairo compile time. Currently NONE. + """ + + FAST: "Dither" = ... + """ + Fastest dithering algorithm supported by the backend + """ + + GOOD: "Dither" = ... + """ + An algorithm with smoother dithering than FAST + """ + + BEST: "Dither" = ... + """ + Best algorithm available in the backend + """ + class HintStyle(_IntEnum): """ These constants specify the type of hinting to do on font outlines. @@ -760,6 +832,10 @@ """ .. versionadded:: 1.23.0 Only available with cairo 1.17.6+ """ + SVG_FONT_ERROR: "Status" = ... + """ + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ class PDFVersion(_IntEnum): """ @@ -1256,6 +1332,26 @@ :class:`Context.set_source`. """ + def get_dither(self) -> Dither: + """ + :returns: the current dithering mode. + + Gets the current dithering mode, as set by :meth:`Pattern.set_dither`. + + .. versionadded:: 1.25.0 Only available with cairo 1.18.0+ + """ + + def set_dither(self, dither: Dither) -> None: + """ + :param dither: a :class:`Dither` describing the new dithering mode + + Set the dithering mode of the rasterizer used for drawing shapes. This + value is a hint, and a particular backend may or may not support a + particular value. At the current time, only pixman is supported. + + .. versionadded:: 1.25.0 Only available with cairo 1.18.0+ + """ + class Glyph(Tuple[int, float, float]): """ The :class:`Glyph` holds information about a single glyph when drawing or @@ -1574,6 +1670,80 @@ :attr:`cairo.Antialias.SUBPIXEL`. """ + def set_color_mode(self, color_mode: ColorMode) -> None: + """ + :param color_mode: the new color mode + + Sets the color mode for the font options object. This controls whether + color fonts are to be rendered in color or as outlines. See the + documentation for :class:`ColorMode` for full details. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + + def get_color_mode(self) -> ColorMode: + """ + :returns: the color mode for the font options object + + Gets the color mode for the font options object. See the documentation + for :class:`ColorMode` for full details. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + + def set_color_palette(self, palette_index: int) -> None: + """ + :param palette_index: the palette index in the CPAL table + + Sets the OpenType font color palette for the font options object. + OpenType color fonts with a CPAL table may contain multiple palettes. + The default color palette index is :data:`COLOR_PALETTE_DEFAULT`. If + palette_index is invalid, the default palette is used. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + + def get_color_palette(self) -> int: + """ + :returns: the palette index + + Gets the OpenType color font palette for the font options object. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + + def set_custom_palette_color(self, index: int, red: float, green: float, blue: float, alpha: float) -> None: + """ + :param index: the index of the color to set + :param red: red component of color + :param green: green component of color + :param blue: blue component of color + :param alpha: alpha component of color + + Sets a custom palette color for the font options object. This overrides + the palette color at the specified color index. This override is + independent of the selected palette index and will remain in place even + if :meth:`FontOptions.set_color_palette` is called to change the palette + index. + + It is only possible to override color indexes already in the font + palette. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + + def get_custom_palette_color(self, index: int) -> Tuple[float, float, float, float]: + """ + :param index: the index of the color to get + :returns: a (red, green, blue, alpha) tuple of float + :raises Error: if no custom color exists for the color index. + + Gets the custom palette color for the color index for the font options + object. + + .. versionadded:: 1.25.0 Only available with cairo 1.17.8+ + """ + class ScaledFont: """ A *ScaledFont* is a font scaled to a particular size and device resolution. A @@ -5523,6 +5693,20 @@ .. versionadded:: 1.18.0 Only available with cairo 1.15.10+ """ +TAG_CONTENT: str = ... +""" +Create a content tag. + +.. versionadded:: 1.25.0 Only available with cairo 1.18.0+ +""" + +TAG_CONTENT_REF: str = ... +""" +Create a content reference tag. + +.. versionadded:: 1.25.0 Only available with cairo 1.18.0+ +""" + CAPI: Any = ... ANTIALIAS_BEST = Antialias.BEST @@ -5691,6 +5875,15 @@ STATUS_WIN32_GDI_ERROR = Status.WIN32_GDI_ERROR STATUS_PNG_ERROR = Status.PNG_ERROR STATUS_DWRITE_ERROR = Status.DWRITE_ERROR +STATUS_SVG_FONT_ERROR = Status.SVG_FONT_ERROR PDF_OUTLINE_FLAG_OPEN = PDFOutlineFlags.OPEN PDF_OUTLINE_FLAG_BOLD = PDFOutlineFlags.BOLD PDF_OUTLINE_FLAG_ITALIC = PDFOutlineFlags.ITALIC +COLOR_MODE_DEFAULT = ColorMode.DEFAULT +COLOR_MODE_NO_COLOR = ColorMode.NO_COLOR +COLOR_MODE_COLOR = ColorMode.COLOR +DITHER_NONE = Dither.NONE +DITHER_DEFAULT = Dither.DEFAULT +DITHER_FAST = Dither.FAST +DITHER_GOOD = Dither.GOOD +DITHER_BEST = Dither.BEST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/cairomodule.c new/pycairo-1.25.1/cairo/cairomodule.c --- old/pycairo-1.24.0/cairo/cairomodule.c 2022-11-20 19:02:46.000000000 +0100 +++ new/pycairo-1.25.1/cairo/cairomodule.c 2023-10-21 15:55:08.000000000 +0200 @@ -210,6 +210,9 @@ if (PyType_Ready(&PycairoTextExtents_Type) < 0) return NULL; + if (PyType_Ready(&PycairoSurface_Type) < 0) + return NULL; + #ifdef CAIRO_HAS_SCRIPT_SURFACE if (PyType_Ready(&PycairoScriptDevice_Type) < 0) return NULL; @@ -223,8 +226,6 @@ if (PyType_Ready(&PycairoScaledFont_Type) < 0) return NULL; - if (PyType_Ready(&PycairoSurface_Type) < 0) - return NULL; #ifdef CAIRO_HAS_IMAGE_SURFACE if (PyType_Ready(&PycairoImageSurface_Type) < 0) return NULL; @@ -379,6 +380,10 @@ #endif #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) + PyModule_AddIntConstant(m, "COLOR_PALETTE_DEFAULT", CAIRO_COLOR_PALETTE_DEFAULT); +#endif + #ifdef CAIRO_HAS_PS_SURFACE Py_INCREF(&PycairoPSSurface_Type); PyModule_AddObject(m, "PSSurface", (PyObject *)&PycairoPSSurface_Type); @@ -543,6 +548,10 @@ STRCONSTANT(TAG_DEST); STRCONSTANT(TAG_LINK); #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) + STRCONSTANT(TAG_CONTENT); + STRCONSTANT(TAG_CONTENT_REF); +#endif #undef STRCONSTANT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/enums.c new/pycairo-1.25.1/cairo/enums.c --- old/pycairo-1.24.0/cairo/enums.c 2022-11-20 17:24:26.000000000 +0100 +++ new/pycairo-1.25.1/cairo/enums.c 2023-10-21 15:55:19.000000000 +0200 @@ -126,7 +126,7 @@ return NULL; return PyUnicode_FromFormat ("%s.%s", Py_TYPE(obj)->tp_name, - _PyUnicode_AsString(name_obj)); + PyUnicode_AsUTF8(name_obj)); } static PyObject * @@ -206,6 +206,12 @@ #ifdef CAIRO_HAS_SCRIPT_SURFACE DEFINE_ENUM(ScriptMode) #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) +DEFINE_ENUM(ColorMode) +#endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) +DEFINE_ENUM(Dither) +#endif #undef DEFINE_ENUM @@ -432,6 +438,9 @@ #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 6) CONSTANT(Status, STATUS, DWRITE_ERROR); #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) + CONSTANT(Status, STATUS, SVG_FONT_ERROR); +#endif CONSTANT(Status, STATUS, LAST_STATUS); ENUM(PathDataType); @@ -514,6 +523,22 @@ CONSTANT(ScriptMode, SCRIPT_MODE, BINARY); #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) + ENUM(ColorMode) + CONSTANT(ColorMode, COLOR_MODE, DEFAULT); + CONSTANT(ColorMode, COLOR_MODE, NO_COLOR); + CONSTANT(ColorMode, COLOR_MODE, COLOR); +#endif + +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) + ENUM(Dither) + CONSTANT(Dither, DITHER, NONE); + CONSTANT(Dither, DITHER, DEFAULT); + CONSTANT(Dither, DITHER, FAST); + CONSTANT(Dither, DITHER, GOOD); + CONSTANT(Dither, DITHER, BEST); +#endif + #undef ENUM #undef CONSTANT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/font.c new/pycairo-1.25.1/cairo/font.c --- old/pycairo-1.24.0/cairo/font.c 2020-04-01 16:03:19.000000000 +0200 +++ new/pycairo-1.25.1/cairo/font.c 2023-10-21 15:53:59.000000000 +0200 @@ -673,6 +673,73 @@ } #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) +static PyObject * +font_options_set_color_mode (PycairoFontOptions *o, PyObject *args) { + cairo_color_mode_t color_mode; + int color_mode_arg; + + if (!PyArg_ParseTuple (args, "i:FontOptions.set_color_mode", &color_mode_arg)) + return NULL; + + color_mode = (cairo_color_mode_t)color_mode_arg; + + cairo_font_options_set_color_mode (o->font_options, color_mode); + RETURN_NULL_IF_CAIRO_FONT_OPTIONS_ERROR(o->font_options); + Py_RETURN_NONE; +} + +static PyObject * +font_options_get_color_mode (PycairoFontOptions *o, PyObject *ignored) { + RETURN_INT_ENUM (ColorMode, cairo_font_options_get_color_mode (o->font_options)); +} + +static PyObject * +font_options_set_color_palette (PycairoFontOptions *o, PyObject *args) { + unsigned int color_palette; + + if (!PyArg_ParseTuple (args, "I:FontOptions.set_color_palette", &color_palette)) + return NULL; + + cairo_font_options_set_color_palette (o->font_options, color_palette); + RETURN_NULL_IF_CAIRO_FONT_OPTIONS_ERROR(o->font_options); + Py_RETURN_NONE; +} + +static PyObject * +font_options_get_color_palette (PycairoFontOptions *o, PyObject *ignored) { + return PyLong_FromUnsignedLong (cairo_font_options_get_color_palette (o->font_options)); +} + +static PyObject * +font_options_set_custom_palette_color (PycairoFontOptions *o, PyObject *args) { + double red, green, blue, alpha; + unsigned int index; + + if (!PyArg_ParseTuple (args, "Idddd:FontOptions.set_custom_palette_color", + &index, &red, &green, &blue, &alpha)) + return NULL; + + cairo_font_options_set_custom_palette_color (o->font_options, index, red, green, blue, alpha); + RETURN_NULL_IF_CAIRO_FONT_OPTIONS_ERROR(o->font_options); + Py_RETURN_NONE; +} + +static PyObject * +font_options_get_custom_palette_color (PycairoFontOptions *o, PyObject *args) { + double red, green, blue, alpha; + unsigned int index; + cairo_status_t status; + + if (!PyArg_ParseTuple (args, "I:FontOptions.get_custom_palette_color", &index)) + return NULL; + + status = cairo_font_options_get_custom_palette_color (o->font_options, index, &red, &green, &blue, &alpha); + RETURN_NULL_IF_CAIRO_ERROR (status); + return Py_BuildValue("(dddd)", red, green, blue, alpha); +} +#endif + static PyObject * font_options_get_antialias (PycairoFontOptions *o, PyObject *ignored) { RETURN_INT_ENUM (Antialias, cairo_font_options_get_antialias (o->font_options)); @@ -821,6 +888,14 @@ {"get_variations", (PyCFunction)font_options_get_variations, METH_NOARGS}, {"set_variations", (PyCFunction)font_options_set_variations, METH_VARARGS}, #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) + {"get_color_mode", (PyCFunction)font_options_get_color_mode, METH_NOARGS}, + {"set_color_mode", (PyCFunction)font_options_set_color_mode, METH_VARARGS}, + {"get_color_palette", (PyCFunction)font_options_get_color_palette, METH_NOARGS}, + {"set_color_palette", (PyCFunction)font_options_set_color_palette, METH_VARARGS}, + {"get_custom_palette_color", (PyCFunction)font_options_get_custom_palette_color, METH_VARARGS}, + {"set_custom_palette_color", (PyCFunction)font_options_set_custom_palette_color, METH_VARARGS}, +#endif {"get_antialias", (PyCFunction)font_options_get_antialias, METH_NOARGS}, {"get_hint_metrics", (PyCFunction)font_options_get_hint_metrics, METH_NOARGS}, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/pattern.c new/pycairo-1.25.1/cairo/pattern.c --- old/pycairo-1.24.0/cairo/pattern.c 2020-04-01 16:03:19.000000000 +0200 +++ new/pycairo-1.25.1/cairo/pattern.c 2023-10-21 15:53:59.000000000 +0200 @@ -167,6 +167,36 @@ Py_RETURN_NONE; } +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) +static PyObject * +pattern_get_dither (PycairoPattern *o, PyObject *ignored) { + cairo_dither_t dither; + + Py_BEGIN_ALLOW_THREADS; + dither = cairo_pattern_get_dither (o->pattern); + Py_END_ALLOW_THREADS; + + RETURN_INT_ENUM (Dither, dither); +} + +static PyObject * +pattern_set_dither (PycairoPattern *o, PyObject *args) { + cairo_dither_t dither; + int dither_arg; + + if (!PyArg_ParseTuple (args, "i:Pattern.set_dither", &dither_arg)) + return NULL; + + dither = (cairo_dither_t)dither_arg; + + Py_BEGIN_ALLOW_THREADS; + cairo_pattern_set_dither (o->pattern, dither); + Py_END_ALLOW_THREADS; + + Py_RETURN_NONE; +} +#endif + static PyMethodDef pattern_methods[] = { /* methods never exposed in a language binding: * cairo_pattern_destroy() @@ -182,6 +212,10 @@ {"set_matrix", (PyCFunction)pattern_set_matrix, METH_VARARGS }, {"get_filter", (PyCFunction)pattern_get_filter, METH_NOARGS }, {"set_filter", (PyCFunction)pattern_set_filter, METH_VARARGS }, +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) + {"get_dither", (PyCFunction)pattern_get_dither, METH_NOARGS }, + {"set_dither", (PyCFunction)pattern_set_dither, METH_VARARGS }, +#endif {NULL, NULL, 0, NULL}, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/cairo/private.h new/pycairo-1.25.1/cairo/private.h --- old/pycairo-1.24.0/cairo/private.h 2020-10-05 17:45:46.000000000 +0200 +++ new/pycairo-1.25.1/cairo/private.h 2023-10-21 15:53:59.000000000 +0200 @@ -309,6 +309,12 @@ #ifdef CAIRO_HAS_SCRIPT_SURFACE DECL_ENUM(ScriptMode) #endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 17, 8) +DECL_ENUM(ColorMode) +#endif +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 18, 0) +DECL_ENUM(Dither) +#endif /* Use to disable deprecation warnings temporarily */ #ifdef _MSC_VER diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/docs/index.rst new/pycairo-1.25.1/docs/index.rst --- old/pycairo-1.24.0/docs/index.rst 2023-06-18 19:58:15.000000000 +0200 +++ new/pycairo-1.25.1/docs/index.rst 2023-10-21 15:53:59.000000000 +0200 @@ -7,7 +7,6 @@ :width: 370px | -| .. toctree:: :maxdepth: 1 @@ -49,7 +48,7 @@ Alternatives: -* `cairocffi <https://cairocffi.readthedocs.io>`__ provides a large subset of +* `cairocffi <https://doc.courtbouillon.org/cairocffi/>`__ provides a large subset of the pycairo API but instead of being implemented in C it uses `cffi <https://cffi.readthedocs.io/>`__ to talk to cairo. In case you'd prefer not to use a C extension then give this a try. Or if you use PyPy and want to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/docs/reference/constants.rst new/pycairo-1.25.1/docs/reference/constants.rst --- old/pycairo-1.24.0/docs/reference/constants.rst 2022-11-20 19:02:46.000000000 +0100 +++ new/pycairo-1.25.1/docs/reference/constants.rst 2023-10-21 15:53:59.000000000 +0200 @@ -70,6 +70,10 @@ .. autodata:: TAG_LINK +.. autodata:: TAG_CONTENT + +.. autodata:: TAG_CONTENT_REF + .. _constants_MIME_TYPE: cairo.MIME_TYPE @@ -104,6 +108,8 @@ .. autodata:: PDF_OUTLINE_ROOT +.. autodata:: COLOR_PALETTE_DEFAULT + Other Classes and Functions =========================== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/docs/reference/enums.rst new/pycairo-1.25.1/docs/reference/enums.rst --- old/pycairo-1.24.0/docs/reference/enums.rst 2022-02-27 21:29:48.000000000 +0100 +++ new/pycairo-1.25.1/docs/reference/enums.rst 2023-10-21 15:53:59.000000000 +0200 @@ -110,3 +110,11 @@ .. autoclass:: PDFMetadata :members: :undoc-members: + +.. autoclass:: ColorMode + :members: + :undoc-members: + +.. autoclass:: Dither + :members: + :undoc-members: \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/meson.build new/pycairo-1.25.1/meson.build --- old/pycairo-1.24.0/meson.build 2023-06-19 09:30:30.000000000 +0200 +++ new/pycairo-1.25.1/meson.build 2023-10-21 15:53:59.000000000 +0200 @@ -1,6 +1,6 @@ project( 'pycairo', 'c', - version: '1.24.0', + version: '1.25.1', meson_version: '>= 0.56.0', license: 'LGPL-2.1-only OR MPL-1.1', default_options: [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/pycairo.egg-info/PKG-INFO new/pycairo-1.25.1/pycairo.egg-info/PKG-INFO --- old/pycairo-1.24.0/pycairo.egg-info/PKG-INFO 2023-06-19 09:47:29.000000000 +0200 +++ new/pycairo-1.25.1/pycairo.egg-info/PKG-INFO 2023-10-21 17:10:48.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pycairo -Version: 1.24.0 +Version: 1.25.1 Summary: Python interface for cairo Home-page: https://pycairo.readthedocs.io Maintainer: Christoph Reiter @@ -27,7 +27,7 @@ Pycairo is a Python module providing bindings for the `cairo graphics library <https://cairographics.org/>`__. It depends on **cairo >= 1.15.10** and works with **Python 3.8+** and **PyPy3**. Pycairo, including this documentation, is -licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.org/ids-how>`__. +licensed under the `LGPL-2.1-only OR MPL-1.1 <https://spdx.dev/ids>`__. The Pycairo bindings are designed to match the cairo C API as closely as possible, and to deviate only in cases which are clearly better implemented in @@ -43,10 +43,6 @@ ---- -.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg - :align: right - :width: 200px - .. code:: python import cairo @@ -68,6 +64,10 @@ context.line_to(x3, y3) context.stroke() +.. image:: https://raw.githubusercontent.com/pygobject/pycairo/main/docs/images/example.svg + :width: 320px + :align: center + ---- Features of the Pycairo bindings: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/pyproject.toml new/pycairo-1.25.1/pyproject.toml --- old/pycairo-1.24.0/pyproject.toml 2023-06-19 09:34:34.000000000 +0200 +++ new/pycairo-1.25.1/pyproject.toml 2023-10-21 15:53:59.000000000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "pycairo" -version = "1.24.0" +version = "1.25.1" description = "Python interface for cairo" authors = ["Christoph Reiter"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/setup.py new/pycairo-1.25.1/setup.py --- old/pycairo-1.24.0/setup.py 2023-06-19 09:34:31.000000000 +0200 +++ new/pycairo-1.25.1/setup.py 2023-10-21 15:53:59.000000000 +0200 @@ -14,7 +14,7 @@ from distutils import sysconfig -PYCAIRO_VERSION = '1.24.0' +PYCAIRO_VERSION = '1.25.1' CAIRO_VERSION_REQUIRED = '1.15.10' PYCAIRO_BUILD_NO_PKGCONFIG = os.environ.get("PYCAIRO_BUILD_NO_PKGCONFIG", False) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/tests/test_enums.py new/pycairo-1.25.1/tests/test_enums.py --- old/pycairo-1.24.0/tests/test_enums.py 2023-06-17 23:25:37.000000000 +0200 +++ new/pycairo-1.25.1/tests/test_enums.py 2023-10-21 15:53:59.000000000 +0200 @@ -74,6 +74,14 @@ cairo.SubpixelOrder, ] + if hasattr(cairo, "ColorMode"): + # cairo 1.17.8+ + types_.append(cairo.ColorMode) + + if hasattr(cairo, "Dither"): + # cairo 1.18.0+ + types_.append(cairo.Dither) + def get_prefix(t): name = t.__name__ # special case.. @@ -127,4 +135,4 @@ value = cairo.Antialias(42) new_value = pickle.loads(pickle.dumps(value)) - assert type(new_value) == int + assert type(new_value) is int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/tests/test_font.py new/pycairo-1.25.1/tests/test_font.py --- old/pycairo-1.24.0/tests/test_font.py 2023-06-17 23:25:37.000000000 +0200 +++ new/pycairo-1.25.1/tests/test_font.py 2023-10-21 15:53:59.000000000 +0200 @@ -23,6 +23,46 @@ font_face, cairo.Matrix(), cairo.Matrix(), font_options) +@pytest.mark.skipif(not hasattr(cairo.FontOptions, "set_custom_palette_color"), + reason="too old cairo") +def test_font_options_custom_palette_color(font_options): + font_options.set_custom_palette_color(42, 0.25, 0.5, 0.75, 1.0) + with pytest.raises(cairo.Error) as exc_info: + font_options.get_custom_palette_color(24) + assert exc_info.value.status == cairo.Status.INVALID_INDEX + assert font_options.get_custom_palette_color(42) == (0.25, 0.5, 0.75, 1.0) + assert isinstance(font_options.get_custom_palette_color(42), tuple) + + +@pytest.mark.skipif(not hasattr(cairo.FontOptions, "set_color_mode"), + reason="too old cairo") +def test_font_options_set_color_mode(font_options): + font_options.set_color_mode(cairo.ColorMode.COLOR) + assert font_options.get_color_mode() == cairo.ColorMode.COLOR + with pytest.raises(TypeError): + font_options.set_color_mode(object()) + + +@pytest.mark.skipif(not hasattr(cairo.FontOptions, "get_color_mode"), + reason="too old cairo") +def test_font_options_get_color_mode(font_options): + assert font_options.get_color_mode() == cairo.ColorMode.DEFAULT + assert isinstance(font_options.get_color_mode(), cairo.ColorMode) + + +@pytest.mark.skipif(not hasattr(cairo.FontOptions, "set_color_palette"), + reason="too old cairo") +def test_font_options_set_color_palette(font_options): + font_options.set_color_palette(42) + assert font_options.get_color_palette() == 42 + + +@pytest.mark.skipif(not hasattr(cairo.FontOptions, "get_color_palette"), + reason="too old cairo") +def test_font_options_get_color_palette(font_options): + assert font_options.get_color_palette() == cairo.COLOR_PALETTE_DEFAULT + + @pytest.mark.skipif(not hasattr(cairo.FontOptions, "get_variations"), reason="too old cairo") def test_font_options_variations(font_options): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pycairo-1.24.0/tests/test_pattern.py new/pycairo-1.25.1/tests/test_pattern.py --- old/pycairo-1.24.0/tests/test_pattern.py 2023-06-17 23:25:37.000000000 +0200 +++ new/pycairo-1.25.1/tests/test_pattern.py 2023-10-21 15:53:59.000000000 +0200 @@ -319,3 +319,12 @@ def test_surface_pattern(): with pytest.raises(TypeError): cairo.SurfacePattern(object()) + + +@pytest.mark.skipif(not hasattr(cairo.Pattern, "set_dither"), + reason="too old cairo") +def test_pattern_dither(): + pattern = cairo.SolidPattern(1, 2, 3) + pattern.get_dither() == cairo.Dither.DEFAULT + pattern.set_dither(cairo.Dither.BEST) + assert pattern.get_dither() == cairo.Dither.BEST