mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 00:04:29 +01:00
More PyQt6 nonsense
SIP can apparently no longer auto-convert QVector<Rgb>
This commit is contained in:
parent
73ec82d0e5
commit
49fb8ae1d6
2 changed files with 5 additions and 3 deletions
|
|
@ -73,10 +73,12 @@ QImage oil_paint(const QImage &image, const float radius=-1, const bool high_qua
|
|||
sipRes = new QImage(oil_paint(*a0, a1, a2));
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, const QVector<QRgb> &palette);
|
||||
QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, SIP_PYTUPLE);
|
||||
%MethodCode
|
||||
QVector<QRgb> palette(PyTuple_GET_SIZE(a3));
|
||||
for (int i = 0; i < PyTuple_GET_SIZE(a3); i++) palette[i] = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(a3, i));
|
||||
IMAGEOPS_PREFIX
|
||||
sipRes = new QImage(quantize(*a0, a1, a2, *a3));
|
||||
sipRes = new QImage(quantize(*a0, a1, a2, palette));
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ def quantize_image(img, max_colors=256, dither=True, palette=''):
|
|||
img = blend_image(img)
|
||||
if palette and isinstance(palette, string_or_bytes):
|
||||
palette = palette.split()
|
||||
return imageops.quantize(img, max_colors, dither, [QColor(x).rgb() for x in palette])
|
||||
return imageops.quantize(img, int(max_colors), dither, tuple(QColor(x).rgb() for x in palette))
|
||||
|
||||
|
||||
def eink_dither_image(img):
|
||||
|
|
|
|||
Loading…
Reference in a new issue