-
Notifications
You must be signed in to change notification settings - Fork 677
Description
Is your feature request related to a problem? Please describe.
This would help implement a workaround for issue #3604, where I need to discover which clip mask is being applied to an image. One suggested alternative was to use mutool trace, which outputs the drawing commands as XML. However, using this method requires invoking an external tool and then parsing XML, which is undesirable. Alternatively, I could use the MuPDF C API directly to implement a derived class of Device, where I could manually keep track of clip masks as needed (see the implementation for trace-device for example).
Ideally, I would like to do all this in Python.
Describe the solution you'd like
Expose the methods fill_path, fill_image, clip_path, etc., of Device in the Python API. Allow subclassing it with custom overrides of these methods, and enable passing this custom class to Page.run and similar functions.
Describe alternatives you've considered
Implement what I need in C and write my own bindings for Python.
Additional context
The JavaScript API contains the methods of Device and allows passing a custom JavaScript object with the same methods as a Device, as per its documentation.