Skip to content

Commit 0dc1d8c

Browse files
authored
Merge branch 'main' into load-from-memview
2 parents cd7824b + b67412c commit 0dc1d8c

File tree

14 files changed

+79
-105
lines changed

14 files changed

+79
-105
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ body:
4747
label: PyMuPDF version
4848
options:
4949
-
50+
- 1.25.3
5051
- 1.25.2
5152
- 1.25.1
5253
- 1.25.0

.github/workflows/build_wheels.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,9 @@ jobs:
7272
run:
7373
python scripts/gh_release.py
7474

75-
- uses: actions/upload-artifact@v3
75+
- uses: actions/upload-artifact@v4
7676
with:
77+
name: sdist-${{ matrix.os }}
7778
path: dist/*.tar.gz
7879

7980

@@ -155,6 +156,7 @@ jobs:
155156

156157
# Upload generated wheels, to be accessible from github Actions page.
157158
#
158-
- uses: actions/upload-artifact@v3
159+
- uses: actions/upload-artifact@v4
159160
with:
161+
name: wheels-${{ matrix.os }}
160162
path: ./wheelhouse/*.whl

.readthedocs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ sphinx:
2020
configuration: docs/conf.py
2121

2222
# If using Sphinx, optionally build your docs in additional formats such as PDF
23-
formats:
24-
- pdf
23+
formats: all
2524

2625
# Optionally declare the Python requirements required to build your docs
2726
python:

changes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Change Log
22
==========
33

44

5-
**Changes in version 1.25.3 ()**
5+
**Changes in version 1.25.3 (2025-02-06)**
66

77
* Use MuPDF-1.25.4.
88

docs/recipes-annotations.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ The result looks like this:
5757

5858

5959

60-
61-
Using Buttons and JavaScript
62-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63-
Since MuPDF v1.16, 'FreeText' annotations no longer support bold or italic versions of the Times-Roman, Helvetica or Courier fonts.
64-
65-
A big **thank you** to our user `@kurokawaikki <https://github.com/kurokawaikki>`_, who contributed the following script to **circumvent this restriction**.
66-
67-
.. literalinclude:: samples/make-bold.py
68-
:language: python
69-
70-
--------------------------
71-
72-
7360
.. _RecipesAnnotations_C:
7461

7562
How to Use Ink Annotations

docs/recipes-multiprocessing.rst

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
Multiprocessing
1717
==============================
1818

19-
:title:`MuPDF` has no integrated support for threading - calling itself "thread-agnostic". While there do exist tricky possibilities to still use threading with :title:`MuPDF`, the baseline consequence for |PyMuPDF| is:
20-
21-
**No Python threading support**.
22-
23-
Using |PyMuPDF| in a :title:`Python` threading environment will lead to blocking effects for the main thread.
19+
|PyMuPDF| does not support running on multiple threads - doing so may cause incorrect behaviour or even crash Python itself.
2420

2521
However, there is the option to use :title:`Python's` *multiprocessing* module in a variety of ways.
2622

docs/samples/make-bold.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

docs/version.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
----
22

3-
This documentation covers **PyMuPDF v1.25.2** features as of **2025-01-17 00:00:01**.
3+
This documentation covers **PyMuPDF v1.25.3** features as of **2025-02-06 00:00:01**.
44

55
The major and minor versions of **PyMuPDF** and **MuPDF** will always be the same. Only the third qualifier (patch level) may deviate from that of **MuPDF**.
66

src/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,9 @@ def _int_rc(text):
373373

374374
# Basic version information.
375375
#
376-
pymupdf_version = "1.25.2"
376+
pymupdf_version = "1.25.3"
377377
mupdf_version = mupdf.FZ_VERSION
378-
pymupdf_date = "2025-01-17 00:00:01"
378+
pymupdf_date = "2025-02-06 00:00:01"
379379

380380
# Versions as tuples; useful when comparing versions.
381381
#
@@ -9870,10 +9870,9 @@ def __init__(self, *args):
98709870

98719871
# copy samples data ------------------------------------------
98729872
if 1:
9873-
# We use specially-provided (by MuPDF Python bindings)
9874-
# ll_fz_pixmap_copy() to get best performance.
9873+
# We use our pixmap_copy() to get best performance.
98759874
# test_pixmap.py:test_setalpha(): 3.9s t=0.0062
9876-
mupdf.ll_fz_pixmap_copy( pm.m_internal, src_pix.m_internal, n)
9875+
extra.pixmap_copy( pm.m_internal, src_pix.m_internal, n)
98779876
elif 1:
98789877
# Use memoryview.
98799878
# test_pixmap.py:test_setalpha(): 4.6 t=0.51

src/extra.i

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4039,6 +4039,58 @@ no_more_matches:;
40394039
return quads;
40404040
}
40414041

4042+
void pixmap_copy( fz_pixmap* pm, const fz_pixmap* src, int n)
4043+
{
4044+
assert(pm->w == src->w);
4045+
assert(pm->h == src->h);
4046+
assert(n <= pm->n);
4047+
assert(n <= src->n);
4048+
4049+
if (pm->n == src->n)
4050+
{
4051+
// identical samples
4052+
assert(pm->stride == src->stride);
4053+
memcpy(pm->samples, src->samples, pm->w * pm->h * pm->n);
4054+
}
4055+
else
4056+
{
4057+
int nn;
4058+
int do_alpha;
4059+
if (pm->n > src->n)
4060+
{
4061+
assert(pm->n == src->n + 1);
4062+
nn = src->n;
4063+
assert(!src->alpha);
4064+
assert(pm->alpha);
4065+
do_alpha = 1;
4066+
}
4067+
else
4068+
{
4069+
assert(src->n == pm->n + 1);
4070+
nn = pm->n;
4071+
assert(src->alpha);
4072+
assert(!pm->alpha);
4073+
do_alpha = 0;
4074+
}
4075+
for (int y=0; y<pm->h; ++y)
4076+
{
4077+
for (int x=0; x<pm->w; ++x)
4078+
{
4079+
memcpy(
4080+
pm->samples + pm->stride * y + pm->n * x,
4081+
src->samples + src->stride * y + src->n * x,
4082+
nn
4083+
);
4084+
if (do_alpha)
4085+
{
4086+
pm->samples[pm->stride * y + pm->n * x + pm->n-1] = 255;
4087+
}
4088+
}
4089+
}
4090+
}
4091+
}
4092+
4093+
40424094
%}
40434095

40444096
/* Declarations for functions defined above. */
@@ -4162,3 +4214,9 @@ int pixmap_n(mupdf::FzPixmap& pixmap);
41624214
PyObject* JM_search_stext_page(fz_stext_page *page, const char *needle);
41634215

41644216
PyObject *set_pixel(fz_pixmap* pm, int x, int y, PyObject *color);
4217+
4218+
/* Copies from <src> to <pm>, which must have same width and height. pm->n -
4219+
src->n must be -1, 0 or +1. If -1, <src> must have alpha and <pm> must not have
4220+
alpha, and we copy the non-alpha bytes. If +1 <src> must not have alpha and
4221+
<pm> must have alpha and we set <pm>'s alpha bytes all to 255.*/
4222+
void pixmap_copy(fz_pixmap* pm, const fz_pixmap* src, int n);

0 commit comments

Comments
 (0)