MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / test_opacity

Function test_opacity

tests/test_general.py:230–245  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228 print( f'Have saved to: {path}')
229
230def test_opacity():
231 doc = pymupdf.open()
232 page = doc.new_page()
233
234 annot1 = page.add_circle_annot((50, 50, 100, 100))
235 annot1.set_colors(fill=(1, 0, 0), stroke=(1, 0, 0))
236 annot1.set_opacity(2 / 3)
237 annot1.update(blend_mode="Multiply")
238
239 annot2 = page.add_circle_annot((75, 75, 125, 125))
240 annot2.set_colors(fill=(0, 0, 1), stroke=(0, 0, 1))
241 annot2.set_opacity(1 / 3)
242 annot2.update(blend_mode="Multiply")
243 outfile = f'{scriptdir}/resources/opacity.pdf'
244 doc.save(outfile, expand=True, pretty=True)
245 print("saved", outfile)
246
247def test_get_text_dict():
248 import json

Callers

nothing calls this directly

Calls 6

new_pageMethod · 0.80
add_circle_annotMethod · 0.80
set_colorsMethod · 0.45
set_opacityMethod · 0.45
updateMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…