diff --git a/App/Lib/MuPDFLib.dll b/App/Lib/MuPDFLib.dll
index 0054a3c..3ce2e81 100644
Binary files a/App/Lib/MuPDFLib.dll and b/App/Lib/MuPDFLib.dll differ
diff --git a/App/Lib/MuPDFLib.xml b/App/Lib/MuPDFLib.xml
new file mode 100644
index 0000000..1c5319c
--- /dev/null
+++ b/App/Lib/MuPDFLib.xml
@@ -0,0 +1,9055 @@
+
+
+
+ "MuPDFLib"
+
+
+
+
+Gets position of given object from array.
+
+ Object to find.
+ Position of object, or -1 if object does not exist in the array.
+
+
+
+Gets dereferenced object from array.
+
+ Index of entry.
+ Value of corresponding entry, or if index does not exist.
+
+
+
+Replaces bytes in the stream. The data must match /Filter, if is true.
+
+ The data to be placed into the stream.
+ Whether the data is compressed. If not compressed, /Filter and /DecodeParms will be removed.
+
+
+
+Gets or sets entry in .
+The return value of get will never be .
+If requested entry does not exists, instance of will be returned instead.
+
+
+
+
+Gets or sets entry in .
+The return value of get will never be .
+If requested entry does not exists, instance of will be returned instead.
+
+
+
+
+Gets dereferenced object from dictionary.
+
+ Key of entry.
+ Alternative key of entry.
+ Value of corresponding entry, or if key does not exist.
+
+
+
+Gets dereferenced object from dictionary.
+
+ Key of entry.
+ Value of corresponding entry, or if key does not exist.
+
+
+
+Gets dereferenced object from dictionary.
+
+ Key of entry.
+ Value of corresponding entry, or if key does not exist.
+
+
+
+Gets value from dictionary.
+
+ Key of entry.
+ Value of corresponding entry, or if key does not exist.
+
+
+
+
+Gets underlying bytes in a PDF string.
+
+
+
+
+Provides direct object kind info.
+
+
+
+
+Gets or sets whether this object is dirty (modified).
+
+
+
+
+Encapsulates the PDF obj used by MuPDF
+
+
+
+
+Encapsulates the file stream used by MuPDF
+
+
+
+ Open a stream to read decompressed data from this compressed buffer.
+
+
+
+Returns storage size used for this compressed buffer (in bytes).
+
+
+
+
+Create a Buffer from managed bytes (copies data).
+
+
+
+
+Extracts buffer contents: makes a managed copy and leaves native buffer empty.
+
+
+
+
+Return buffer contents as a UTF8 string (uses zero-terminated data).
+May return empty string for binary data.
+
+
+
+
+Ensure buffer is zero-terminated (useful if treated as C string).
+
+
+
+
+Clear buffer contents (keeps capacity).
+
+
+
+
+Append bytes to buffer.
+
+
+
+
+Returns a managed copy of buffer contents.
+
+
+
+ Gets current size of buffer in bytes.
+
+
+
+Add labels to each object showing how it can be reached from the Root.
+
+
+
+
+0: Default, 1: min, 100: max
+
+
+
+
+Document encryption permissions.
+
+
+
+
+Garbage collect objects before saving.
+
+
+
+
+Decompress streams (except when compressing images/fonts).
+
+
+
+
+Compress (or leave compressed) font streams.
+
+
+
+
+Compress (or leave compressed) image streams.
+
+
+
+
+Compress streams.
+
+
+
+
+ASCII hex encode binary streams.
+
+
+
+
+Pretty-print dictionaries and arrays.
+
+
+
+
+Write just the changed objects.
+
+
+
+
+Replace object in xref table with the passed in object.
+
+ The number of the object to be replaced.
+ The new object to replace the slot.
+
+
+
+Allocates a slot in the xref table.
+
+ Returns a fresh unused object number
+
+
+
+Returns true if 'obj' is an indirect reference to an object that is held by the "local" xref section.
+
+ The object to check.
+
+
+
+Loads a name tree, flattening it into a single dictionary.
+
+ The name tree to load, for instance .
+
+
+
+Deletes page label from page .
+
+ The page index (numbered from 0).
+
+
+
+Sets page label from page .
+
+ The page index (numbered from 0).
+ The label style.
+ The prefix of the page label.
+ The start number of the label.
+
+
+
+Graft a page (and its resources) from the document to the destination document of the graft. This involves a deep copy of the objects in question.
+
+ The source document to copy from.
+ The source page number (pages numbered from 0, with -1 meaning "at the end").
+ The position within the destination document at which the page should be inserted (pages numbered from 0, with - 1 meaning "at the end").
+
+
+
+Rearrange pages with the given order and numbers in .
+
+ The page numbers of the rearranged document.
+
+
+
+Removes specific pages [start, end) from document. This does not remove the page contents or resources from the file.
+
+ The first page number to be removed (starts from 0).
+ The last page number remained (starts from 0). If end is negative or greater than the number of pages in the document, it will be taken to be the end of the document.
+
+
+
+Removes specific page from document (page contents and resources are still preserved).
+
+ The page number (starts from 0).
+
+
+
+Insert a page previously created by NewPage into the pages tree of the document.
+
+ The page to be inserted.
+ The page number to insert at (pages numbered from 0). n between 0 to page_count inserts before page n. Negative numbers or INT_MAX are treated as page count, and insert at the end. 0 inserts at the start. All existing pages are after the insertion point are shuffled up.
+
+
+
+Gets page bound without loading the page.
+
+ The page number (starts from 0).
+ The page rectangle (check if it is valid before use).
+
+
+
+Gets only the object without loading resources, annotations and other stuff.
+
+ The page number (starts from 0).
+ The page.
+
+
+
+Gets page number from corresponding indirect reference.
+
+ The indirect reference.
+ The corresponding page number (-1 if not found).
+
+
+
+Loads specific page from document.
+
+ The page number (starts from 0).
+ The loaded page.
+
+
+
+Remove cached annotations within this page.
+
+
+
+
+Remove cached links within this page.
+
+
+
+
+Remove cached links and annotations within this page.
+
+
+
+
+Clip contents, links and annotations within this page.
+
+ The preserved region within this page.
+
+
+
+Gets the /Contents object, which can be a stream or an array, from the page dictionary
+
+
+
+
+Determine the page size in points, taking page rotation into account. The page size is taken to be the crop box if it exists (visible area after cropping), otherwise the media box will be used (possibly including printing marks).
+
+
+
+
+If the image, when clipped, intrudes across the redaction
+ region, remove it completely.Note: clipped is a rough estimate
+ based on the bbox of clipping paths.
+
+ Essentially this says "remove any image that has visible parts
+ that extend into the redaction region".
+
+This method can effectively 'leak' invisible information during
+ the redaction phase, so should be used with caution.
+
+
+
+ If the image intrudes across the redaction region(even if clipped), replace the bit that intrudes with black pixels..
+
+
+ If the image intrudes across the redaction region(even if clipped), remove it.
+
+
+
+Do not change images at all.
+
+
+
+
+Creates a new draw device to render PDF page contents.
+
+ The pixmap to render page contents.
+ A draw device which paints content to the pixmap.
+
+
+
+Gets the first font used in TextLine.
+
+
+
+
+Compares whether other TextChar has the same font, size and color as the current one.
+
+ Another TextChar
+
+
+
+Compares whether other TextChar has the same font as the current one.
+
+ Another TextChar
+
+
+
+Gets rendering flags of a character
+
+
+
+
+Gets a pointer to the internal font, for font comparison without creating new TextFont instances.
+
+
+
+
+Gets the sRGB Hex color (alpha in top 8 bits, then r, then g, then b in low bits).
+
+
+
+
+Gets the Unicode code point for this character.
+
+
+
+
+Return the advance for a given glyph.
+
+ The glyph id.
+ True for vertical writing mode, false for horizontal mode.
+
+
+
+Find the glyph id for a given unicode character within a font.
+
+ The unicode character to encode.
+ Returns the glyph id for the given unicode value, or 0 if unknown.
+
+
+
+Defines scale ratio for text rendition. Base resolution is 96 DPI.
+
+
+
+
+Return the number of alpha planes in a Pixmap. Does not throw exceptions.
+
+
+
+
+Gets or sets text rendition anti-alias level. Valid values are ranged [0, 8].
+
+
+
+
+Gets or sets rendition anti-alias level. Valid values are ranged [0, 8].
+
+
+
+Recolor a shade.
+
+
+
+ Function to handle recoloring a shade.
+
+ Called with src_cs from the shade. If no recoloring is required, return NULL. Otherwise
+ fill in *dst_cs, and return a vertex recolorer.
+
+
+
+Function to recolor a single color from a shade.
+
+
+
+ Load a given object.
+
+ This can cause xref reorganisations (solidifications etc) due to
+ repairs, so all held pdf_xref_entries should be considered
+ invalid after this call (other than the returned one).
+
+
+
+ Resolve an indirect object (or chain of objects).
+
+ This can cause xref reorganisations (solidifications etc) due to
+ repairs, so all held pdf_xref_entries should be considered
+ invalid after this call (other than the returned one).
+
+
+
+ Retrieve the pdf_xref_entry for a given object.
+
+ This can cause xref reorganisations (solidifications etc) due to
+ repairs, so all held pdf_xref_entries should be considered
+ invalid after this call (other than the returned one).
+
+
+
+
+A rectangle with integer coordinates.
+
+
+
+
+A rectangle with float coordinates.
+
+
+
+
+A point with float coordinates.
+
+
+
+ Decode a barcode from a display list.
+
+ type: NULL, or a pointer to receive the barcode type decoded.
+ list: The display list to render to get the barcode.
+ subarea: subarea of the page to decode.
+ rotate: 0, 90, 180, or 270.
+
+ returns the decoded value.
+
+
+
+ Decode a barcode from a pixmap.
+
+ type: NULL, or a pointer to receive the barcode type decoded.
+ pix: The pixmap to decode.
+ rotate: 0, 90, 180, or 270.
+
+ returns the decoded value as an fz_malloced block. Should
+ be fz_free'd by the caller.
+
+
+
+ Decode a barcode from a page.
+
+ type: NULL, or a pointer to receive the barcode type decoded.
+ page: The page to decode.
+ subarea: subarea of the page to decode.
+ rotate: 0, 90, 180, or 270.
+
+ returns the decoded value.
+
+
+
+ Create an fz_pixmap from a barcode definition.
+
+ type: The type of barcode to create.
+ value: The value of the barcode.
+ size: The size of the barcode.
+ ec_level: error correction level 0-8.
+ quiet: whether to include quiet zones (0 or 1).
+ hrt: whether to include human readable text below the barcode (0 or 1).
+
+ returns a created fz_pixmap.
+
+
+
+ Create an fz_image from a barcode definition.
+
+ type: The type of barcode to create.
+ value: The value of the barcode.
+ size: The size of the barcode.
+ ec_level: error correction level 0-8.
+ quiet: whether to include quiet zones (0 or 1).
+ hrt: whether to include human readable text below the barcode (0 or 1).
+
+ returns a created fz_image.
+
+
+
+Helper function to search the above list (case insensitively)
+for an exact match. Returns FZ_BARCODE_NONE if no match found.
+
+
+
+Return barcode string matching one of the above barcode types.
+All lowercase, e.g. "none", "aztec" etc.
+
+
+
+ Create a device that outputs (single page) SVG files to
+ the given output stream.
+
+ Equivalent to fz_new_svg_device_with_id passing id = NULL.
+
+
+
+Output the file header to a pwg stream, ready for pages to follow it.
+
+
+
+Create a new color pwg band writer.
+
+
+
+Create a new monochrome pwg band writer.
+
+
+
+ Write a bitmap as a PWG page.
+
+ Caller should provide a file header by calling
+ fz_write_pwg_file_header, but can then write several pages to
+ the same file.
+
+
+
+ Write a pixmap as a PWG page.
+
+ Caller should provide a file header by calling
+ fz_write_pwg_file_header, but can then write several pages to
+ the same file.
+
+
+
+Write a bitmap as a PWG.
+
+
+
+Write a pixmap as a PWG.
+
+
+
+Save a bitmap as a PWG.
+
+
+
+Save a pixmap as a PWG.
+
+
+
+Open a PSD band writer.
+
+
+
+Write a pixmap as a PSD file.
+
+
+
+Save a pixmap as a PSD file.
+
+
+
+Write the file level trailer for ps band writer output.
+
+
+
+Write the file level header for ps band writer output.
+
+
+
+Create a postscript band writer for gray, rgb, or cmyk, no
+alpha.
+
+
+
+Save a (gray, rgb, or cmyk, no alpha) pixmap out as postscript.
+
+
+
+Write a (gray, rgb, or cmyk, no alpha) pixmap out as postscript.
+
+
+
+Save a CMYK pixmap as a pkm. (Performing halftoning).
+
+
+
+Create a new pkm band writer for CMYK pixmaps.
+
+
+
+Write a CMYK bitmap as a pkm.
+
+
+
+Save a CMYK bitmap as a pkm.
+
+
+
+Save a pixmap as a pbm. (Performing halftoning).
+
+
+
+Create a new band writer, targeting pbm.
+
+
+
+Write a bitmap as a pbm.
+
+
+
+Save a bitmap as a pbm.
+
+
+
+Create a band writer targeting pnm (greyscale, rgb or cmyk,
+with or without alpha).
+
+
+
+Write a pixmap as a pnm (greyscale, rgb or cmyk, with or without
+alpha).
+
+
+
+Save a pixmap as a pnm (greyscale, rgb or cmyk, with or without
+alpha).
+
+
+
+Create a band writer targeting pnm (greyscale or rgb, no
+alpha).
+
+
+
+Write a pixmap as a pnm (greyscale or rgb, no alpha).
+
+
+
+Save a pixmap as a pnm (greyscale or rgb, no alpha).
+
+
+
+ Re-encode a given pixmap as a PNG into a buffer.
+
+ Ownership of the buffer is returned.
+
+
+
+ Re-encode a given image as a PNG into a buffer.
+
+ Ownership of the buffer is returned.
+
+
+
+Create a new png band writer (greyscale or RGB, with or without
+alpha).
+
+
+
+ Save pixmap data as JP2K with no subsampling.
+
+ quality = 100 = lossless
+ otherwise for a factor of x compression use 100-x. (so 80 is 1:20 compression)
+
+
+
+ Pixmap data as JP2K with no subsampling.
+
+ quality = 100 = lossless
+ otherwise for a factor of x compression use 100-x. (so 80 is 1:20 compression)
+
+
+
+Write a (Greyscale or RGB) pixmap as a png.
+
+
+
+Save a pixmap as a JPEG.
+
+
+
+Write a pixmap as a JPEG.
+
+
+
+Save a (Greyscale or RGB) pixmap as a png.
+
+
+
+Save a (Greyscale or RGB) pixmap as pdfocr.
+
+
+
+Write a (Greyscale or RGB) pixmap as pdfocr.
+
+
+
+Set the progress callback for a pdfocr bandwriter.
+
+
+
+ Create a new band writer, outputting pdfocr.
+
+ Ownership of output stays with the caller, the band writer
+ borrows the reference. The caller must keep the output around
+ for the duration of the band writer, and then close/drop as
+ appropriate.
+
+
+
+Save a (Greyscale or RGB) pixmap as pclm.
+
+
+
+Write a (Greyscale or RGB) pixmap as pclm.
+
+
+
+Create a new band writer, outputting pclm
+
+
+
+ Parse PCLm options.
+
+ Currently defined options and values are as follows:
+
+ compression=none: No compression
+ compression=flate: Flate compression
+ strip-height=n: Strip height (default 16)
+
+
+
+Save an (RGB) pixmap as color PCL.
+
+
+
+Write an (RGB) pixmap as color PCL.
+
+
+
+Create a new band writer, outputting color pcl.
+
+
+
+Save a bitmap as mono PCL.
+
+
+
+Write a bitmap as mono PCL.
+
+
+
+Create a new band writer, outputting monochrome pcl.
+
+
+
+ Initialize PCL option struct for a given preset.
+
+ Currently defined presets include:
+
+ generic Generic PCL printer
+ ljet4 HP DeskJet
+ dj500 HP DeskJet 500
+ fs600 Kyocera FS-600
+ lj HP LaserJet, HP LaserJet Plus
+ lj2 HP LaserJet IIp, HP LaserJet IId
+ lj3 HP LaserJet III
+ lj3d HP LaserJet IIId
+ lj4 HP LaserJet 4
+ lj4pl HP LaserJet 4 PL
+ lj4d HP LaserJet 4d
+ lp2563b HP 2563B line printer
+ oce9050 Oce 9050 Line printer
+
+
+
+ Drop the reference to the band writer, causing it to be
+ destroyed.
+
+ Never throws an exception.
+
+
+
+Finishes up the output and closes the band writer. After this
+call no more headers or bands may be written.
+
+
+
+ Cause a band writer to write the next band
+ of data for an image.
+
+ stride: The byte offset from the first byte of the data
+ for a pixel to the first byte of the data for the same pixel
+ on the row below.
+
+ band_height: The number of lines in this band.
+
+ samples: Pointer to first byte of the data.
+
+
+
+ Cause a band writer to write the header for
+ a banded image with the given properties/dimensions etc. This
+ also configures the bandwriter for the format of the data to be
+ passed in future calls.
+
+ w, h: Width and Height of the entire page.
+
+ n: Number of components (including spots and alphas).
+
+ alpha: Number of alpha components.
+
+ xres, yres: X and Y resolutions in dpi.
+
+ cs: Colorspace (NULL for bitmaps)
+
+ seps: Separation details (or NULL).
+
+
+
+fz_band_writer
+
+
+
+Internal function to allocate a
+block for a derived document_writer structure, with the base
+structure's function pointers populated correctly, and the extra
+space zero initialised.
+
+
+
+Structure is public to allow other structures to
+be derived from it. Do not access members directly.
+
+
+
+ Called to discard a fz_document_writer.
+ This may be called at any time during the process to release all
+ the resources owned by the writer.
+
+ Calling drop without having previously called close may leave
+ the file in an inconsistent state.
+
+
+
+ Called to end the process of writing
+ pages to a document.
+
+ This writes any file level trailers required. After this
+ completes successfully the file is up to date and complete.
+
+
+
+Convenience function to feed all the pages of a document to
+fz_begin_page/fz_run_page/fz_end_page.
+
+
+
+Called to end the process of writing a page to a
+document.
+
+
+
+ Called to start the process of writing a page to
+ a document.
+
+ mediabox: page size rectangle in points.
+
+ Returns a borrowed fz_device to write page contents to. This
+ should be kept if required, and only dropped if it was kept.
+
+
+
+ Used to report progress of the OCR operation.
+
+ page: Current page being processed.
+
+ percent: Progress of the OCR operation for the
+ current page in percent. Whether it reaches 100
+ once a page is finished, depends on the OCR engine.
+
+ Return 0 to continue progress, return 1 to cancel the
+ operation.
+
+
+
+ Document writers for various possible output formats.
+
+ All of the "_with_output" variants pass the ownership of out in
+ immediately upon calling. The writers are responsible for
+ dropping the fz_output when they are finished with it (even
+ if they throw an exception during creation).
+
+
+
+Like fz_new_document_writer but takes a fz_output for writing
+the result. Only works for multi-page formats.
+
+
+
+ Create a new fz_document_writer, for a
+ file of the given type.
+
+ path: The document name to write (or NULL for default)
+
+ format: Which format to write (currently cbz, html, pdf, pam,
+ pbm, pgm, pkm, png, ppm, pnm, svg, text, xhtml, docx, odt)
+
+ options: NULL, or pointer to comma separated string to control
+ file generation.
+
+
+
+ Copy an option (val) into a destination buffer (dest), of maxlen
+ bytes.
+
+ Returns the number of bytes (including terminator) that did not
+ fit. If val is maxlen or greater bytes in size, it will be left
+ unterminated.
+
+
+
+ Check to see if an option, a, from a string matches a reference
+ option, b.
+
+ (i.e. a could be 'foo' or 'foo,bar...' etc, but b can only be
+ 'foo'.)
+
+
+
+Look for a given option (key) in the opts string. Return 1 if
+it has it, and update *val to point to the value within opts.
+
+
+
+ Function type to discard
+ an fz_document_writer. This may be called at any time during
+ the process to release all the resources owned by the writer.
+
+ Calling drop without having previously called close may leave
+ the file in an inconsistent state and the user of the
+ fz_document_writer would need to do any cleanup required.
+
+
+
+ Function type to end
+ the process of writing pages to a document.
+
+ This writes any file level trailers required. After this
+ completes successfully the file is up to date and complete.
+
+
+
+ Function type to end the
+ process of writing a page to a document.
+
+ dev: The device created by the begin_page function.
+
+
+
+ Function type to start
+ the process of writing a page to a document.
+
+ mediabox: page size rectangle in points.
+
+ Returns a fz_device to write page contents to.
+
+
+
+ Returns an fz_buffer containing a page after conversion to specified format.
+
+ page: The page to convert.
+ format, options: Passed to fz_new_document_writer_with_output() internally.
+ transform, cookie: Passed to fz_run_page() internally.
+
+
+
+Use text extraction to convert the input document into XHTML,
+then open the result as a new document that can be reflowed.
+
+
+
+Write image as a data URI (for HTML and SVG output).
+
+
+
+Create a scalable image from an SVG document.
+
+
+
+Parse an SVG document into a display-list.
+
+
+
+Create a scalable image from an SVG document.
+
+
+
+Parse an SVG document into a display-list.
+
+
+
+Search for the 'needle' text on the page.
+
+
+
+Search for the 'needle' text on the page.
+Record the hits in the hit_bbox array and return the number of
+hits. Will stop looking once it has filled hit_max rectangles.
+
+
+
+Convenience functions built on fz_new_buffer_from_flattened_stext_page.
+
+
+
+Convenience functions built on fz_new_buffer_from_stext_page.
+
+
+
+Does the same as fz_new_buffer_from_flattened_stext_page(), with
+the options FZ_TEXT_FLATTEN_KEEP_PARAGRAPHS.
+
+
+
+Create a new buffer by flattening the text from an stext
+page.
+
+
+
+ Extract text from page.
+
+ Ownership of the fz_stext_page is returned to the caller.
+
+
+
+ Render the page contents with control over spot colors.
+
+ Ownership of the pixmap is returned to the caller.
+
+
+
+ Render the page contents without annotations.
+
+ Ownership of the pixmap is returned to the caller.
+
+
+
+ Render the page to a pixmap using the transform and colorspace.
+
+ Ownership of the pixmap is returned to the caller.
+
+
+
+ Create a display list from page contents (no annotations).
+
+ Ownership of the display list is returned to the caller.
+
+
+
+ Create a display list.
+
+ Ownership of the display list is returned to the caller.
+
+
+
+Structure definition is public so other classes can
+derive from it. Callers should not access the members
+directly, though implementations will need initialize
+functions directly.
+
+
+
+Structure definition is public so other classes can
+derive from it. Do not access the members directly.
+
+
+
+ Iterates over all opened pages of the document, calling the
+ provided callback for each page for processing. If the callback
+ returns non-NULL then the iteration stops and that value is returned
+ to the called of fz_process_opened_pages().
+
+ The state pointer provided to fz_process_opened_pages() is
+ passed on to the callback but is owned by the caller.
+
+ Returns the first non-NULL value returned by the callback,
+ or NULL if the callback returned NULL for all opened pages.
+
+
+
+Delete an existing link on a page.
+
+
+
+Create a new link on a page.
+
+
+
+Query if a given page requires overprint.
+
+
+
+ Get the separations details for a page.
+ This will be NULL, unless the format specifically supports
+ separations (such as PDF files). May be NULL even
+ so, if there are no separations on a page.
+
+ Returns a reference that must be dropped.
+
+
+
+ Find the output intent colorspace if the document has defined
+ one.
+
+ Returns a borrowed reference that should not be dropped, unless
+ it is kept first.
+
+
+
+ Retrieve document meta data strings.
+
+ doc: The document to query.
+
+ key: Which meta data key to retrieve...
+
+ Basic information:
+ 'format' -- Document format and version.
+ 'encryption' -- Description of the encryption used.
+
+ From the document information dictionary:
+ 'info:Title'
+ 'info:Author'
+ 'info:Subject'
+ 'info:Keywords'
+ 'info:Creator'
+ 'info:Producer'
+ 'info:CreationDate'
+ 'info:ModDate'
+
+ buf: The buffer to hold the results (a nul-terminated UTF-8
+ string).
+
+ size: Size of 'buf'.
+
+ Returns the number of bytes need to store the string plus terminator
+ (will be larger than 'size' if the output was truncated), or -1 if the
+ key is not recognized or found.
+
+
+
+Check permission flags on document.
+
+
+
+Get page label for a given page.
+
+
+
+ Get the presentation details for a given page.
+
+ transition: A pointer to a transition struct to fill out.
+
+ duration: A pointer to a place to set the page duration in
+ seconds. Will be set to 0 if no transition is specified for the
+ page.
+
+ Returns: a pointer to the transition structure, or NULL if there
+ is no transition specified for the page.
+
+
+
+ Decrements the reference count for the page. When the reference
+ count hits 0, the page and its references are freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for the page. Returns the same
+ pointer.
+
+ Never throws exceptions.
+
+
+
+Run the widgets on a page through a device.
+
+
+
+Run the annotations on a page through a device.
+
+
+
+ Run a page through a device. Just the main
+ page content, without the annotations, if any.
+
+ page: Page obtained from fz_load_page.
+
+ dev: Device obtained from fz_new_*_device.
+
+ transform: Transform to apply to page. May include for example
+ scaling and rotation, see fz_scale, fz_rotate and fz_concat.
+ Set to fz_identity if no transformation is desired.
+
+ cookie: Communication mechanism between caller and library
+ rendering the page. Intended for multi-threaded applications,
+ while single-threaded applications set cookie to NULL. The
+ caller may abort an ongoing rendering of a page. Cookie also
+ communicates progress information back to the caller. The
+ fields inside cookie are continually updated while the page is
+ rendering.
+
+
+
+ Run a page through a device.
+
+ page: Page obtained from fz_load_page.
+
+ dev: Device obtained from fz_new_*_device.
+
+ transform: Transform to apply to page. May include for example
+ scaling and rotation, see fz_scale, fz_rotate and fz_concat.
+ Set to fz_identity if no transformation is desired.
+
+ cookie: Communication mechanism between caller and library
+ rendering the page. Intended for multi-threaded applications,
+ while single-threaded applications set cookie to NULL. The
+ caller may abort an ongoing rendering of a page. Cookie also
+ communicates progress information back to the caller. The
+ fields inside cookie are continually updated while the page is
+ rendering.
+
+
+
+Determine the size of a page at 72 dpi.
+
+
+
+Different document types will be implemented by deriving from
+fz_page. This macro allocates such derived structures, and
+initialises the base sections.
+
+
+
+ Load the list of links for a page.
+
+ Returns a linked list of all the links on the page, each with
+ its clickable region and link destination. Each link is
+ reference counted so drop and free the list of links by
+ calling fz_drop_link on the pointer return from fz_load_links.
+
+ page: Page obtained from fz_load_page.
+
+
+
+ Load a page.
+
+ After fz_load_page is it possible to retrieve the size of the
+ page using fz_bound_page, or to render the page using
+ fz_run_page_*. Free the page by calling fz_drop_page.
+
+ chapter: chapter number, 0 is the first chapter of the document.
+ number: page number, 0 is the first page of the chapter.
+
+
+
+Return the number of pages in a chapter.
+May return 0.
+
+
+
+Return the number of chapters in the document.
+At least 1.
+
+
+
+Load a given page number from a document. This may be much less
+efficient than loading by location (chapter+page) for some
+document types.
+
+
+
+Converts from chapter+page to page number. This may cause many
+chapters to be laid out in order to calculate the number of
+pages within those chapters.
+
+
+
+Converts from page number to chapter+page. This may cause many
+chapters to be laid out in order to calculate the number of
+pages within those chapters.
+
+
+
+Clamps a location into valid chapter/page range. (First clamps
+the chapter into range, then the page into range).
+
+
+
+Function to get the location of the previous page (allowing for
+the end of chapters etc). If already at the start of the
+document, returns the current page.
+
+
+
+Function to get the location of the next page (allowing for the
+end of chapters etc). If at the end of the document, returns the
+current location.
+
+
+
+Function to get the location for the last page in the document.
+Using this can be far more efficient in some cases than calling
+fz_count_pages and using the page number.
+
+
+
+ Run the document structure through a device.
+
+ doc: Document in question.
+
+ dev: Device obtained from fz_new_*_device.
+
+ cookie: Communication mechanism between caller and library.
+ Intended for multi-threaded applications, while
+ single-threaded applications set cookie to NULL. The
+ caller may abort an ongoing rendering of a page. Cookie also
+ communicates progress information back to the caller. The
+ fields inside cookie are continually updated while the page is
+ rendering.
+
+
+
+ Resolve an internal link to a page number.
+
+ xp, yp: Pointer to store coordinate of destination on the page.
+
+ Returns (-1,-1) if the URI cannot be resolved.
+
+
+
+ Format an internal link to a page number, location, and possible viewing parameters,
+ suitable for use with fz_create_link.
+
+ Returns a newly allocated string that the caller must free.
+
+
+
+ Resolve an internal link to a page number, location, and possible viewing parameters.
+
+ Returns location (-1,-1) if the URI cannot be resolved.
+
+
+
+ Return the number of pages in document
+
+ May return 0 for documents with no pages.
+
+
+
+Find a bookmark and return its page number.
+
+
+
+Create a bookmark for the given page, which can be used to find
+the same location after the document has been laid out with
+different parameters.
+
+
+
+ Layout reflowable document types.
+
+ w, h: Page size in points.
+ em: Default font size in points.
+
+
+
+ Is the document reflowable.
+
+ Returns 1 to indicate reflowable documents, otherwise 0.
+
+
+
+ Get an iterator for the document outline.
+
+ Should be freed by fz_drop_outline_iterator.
+
+
+
+ Load the hierarchical document outline.
+
+ Should be freed by fz_drop_outline.
+
+
+
+ Test if the given password can decrypt the document.
+
+ password: The password string to be checked. Some document
+ specifications do not specify any particular text encoding, so
+ neither do we.
+
+ Returns 0 for failure to authenticate, non-zero for success.
+
+ For PDF documents, further information can be given by examining
+ the bits in the return code.
+
+ Bit 0 => No password required
+ Bit 1 => User password authenticated
+ Bit 2 => Owner password authenticated
+
+
+
+Check if a document is encrypted with a
+non-blank password.
+
+
+
+ Decrement the document reference count. When the reference
+ count reaches 0, the document and all it's references are
+ freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the document reference count. The same pointer is
+ returned.
+
+ Never throws exceptions.
+
+
+
+New documents are typically created by calls like
+foo_new_document(fz_context *ctx, ...). These work by
+deriving a new document type from fz_document, for instance:
+typedef struct { fz_document base; ...extras... } foo_document;
+These are allocated by calling
+fz_new_derived_document(ctx, foo_document)
+
+
+
+Output accelerator data for the document to a given output
+stream.
+
+
+
+Save accelerator data for the document to a given file.
+
+
+
+Query if the document supports the saving of accelerator data.
+
+
+
+ Open a document using the specified stream object rather than
+ opening a file on disk.
+
+ magic: a string used to detect document type; either a file name
+ or mime-type.
+
+ stream: a stream of the document contents.
+
+ accel: NULL, or a stream of the 'accelerator' contents for this document.
+
+ dir: NULL, or the 'directory context' for the stream contents.
+
+ NOTE: The caller retains ownership of 'stream', 'accel' and 'dir' - the document will
+ take its own references if required.
+
+
+
+ Open a document using the specified stream object rather than
+ opening a file on disk.
+
+ magic: a string used to detect document type; either a file name
+ or mime-type.
+
+ stream: a stream of the document contents.
+
+ accel: NULL, or a stream of the 'accelerator' contents for this document.
+
+ NOTE: The caller retains ownership of 'stream' and 'accel' - the document will
+ take its own references if required.
+
+
+
+Open a document using a buffer rather than opening a file on disk.
+
+
+
+ Open a document using the specified stream object rather than
+ opening a file on disk.
+
+ magic: a string used to detect document type; either a file name
+ or mime-type.
+
+ stream: a stream representing the contents of the document file.
+
+ dir: a 'directory context' for those filetypes that need it.
+
+ NOTE: The caller retains ownership of 'stream' and 'dir' - the document will
+ take its own references if required.
+
+
+
+ Open a document using the specified stream object rather than
+ opening a file on disk.
+
+ magic: a string used to detect document type; either a file name
+ or mime-type.
+
+ stream: a stream representing the contents of the document file.
+
+ NOTE: The caller retains ownership of 'stream' - the document will take its
+ own reference if required.
+
+
+
+ Open a document file and read its basic structure so pages and
+ objects can be located. MuPDF will try to repair broken
+ documents (without actually changing the file contents).
+
+ The returned fz_document is used when calling most other
+ document related functions.
+
+ filename: a path to a file as it would be given to open(2).
+
+
+
+ Open a document file and read its basic structure so pages and
+ objects can be located. MuPDF will try to repair broken
+ documents (without actually changing the file contents).
+
+ The returned fz_document is used when calling most other
+ document related functions.
+
+ filename: a path to a file as it would be given to open(2).
+
+
+
+ Given a magic find a document handler that can handle a
+ document of this type.
+
+ stream: the file stream to sample. May be NULL if the document is
+ a directory.
+
+ dir: an fz_archive representing the directory from which the
+ stream was opened (or NULL).
+
+ magic: Can be a filename extension (including initial period) or
+ a mimetype.
+
+
+
+ Given a magic find a document handler that can handle a
+ document of this type.
+
+ stream: the file stream to sample. May be NULL if the document is
+ a directory.
+
+ magic: Can be a filename extension (including initial period) or
+ a mimetype.
+
+
+
+ Given a filename find a document handler that can handle a
+ document of this type.
+
+ filename: The filename of the document. This will be opened and sampled
+ to check data.
+
+
+
+ Given a magic find a document handler that can handle a
+ document of this type.
+
+ magic: Can be a filename extension (including initial period) or
+ a mimetype.
+
+
+
+Register handlers for all the standard document types supported in
+this build.
+
+
+
+ Register a handler for a document type.
+
+ handler: The handler to register. This must live on for the duration of the
+ use of this handler. It will be passed back to the handler for calls so
+ the caller can use it to retrieve state.
+
+
+
+Type for a function to be called when processing an already opened page.
+See fz_process_opened_pages.
+
+
+
+ Finalise a document handler.
+
+ This will be called on shutdown for a document handler to
+ release resources. This should cope with being called with NULL.
+
+ opaque: The value previously returned by the init call.
+
+
+
+ Recognize a document type from stream contents.
+
+ handler: the handler in use.
+
+ stream: stream contents to recognise (may be NULL if document is
+ a directory).
+
+ dir: directory context from which stream is loaded.
+
+ recognize_state: pointer to retrieve opaque state that may be used
+ by the open routine, or NULL.
+
+ free_recognize_state: pointer to retrieve a function pointer to
+ free the opaque state, or NULL.
+
+ Note: state and free_state should either both be NULL or
+ both be non-NULL!
+
+ Returns a number between 0 (not recognized) and 100
+ (fully recognized) based on how certain the recognizer
+ is that this is of the required type.
+
+
+
+ Recognize a document type from
+ a magic string.
+
+ handler: the handler in use.
+
+ magic: string to recognise - typically a filename or mime
+ type.
+
+ Returns a number between 0 (not recognized) and 100
+ (fully recognized) based on how certain the recognizer
+ is that this is of the required type.
+
+
+
+ Function type to open a
+ document from a file.
+
+ handler: the document handler in use.
+
+ stream: fz_stream to read document data from. Must be
+ seekable for formats that require it.
+
+ accel: fz_stream to read accelerator data from. May be
+ NULL. May be ignored.
+
+ dir: 'Directory context' in which the document is loaded;
+ associated content from (like images for an html stream
+ will be loaded from this). Maybe NULL. May be ignored.
+
+ recognize_state: NULL, or a state pointer passed back from the call
+ to recognise_content_fn. Ownership does not pass in. The
+ caller remains responsible for freeing state.
+
+ Pointer to opened document. Throws exception in case of error.
+
+
+
+Type for a function to delete a link on a page.
+
+
+
+Type for a function to create a link on a page.
+
+
+
+Type for a function to retrieve
+whether or not a given page uses overprint.
+
+
+
+Type for a function to retrieve
+details of separations on a page. See fz_get_separations
+for more information.
+
+
+
+Type for a function to detect
+whether a given separation is enabled or disabled on a page.
+See FZ_SEPARATION_DISABLED for more information.
+
+
+
+Type for a function to enable/
+disable separations on a page. See fz_control_separation for
+more information.
+
+
+
+Type for a function to
+obtain the details of how this page should be presented when
+in presentation mode. See fz_page_presentation for more
+information.
+
+
+
+Type for a function to load the links
+from a page. See fz_load_links for more information.
+
+
+
+Type for a function to run the
+contents of a page. See fz_run_page_contents for more
+information.
+
+
+
+Type for a function to return the
+bounding box of a page. See fz_bound_page for more
+information.
+
+
+
+Type for a function to release all the
+resources held by a page. Called automatically when the
+reference count for that page reaches zero.
+
+
+
+Type for a function to lookup a bookmark.
+See fz_lookup_bookmark for more information.
+
+
+
+Type for a function to make
+a bookmark. See fz_make_bookmark for more information.
+
+
+
+ Get a handle to this document as PDF.
+
+ Returns a borrowed handle.
+
+
+
+Send document structure to device
+
+
+
+Write document accelerator data
+
+
+
+Return output intent color space if it exists
+
+
+
+Type for a function to set
+a document's metadata. See fz_set_metadata for more
+information.
+
+
+
+Type for a function to query
+a document's metadata. See fz_lookup_metadata for more
+information.
+
+
+
+Type for a function to get the page label of a page in the document.
+See fz_page_label for more information.
+
+
+
+Type for a function to load a given
+page from a document. See fz_load_page for more information.
+
+
+
+Type for a function to be called to
+count the number of pages in a document. See fz_count_pages for
+more information.
+
+
+
+Type for a function to be called to
+count the number of chapters in a document. See
+fz_count_chapters for more information.
+
+
+
+Type for a function to be called to
+create an internal link to a destination (chapter/page/x/y/w/h/zoom/type
+tuple). See fz_resolve_link_dest for more information.
+
+
+
+Type for a function to be called to
+resolve an internal link to a location (chapter/page number
+tuple). See fz_resolve_link_dest for more information.
+
+
+
+Type for a function to be called to lay
+out a document. See fz_layout_document for more information.
+
+
+
+Type for a function to be called to obtain an outline iterator
+for a document. See fz_document_outline_iterator for more information.
+
+
+
+Type for a function to be called to
+load the outlines for a document. See fz_document_load_outline
+for more information.
+
+
+
+Type for a function to be
+called to see if a document grants a certain permission. See
+fz_document_has_permission for more information.
+
+
+
+Type for a function to be
+called to attempt to authenticate a password. See
+fz_authenticate_password for more information.
+
+
+
+Type for a function to be
+called to enquire whether the document needs a password
+or not. See fz_needs_password for more information.
+
+
+
+Type for a function to be called when
+the reference count for the fz_document drops to 0. The
+implementation should release any resources held by the
+document. The actual document pointer will be freed by the
+caller.
+
+
+
+Simple constructor for fz_locations.
+
+
+
+Function type for dropping the current iterator.
+
+
+
+Function type for updating the current item properties according to the given item.
+
+
+
+ Function type for deleting the current item.
+
+ This implicitly moves us to the 'next' item, and the return code is as for fz_outline_iterator_next.
+
+
+
+ Function type for inserting a new item BEFORE the current point.
+
+ Ownership of pointers are retained by the caller. The item data will be copied.
+
+ After an insert, we implicitly do a next, so that a successive insert operation
+ would insert after the item inserted here. The return code is therefore as for next.
+
+
+
+ Function types for moving the iterator position.
+
+ A negative return value means we could not move as requested. Otherwise:
+ 0 = the final position has a valid item.
+ 1 = not a valid item, but we can insert an item here.
+
+
+
+Implementation details.
+Of use to people coding new document handlers.
+
+ Function type for getting the current item.
+
+ Can return NULL. The item is only valid until the next call.
+
+
+
+Routine to implement the old Structure based API from an iterator.
+
+
+
+ Decrements the reference count. When the reference point
+ reaches zero, the outline is freed.
+
+ When freed, it will drop linked outline entries (next and down)
+ too, thus a whole outline structure can be dropped by dropping
+ the top entry.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count. Returns the same pointer.
+
+ Never throws exceptions.
+
+
+
+Create a new outline entry with zeroed fields for the caller
+to fill in.
+
+
+
+Structure based API
+ fz_outline is a tree of the outline of a document (also known
+ as table of contents).
+
+ title: Title of outline item using UTF-8 encoding. May be NULL
+ if the outline item has no text string.
+
+ uri: Destination in the document to be displayed when this
+ outline item is activated. May be an internal or external
+ link, or NULL if the outline item does not have a destination.
+
+ page: The page number of an internal link, or -1 for external
+ links or links with no destination.
+
+ next: The next outline item at the same level as this outline
+ item. May be NULL if no more outline items exist at this level.
+
+ down: The outline items immediate children in the hierarchy.
+ May be NULL if no children exist.
+
+ is_open: If zero, the outline element is closed in the UI. If
+ 1, it should be open, showing any child elements.
+
+ flags: Bit 0 set -> Bold, Bit 1 set -> Italic. All other bits
+ reserved.
+
+ r, g, b: The RGB components of the color of this entry.
+
+
+
+Drop the current iterator.
+
+
+
+Update the current item properties according to the given item.
+
+
+
+ Delete the current item.
+
+ This implicitly moves us to the 'next' item, and the return code is as for fz_outline_iterator_next.
+
+
+
+ Call to insert a new item BEFORE the current point.
+
+ Ownership of pointers are retained by the caller. The item data will be copied.
+
+ After an insert, we do not change where we are pointing.
+ The return code is the same as for next, it indicates the current iterator position.
+
+ Note that for PDF documents at least, the is_open field is ignored. All childless
+ nodes are considered closed by PDF, hence (given every newly inserted node is
+ childless by definition) all new nodes are inserted with is_open == false.
+
+
+
+ Calls to move the iterator position.
+
+ A negative return value means we could not move as requested. Otherwise:
+ 0 = the final position has a valid item.
+ 1 = not a valid item, but we can insert an item here.
+
+
+
+ Call to get the current outline item.
+
+ Can return NULL. The item is only valid until the next call.
+
+
+
+Query whether a link is external to a document (determined by
+uri containing a ':', intended to match with '://' which
+separates the scheme from the scheme specific parts in URIs).
+
+
+
+ Decrement the reference count for a link. When the reference
+ count reaches zero, the link is destroyed.
+
+ When a link is freed, the reference for any linked link (next)
+ is dropped too, thus an entire linked list of fz_link's can be
+ freed by just dropping the head.
+
+
+
+ Increment the reference count for a link. The same pointer is
+ returned.
+
+ Never throws exceptions.
+
+
+
+ Create a new link record.
+
+ next is set to NULL with the expectation that the caller will
+ handle the linked list setup. Internal function.
+
+ Different document types will be implemented by deriving from
+ fz_link. This macro allocates such derived structures, and
+ initialises the base sections.
+
+
+
+ fz_link is a list of interactive links on a page.
+
+ There is no relation between the order of the links in the
+ list and the order they appear on the page. The list of links
+ for a given page can be obtained from fz_load_links.
+
+ A link is reference counted. Dropping a reference to a link is
+ done by calling fz_drop_link.
+
+ rect: The hot zone. The area that can be clicked in
+ untransformed coordinates.
+
+ uri: Link destinations come in two forms: internal and external.
+ Internal links refer to other pages in the same document.
+ External links are URLs to other documents.
+
+ next: A pointer to the next link on the same page.
+
+
+
+ Perform subpixel quantisation and adjustment on a glyph matrix.
+
+ ctm: On entry, the desired 'ideal' transformation for a glyph.
+ On exit, adjusted to a (very similar) transformation quantised
+ for subpixel caching.
+
+ subpix_ctm: Initialised by the routine to the transform that
+ should be used to render the glyph.
+
+ qe, qf: which subpixel position we quantised to.
+
+ Returns: the size of the glyph.
+
+ Note: This is currently only exposed for use in our app. It
+ should be considered "at risk" of removal from the API.
+
+
+
+Dump debug statistics for the glyph cache.
+
+
+
+ Force a type3 font to cache the displaylist for a given glyph
+ id.
+
+ This caching can involve reading the underlying file, so must
+ happen ahead of time, so we aren't suddenly forced to read the
+ file while playing a displaylist back.
+
+
+
+ Nasty PDF interpreter specific hernia, required to allow the
+ interpreter to replay glyphs from a type3 font directly into
+ the target device.
+
+ This is only used in exceptional circumstances (such as type3
+ glyphs that inherit current graphics state, or nested type3
+ glyphs).
+
+
+
+ Create a pixmap containing a rendered glyph.
+
+ Lookup gid from font, clip it with scissor, and rendering it
+ with aa bits of antialiasing into a new pixmap.
+
+ The caller takes ownership of the pixmap and so must free it.
+
+ Note: This function is no longer used for normal rendering
+ operations, and is kept around just because we use it in the
+ app. It should be considered "at risk" of removal from the API.
+
+
+
+Purge all the glyphs from the cache.
+
+
+
+ Generate a frame of a transition.
+
+ tpix: Target pixmap
+ opix: Old pixmap
+ npix: New pixmap
+ time: Position within the transition (0 to 256)
+ trans: Transition details
+
+ Returns 1 if successfully generated a frame.
+
+ Note: Pixmaps must include alpha.
+
+
+
+ Search for occurrence of 'needle' in text page.
+
+ Call callback once for each hit. This callback will receive
+ (potentially) multiple quads for each hit.
+
+ Returns the number of hits - note that this is potentially
+ different from (i.e. is not greater than) the number of quads
+ as returned by the non callback API.
+
+ NOTE: This is an experimental interface and subject to change
+ without notice.
+
+
+
+ Search for occurrence of 'needle' in text page, matching in a given
+ style.
+
+ Return the number of quads and store hit quads in the passed in
+ array.
+
+ NOTE: This is an experimental interface and subject to change
+ without notice.
+
+
+
+Free the search structures.
+
+
+
+ Supply more stext to be searched; ownership of the stext page is
+ passed in.
+
+ This can be called immediately after an fz_search has been created
+ to give it the first page to search, or it will be requested as soon
+ as the first search operation is done on that page.
+
+ If we are calling this in response to fz_search_forwards telling
+ us that we need another page, page will be the stext for the next
+ page.
+
+ If we are calling this in response to fz_search_backwards telling
+ is that we need another page, page will be the stext for the previous
+ page.
+
+ seq is a simple integer value that will be parrotted back to us in the
+ match (typically the page number within the document).
+
+ The search function will retain the page for a while. When it has
+ finished with it, it will call fz_drop_stext_page() to release it.
+
+ Pass page = NULL to indicate that there are no more pages (in this
+ direction) to be fed.
+
+
+
+ Continue searching backwards for the next match.
+
+ Will return asking for more stext, having matched, or having
+ completed the search.
+
+ If it asks for more stext, then any further calls to this
+ function will give the same result, until stext is supplied,
+ or a NULL stext is fed in to indicate the end of the document.
+
+ Several pages may be requested before searching begins.
+
+
+
+ Continue searching for the next match.
+
+ Will return with a search result.
+
+ If it asks for more stext, feed it with the requested page (or
+ NULL to tell it it's the end of the document) before calling
+ this again.
+
+ Several pages may be requested before searching begins.
+
+
+
+ Change the options/needle to be used for a search.
+
+ If the needle is invalid (in the case of regexps, it fails to compile)
+ it will throw an error.
+
+ If the needle changes, the current position of the search within the
+ text is kept.
+
+ If the options change, the search position may revert to the beginning
+ of the current page.
+
+
+
+Create a new search.
+
+
+
+Simple function to return if a given unicode char is a hyphen.
+
+
+
+Simple function to return if a given unicode char is whitespace.
+
+
+
+Simple function to return if a given unicode char is equivalent to a space.
+
+
+
+ Create a device to OCR the text on the page.
+
+ Renders the page internally to a bitmap that is then OCRd. Text
+ is then forwarded onto the target device.
+
+ target: The target device to receive the OCRd text.
+
+ ctm: The transform to apply to the mediabox to get the size for
+ the rendered page image. Also used to calculate the resolution
+ for the page image. In general, this will be the same as the CTM
+ that you pass to fz_run_page (or fz_run_display_list) to feed
+ this device.
+
+ mediabox: The mediabox (in points). Combined with the CTM to get
+ the bounds of the pixmap used internally for the rendered page
+ image.
+
+ with_list: If with_list is false, then all non-text operations
+ are forwarded instantly to the target device. This results in
+ the target device seeing all NON-text operations, followed by
+ all the text operations (derived from OCR).
+
+ If with_list is true, then all the marking operations are
+ collated into a display list which is then replayed to the
+ target device at the end.
+
+ language: NULL (for "eng"), or a pointer to a string to describe
+ the languages/scripts that should be used for OCR (e.g.
+ "eng,ara").
+
+ datadir: NULL (for ""), or a pointer to a path string otherwise
+ provided to Tesseract in the TESSDATA_PREFIX environment variable.
+
+ progress: NULL, or function to be called periodically to indicate
+ progress. Return 0 to continue, or 1 to cancel. progress_arg is
+ returned as the void *. The int is a value between 0 and 100 to
+ indicate progress.
+
+ progress_arg: A void * value to be parrotted back to the progress
+ function.
+
+
+
+ Create a device to extract the text on a page into an existing
+ fz_stext_page structure.
+
+ Gather the text on a page into blocks and lines.
+
+ The reading order is taken from the order the text is drawn in
+ the source file, so may not be accurate.
+
+ stext_page: The text page to which content should be added. This will
+ usually be a newly created (empty) text page, but it can be one
+ containing data already (for example when merging multiple
+ pages, or watermarking).
+
+ options: Options to configure the stext device.
+
+ The next 2 parameters are copied into the fz_stext_page structure's
+ ids section, so only have to be valid if you expect to interrogate
+ that section later.
+
+ chapter_num: The chapter number that this page came from.
+
+ page_num: The page number that this page came from.
+
+ The final parameter is copied into the fz_stext_page structure's
+ ids section. The mediabox for the enture fz_stext_page is unioned
+ with this, so pass fz_empty_bbox if you don't care about getting
+ a valid value back from the ids section, but you don't want to
+ upset the value in the page->mediabox field.
+
+ mediabox: The mediabox for this page.
+
+
+
+ Create a device to extract the text on a page.
+
+ Gather the text on a page into blocks and lines.
+
+ The reading order is taken from the order the text is drawn in
+ the source file, so may not be accurate.
+
+ page: The text page to which content should be added. This will
+ usually be a newly created (empty) text page, but it can be one
+ containing data already (for example when merging multiple
+ pages, or watermarking).
+
+ options: Options to configure the stext device.
+
+
+
+ Interpret the bounded contents of a given stext page as
+ a table.
+
+ The page contents will be rewritten to contain a Table
+ structure with the identified content in it.
+
+ This uses the same logic as for fz_table_hunt, without the
+ actual hunting. fz_table_hunt hunts to find possible bounds
+ for multiple tables on the page; this routine just finds a
+ single table contained within the given rectangle.
+
+ Returns the stext_block list that contains the content of
+ the table.
+
+
+
+Hunt for possible tables within a specific rect on a page, and
+update the stext with information.
+
+
+
+Hunt for possible tables on a page, and update the stext with
+information.
+
+
+
+Attempt to break paragraphs at plausible places.
+
+
+
+ Perform segmentation analysis on a rectangle of a given
+ stext page.
+
+ Like fz_segment_stext_page, this attempts to split the given page
+ region horizontally and/or vertically repeatedly into smaller and
+ smaller "segments".
+
+ This works for pages with structure too, but splitting with
+ rectangles that cut across structure blocks may not behave as
+ expected.
+
+ This minimises the reordering of the content (as viewed from the
+ perspective of a depth first traversal), but some reordering may
+ be unavoidable.
+
+ This function accepts smaller gaps for segmentation than the full
+ page segmentation does.
+
+ Returns 0 if no changes were made to the document.
+
+ This is experimental code, and may change (or be removed) in future
+ versions!
+
+
+
+ Perform segmentation analysis on an (unstructured) page to look for
+ recursive subdivisions.
+
+ Essentially this code attempts to split the page horizontally and/or
+ vertically repeatedly into smaller and smaller "segments" (divisions).
+
+ This minimises the reordering of the content, but some reordering
+ may be unavoidable.
+
+ Returns 0 if no changes were made to the document.
+
+ This is experimental code, and may change (or be removed) in future
+ versions!
+
+
+
+Parse stext device options from a comma separated key-value
+string.
+
+
+
+ Return a newly allocated UTF-8 string with the text for a given
+ selection rectangle.
+
+ crlf: If true, write "\r\n" style line endings (otherwise "\n"
+ only).
+
+
+
+ Return a newly allocated UTF-8 string with the text for a given
+ selection.
+
+ crlf: If true, write "\r\n" style line endings (otherwise "\n"
+ only).
+
+
+
+Return a list of quads to highlight lines inside the selection
+points.
+
+
+
+ Search for occurrence of 'needle' in text page.
+
+ Call callback once for each hit. This callback will receive
+ (potentially) multiple quads for each hit.
+
+ Returns the number of hits - note that this is potentially
+ different from (i.e. is not greater than) the number of quads
+ as returned by the non callback API.
+
+ NOTE: This is an experimental interface and subject to change
+ without notice.
+
+
+
+ Callback function for use in searching.
+
+ Called with the list of quads that correspond to a single hit.
+
+ The callback should return with 0 to continue the search, or 1 to abort it.
+ All other values are reserved at this point.
+
+
+
+ Callback function for use in searching.
+
+ Called with the list of quads that correspond to a single hit.
+
+ The callback should return with 0 to continue the search, or 1 to abort it.
+ All other values are reserved at this point.
+
+
+
+ Search for occurrence of 'needle' in text page.
+ Case insensitive match.
+
+ Return the number of quads and store hit quads in the passed in
+ array.
+
+ NOTE: This is an experimental interface and subject to change
+ without notice.
+
+
+
+Output structured text to a file in plain-text UTF-8 format.
+
+
+
+Output structured text to a file in JSON format.
+
+
+
+Output structured text to a file in XML format.
+
+
+
+Output structured text to a file in XHTML (semantic) format.
+
+
+
+Output structured text to a file in HTML (visual) format.
+
+
+
+ Create an empty text page.
+
+ The text page is filled out by the text device to contain the
+ blocks and lines of text on the page.
+
+ mediabox: optional mediabox information.
+
+
+
+ When we are collecting the structure information from
+ PDF structure trees/tags, we end up with a tree of
+ nodes. The structure should be walked in depth-first
+ traversal order to extract the content.
+
+ An fz_stext_struct pointer can be NULL to indicate that
+ we know there is a child there within the complete tree,
+ but we don't know what it is yet.
+
+
+
+A text line is a list of characters that share a common baseline.
+
+
+
+A text block is a list of lines of text (typically a paragraph),
+or an image.
+
+
+
+Helper function to retrieve the details for a given id from a block.
+
+
+
+Take a new reference to an fz_stext_page.
+
+
+
+ Text extraction device: Used for searching, format conversion etc.
+
+ (In development - Subject to change in future versions)
+
+
+A text char is a unicode character, the style in which is
+appears, and the point at which it is positioned.
+
+
+
+Add a new char to the line at the end of the layout block.
+
+
+
+Add a new line to the end of the layout block.
+
+
+
+ Drop layout block. Free the pool, and linked blocks.
+
+ Never throws exceptions.
+
+
+
+Create a new layout block, with new allocation pool, zero
+matrices, and initialise linked pointers.
+
+
+
+Simple text layout (for use with annotation editing primarily).
+
+
+
+ Check for a display list being empty
+
+ list: The list to check.
+
+ Returns true if empty, false otherwise.
+
+
+
+ Create a new image from a display list.
+
+ w, h: The conceptual width/height of the image.
+
+ transform: The matrix that needs to be applied to the given
+ list to make it render to the unit square.
+
+ list: The display list.
+
+
+
+Return the bounding box of the page recorded in a display list.
+
+
+
+ Decrement the reference count for a display list. When the
+ reference count reaches zero, all the references in the display
+ list itself are dropped, and the display list is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for a display list. Returns the
+ same pointer.
+
+ Never throws exceptions.
+
+
+
+ (Re)-run a display list through a device.
+
+ list: A display list, created by fz_new_display_list and
+ populated with objects from a page by running fz_run_page on a
+ device obtained from fz_new_list_device.
+
+ ctm: Transform to apply to display list contents. May include
+ for example scaling and rotation, see fz_scale, fz_rotate and
+ fz_concat. Set to fz_identity if no transformation is desired.
+
+ scissor: Only the part of the contents of the display list
+ visible within this area will be considered when the list is
+ run through the device. This does not imply for tile objects
+ contained in the display list.
+
+ cookie: Communication mechanism between caller and library
+ running the page. Intended for multi-threaded applications,
+ while single-threaded applications set cookie to NULL. The
+ caller may abort an ongoing page run. Cookie also communicates
+ progress information back to the caller. The fields inside
+ cookie are continually updated while the page is being run.
+
+
+
+ Create a rendering device for a display list.
+
+ When the device is rendering a page it will populate the
+ display list with drawing commands (text, images, etc.). The
+ display list can later be reused to render a page many times
+ without having to re-interpret the page from the document file
+ for each rendering. Once the device is no longer needed, free
+ it with fz_drop_device.
+
+ list: A display list that the list device takes a reference to.
+
+
+
+ Create an empty display list.
+
+ A display list contains drawing commands (text, images, etc.).
+ Use fz_new_list_device for populating the list.
+
+ mediabox: Bounds of the page (in points) represented by the
+ display list.
+
+
+
+Display list device -- record and play back device commands.
+
+ fz_display_list is a list containing drawing commands (text,
+ images, etc.). The intent is two-fold: as a caching-mechanism
+ to reduce parsing of a page, and to be used as a data
+ structure in multi-threading where one thread parses the page
+ and another renders pages.
+
+ Create a display list with fz_new_display_list, hand it over to
+ fz_new_list_device to have it populated, and later replay the
+ list (once or many times) by calling fz_run_display_list. When
+ the list is no longer needed drop it with fz_drop_display_list.
+
+
+
+ Create a new pixmap and draw device, using the specified options.
+
+ options: Options to configure the draw device, and choose the
+ resolution and colorspace.
+
+ mediabox: The bounds of the page in points.
+
+ pixmap: An out parameter containing the newly created pixmap.
+
+
+
+Parse draw device options from a comma separated key-value string.
+
+
+
+ Create a device to draw on a pixmap.
+
+ dest: Target pixmap for the draw device. See fz_new_pixmap*
+ for how to obtain a pixmap. The pixmap is not cleared by the
+ draw device, see fz_clear_pixmap* for how to clear it prior to
+ calling fz_new_draw_device. Free the device by calling
+ fz_drop_device.
+
+ transform: Transform from user space in points to device space
+ in pixels.
+
+ clip: Bounding box to restrict any marking operations of the
+ draw device.
+
+ proof_cs: Color space to render to prior to mapping to color
+ space defined by pixmap.
+
+
+
+ Create a device to draw on a pixmap.
+
+ dest: Target pixmap for the draw device. See fz_new_pixmap*
+ for how to obtain a pixmap. The pixmap is not cleared by the
+ draw device, see fz_clear_pixmap* for how to clear it prior to
+ calling fz_new_draw_device. Free the device by calling
+ fz_drop_device.
+
+ transform: Transform from user space in points to device space
+ in pixels.
+
+ proof_cs: Intermediate color space to map though when mapping to
+ color space defined by pixmap.
+
+
+
+ Create a device to draw on a pixmap.
+
+ dest: Target pixmap for the draw device. See fz_new_pixmap*
+ for how to obtain a pixmap. The pixmap is not cleared by the
+ draw device, see fz_clear_pixmap* for how to clear it prior to
+ calling fz_new_draw_device. Free the device by calling
+ fz_drop_device.
+
+ transform: Transform from user space in points to device space
+ in pixels.
+
+ clip: Bounding box to restrict any marking operations of the
+ draw device.
+
+
+
+ Create a device to draw on a pixmap.
+
+ dest: Target pixmap for the draw device. See fz_new_pixmap*
+ for how to obtain a pixmap. The pixmap is not cleared by the
+ draw device, see fz_clear_pixmap* for how to clear it prior to
+ calling fz_new_draw_device. Free the device by calling
+ fz_drop_device.
+
+ transform: Transform from user space in points to device space
+ in pixels.
+
+
+
+ Create a device to test for features.
+
+ Currently only tests for the presence of non-grayscale colors.
+
+ is_color: Possible values returned:
+ 0: Definitely greyscale
+ 1: Probably color (all colors were grey, but there
+ were images or shadings in a non grey colorspace).
+ 2: Definitely color
+
+ threshold: The difference from grayscale that will be tolerated.
+ Typical values to use are either 0 (be exact) and 0.02 (allow an
+ imperceptible amount of slop).
+
+ options: A set of bitfield options, from the FZ_TEST_OPT set.
+
+ passthrough: A device to pass all calls through to, or NULL.
+ If set, then the test device can both test and pass through to
+ an underlying device (like, say, the display list device). This
+ means that a display list can be created and at the end we'll
+ know if it's colored or not.
+
+ In the absence of a passthrough device, the device will throw
+ an exception to stop page interpretation when color is found.
+
+
+
+ Create a device to compute the bounding
+ box of all marks on a page.
+
+ The returned bounding box will be the union of all bounding
+ boxes of all objects on a page.
+
+
+
+Create a device to output raw information.
+
+
+
+Create a device to print a debug trace of all device calls.
+
+
+
+Find current scissor region as tracked by the device.
+
+
+
+Disable (clear) hint bits within the hint bitfield for a device.
+
+
+
+Enable (set) hint bits within the hint bitfield for a device.
+
+
+
+ Increment the reference count for a device. Returns the same
+ pointer.
+
+ Never throws exceptions.
+
+
+
+ Reduce the reference count on a device. When the reference count
+ reaches zero, the device and its resources will be freed.
+ Don't forget to call fz_close_device before dropping the device,
+ or you may get incomplete output!
+
+ Never throws exceptions.
+
+
+
+Signal the end of input, and flush any buffered output.
+This is NOT called implicitly on fz_drop_device. This
+may throw exceptions.
+
+
+
+Devices are created by calls to device implementations, for
+instance: foo_new_device(). These will be implemented by calling
+fz_new_derived_device(ctx, foo_device) where foo_device is a
+structure "derived from" fz_device, for instance
+typedef struct { fz_device base; ...extras...} foo_device;
+
+
+
+Device calls; graphics primitives and containers.
+
+
+
+ Map from enumeration to blend mode string.
+
+ The string is static, with arbitrary lifespan.
+
+
+
+Map from (case sensitive) blend mode string to enumeration.
+
+
+
+ Look a glyph up from a font, and return the outline of the
+ glyph using the given transform.
+
+ The caller owns the returned path, and so is responsible for
+ ensuring that it eventually gets dropped.
+
+
+
+ Drop a reference and free a glyph.
+
+ Decrement the reference count for the glyph. When no
+ references remain the glyph will be freed.
+
+
+
+ Take a reference to a glyph.
+
+ pix: The glyph to increment the reference for.
+
+ Returns pix.
+
+
+
+Return the height of the glyph in pixels.
+
+
+
+Return the width of the glyph in pixels.
+
+
+
+Return the bounding box of the glyph in pixels.
+
+
+
+Glyphs represent a run length encoded set of pixels for a 2
+dimensional region of a plane.
+
+
+
+ Internal function to destroy a
+ shade. Only exposed for use with the fz_store.
+
+ shade: The reference to destroy.
+
+
+
+ Process a shade, using supplied callback functions. This
+ decomposes the shading to a mesh (even ones that are not
+ natively meshes, such as linear or radial shadings), and
+ processes triangles from those meshes.
+
+ shade: The shade to process.
+
+ ctm: The transform to use
+
+ prepare: Callback function to 'prepare' each vertex.
+ This function is passed an array of floats, and populates
+ a fz_vertex structure.
+
+ process: This function is passed 3 pointers to vertex
+ structures, and actually performs the processing (typically
+ filling the area between the vertices).
+
+ process_arg: An opaque argument passed through from caller
+ to callback functions.
+
+
+
+ Callback function type for use with
+ fz_process_shade.
+
+ arg: Opaque pointer from fz_process_shade caller.
+
+ av, bv, cv: Pointers to a fz_vertex structure describing
+ the corner locations and colors of a triangle to be
+ filled.
+
+
+
+ Callback function type for use with
+ fz_process_shade.
+
+ arg: Opaque pointer from fz_process_shade caller.
+
+ v: Pointer to a fz_vertex structure to populate.
+
+ c: Pointer to an array of floats used to populate v.
+
+
+
+ Render a shade to a given pixmap.
+
+ shade: The shade to paint.
+
+ override_cs: NULL, or colorspace to override the shades
+ inbuilt colorspace.
+
+ ctm: The transform to apply.
+
+ dest: The pixmap to render into.
+
+ color_params: The color rendering settings
+
+ bbox: Pointer to a bounding box to limit the rendering
+ of the shade.
+
+ eop: NULL, or pointer to overprint bitmap.
+
+ cache: *cache is used to cache color information. If *cache is NULL it
+ is set to point to a new fz_shade_color_cache. If cache is NULL it is
+ ignored.
+
+
+
+ Bound a given shading.
+
+ shade: The shade to bound.
+
+ ctm: The transform to apply to the shade before bounding.
+
+ r: Pointer to storage to put the bounds in.
+
+ Returns r, updated to contain the bounds for the shading.
+
+
+
+ Decrement the reference count for the shade structure. When
+ the reference count hits zero, the structure is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for the shade structure. The
+ same pointer is returned.
+
+ Never throws exceptions.
+
+
+
+ Drop a reference to the halftone. When the reference count
+ reaches zero, the halftone is destroyed.
+
+ Never throws exceptions.
+
+
+
+ Take an additional reference to the halftone. The same pointer
+ is returned.
+
+ Never throws exceptions.
+
+
+
+ Create a 'default' halftone structure
+ for the given number of components.
+
+ num_comps: The number of components to use.
+
+ Returns a simple default halftone. The default halftone uses
+ the same halftone tile for each plane, which may not be ideal
+ for all purposes.
+
+
+
+ Set the entire bitmap to 0.
+
+ Never throws exceptions.
+
+
+
+ Retrieve details of a given bitmap.
+
+ bitmap: The bitmap to query.
+
+ w: Pointer to storage to retrieve width (or NULL).
+
+ h: Pointer to storage to retrieve height (or NULL).
+
+ n: Pointer to storage to retrieve number of color components (or
+ NULL).
+
+ stride: Pointer to storage to retrieve bitmap stride (or NULL).
+
+
+
+ Create a new bitmap.
+
+ w, h: Width and Height for the bitmap
+
+ n: Number of color components (assumed to be a divisor of 8)
+
+ xres, yres: X and Y resolutions (in pixels per inch).
+
+ Returns pointer to created bitmap structure. The bitmap
+ data is uninitialised.
+
+
+
+ Make a bitmap from a pixmap and a
+ halftone, allowing for the position of the pixmap within an
+ overall banded rendering.
+
+ pix: The pixmap to generate from. Currently must be a single
+ color component with no alpha.
+
+ ht: The halftone to use. NULL implies the default halftone.
+
+ band_start: Vertical offset within the overall banded rendering
+ (in pixels)
+
+ Returns the resultant bitmap. Throws exceptions in the case of
+ failure to allocate.
+
+
+
+ Make a bitmap from a pixmap and a halftone.
+
+ img: The image to generate from. Currently must be a single
+ color component with no alpha.
+
+ ht: The halftone to use. NULL implies the default halftone.
+
+ Returns the resultant bitmap. Throws exceptions in the case of
+ failure to allocate.
+
+
+
+ Make a bitmap from a pixmap and a halftone.
+
+ pix: The pixmap to generate from. Currently must be a single
+ color component with no alpha.
+
+ ht: The halftone to use. NULL implies the default halftone.
+
+ Returns the resultant bitmap. Throws exceptions in the case of
+ failure to allocate.
+
+
+
+A halftone is a set of threshold tiles, one per component. Each
+threshold tile is a pixmap, possibly of varying sizes and
+phases. Currently, we only provide one 'default' halftone tile
+for operating on 1 component plus alpha pixmaps (where the alpha
+is ignored). This is signified by a fz_halftone pointer to NULL.
+
+
+
+ Invert bitmap.
+
+ Never throws exceptions.
+
+
+
+ Drop a reference to the bitmap. When the reference count reaches
+ zero, the bitmap will be destroyed.
+
+ Never throws exceptions.
+
+
+
+ Take an additional reference to the bitmap. The same pointer
+ is returned.
+
+ Never throws exceptions.
+
+
+
+Exposed for CBZ.
+
+
+
+Exposed because compression and decompression need to share this.
+
+
+
+Exposed for PDF.
+
+
+
+ Retrieve the underlying fz_pixmap for an image.
+
+ Returns a pointer to the underlying fz_pixmap for an image,
+ or NULL if this image is not based upon an fz_pixmap.
+
+ No reference is returned. Lifespan is limited to that of
+ the image itself. If required, use fz_keep_pixmap to take
+ a reference to keep it longer.
+
+
+
+ Retrieve the underlying compressed data for an image.
+
+ Returns a pointer to the underlying data buffer for an image,
+ or NULL if this image is not based upon a compressed data
+ buffer.
+
+ This is not a reference counted structure, so no reference is
+ returned. Lifespan is limited to that of the image itself.
+
+
+
+ Request the natural orientation of an image.
+
+ This is for images (such as JPEG) that can contain internal
+ specifications of rotation/flips. This is ignored by all the
+ internal decode/rendering routines, but can be used by callers
+ (such as the image document handler) to respect such
+ specifications.
+
+ The values used by MuPDF are as follows, with the equivalent
+ Exif specifications given for information:
+
+ 0: Undefined
+ 1: 0 degree ccw rotation. (Exif = 1)
+ 2: 90 degree ccw rotation. (Exif = 8)
+ 3: 180 degree ccw rotation. (Exif = 3)
+ 4: 270 degree ccw rotation. (Exif = 6)
+ 5: flip on X. (Exif = 2)
+ 6: flip on X, then rotate ccw by 90 degrees. (Exif = 5)
+ 7: flip on X, then rotate ccw by 180 degrees. (Exif = 4)
+ 8: flip on X, then rotate ccw by 270 degrees. (Exif = 7)
+
+
+
+ Request the natural resolution
+ of an image.
+
+ xres, yres: Pointers to ints to be updated with the
+ natural resolution of an image (or a sensible default
+ if not encoded).
+
+
+
+ Return the type of a compressed image.
+
+ Any non-compressed image will have the type returned as UNKNOWN.
+
+
+
+Return the size of the storage used by an image.
+
+
+
+ Convert pixmap from DeviceN/Separation to base colorspace.
+
+ This creates a new bitmap containing the converted pixmap data.
+
+
+
+ Convert pixmap from indexed to base colorspace.
+
+ This creates a new bitmap containing the converted pixmap data.
+
+
+
+ Decode a subarea of a compressed image. l2factor is the amount
+ of subsampling inbuilt to the stream (i.e. performed by the
+ decoder). If non NULL, l2extra is the extra amount of
+ subsampling that should be performed by this routine. This will
+ be updated on exit to the amount of subsampling that is still
+ required to be done.
+
+ Returns a kept reference.
+
+
+
+ Internal destructor for the base image class members.
+
+ Exposed to allow derived image classes to be written.
+
+
+
+Internal destructor exposed for fz_store integration.
+
+
+
+Create a new image from the contents
+of a file, inferring its type from the format of the
+data.
+
+
+
+Create a new image from a
+buffer of data, inferring its type from the format
+of the data.
+
+
+
+ Create an image from the given
+ pixmap.
+
+ pixmap: The pixmap to base the image upon. A new reference
+ to this is taken.
+
+ mask: NULL, or another image to use as a mask for this one.
+ A new reference is taken to this image. Supplying a masked
+ image as a mask to another image is illegal!
+
+
+
+ Create an image based on
+ the data in the supplied compressed buffer.
+
+ w,h: Width and height of the created image.
+
+ bpc: Bits per component.
+
+ colorspace: The colorspace (determines the number of components,
+ and any color conversions required while decoding).
+
+ xres, yres: The X and Y resolutions respectively.
+
+ interpolate: 1 if interpolation should be used when decoding
+ this image, 0 otherwise.
+
+ imagemask: 1 if this is an imagemask (i.e. transparency bitmap
+ mask), 0 otherwise.
+
+ decode: NULL, or a pointer to to a decode array. The default
+ decode array is [0 1] (repeated n times, for n color components).
+
+ colorkey: NULL, or a pointer to a colorkey array. The default
+ colorkey array is [0 255] (repeated n times, for n color
+ components).
+
+ buffer: Buffer of compressed data and compression parameters.
+ Ownership of this reference is passed in.
+
+ mask: NULL, or another image to use as a mask for this one.
+ A new reference is taken to this image. Supplying a masked
+ image as a mask to another image is illegal!
+
+
+
+ Internal function to make a new fz_image structure
+ for a derived class.
+
+ w,h: Width and height of the created image.
+
+ bpc: Bits per component.
+
+ colorspace: The colorspace (determines the number of components,
+ and any color conversions required while decoding).
+
+ xres, yres: The X and Y resolutions respectively.
+
+ interpolate: 1 if interpolation should be used when decoding
+ this image, 0 otherwise.
+
+ imagemask: 1 if this is an imagemask (i.e. transparent), 0
+ otherwise.
+
+ decode: NULL, or a pointer to to a decode array. The default
+ decode array is [0 1] (repeated n times, for n color components).
+
+ colorkey: NULL, or a pointer to a colorkey array. The default
+ colorkey array is [0 255] (repeated n times, for n color
+ components).
+
+ mask: NULL, or another image to use as a mask for this one.
+ A new reference is taken to this image. Supplying a masked
+ image as a mask to another image is illegal!
+
+ size: The size of the required allocated structure (the size of
+ the derived structure).
+
+ get: The function to be called to obtain a decoded pixmap.
+
+ get_size: The function to be called to return the storage size
+ used by this image.
+
+ drop: The function to be called to dispose of this image once
+ the last reference is dropped.
+
+ Returns a pointer to an allocated structure of the required size,
+ with the first sizeof(fz_image) bytes initialised as appropriate
+ given the supplied parameters, and the other bytes set to zero.
+
+
+
+ Function type to get the given storage
+ size for an image.
+
+ Returns the size in bytes used for a given image.
+
+
+
+ Function type to get a decoded pixmap for an image.
+
+ im: The image to decode.
+
+ subarea: NULL, or the subarea of the image required. Expressed
+ in terms of a rectangle in the original width/height of the
+ image. If non NULL, this should be updated by the function to
+ the actual subarea decoded - which must include the requested
+ area!
+
+ w, h: The actual width and height that the whole image would
+ need to be decoded to.
+
+ l2factor: On entry, the log 2 subsample factor required. If
+ possible the decode process can take care of (all or some) of
+ this subsampling, and must then update the value so the caller
+ knows what remains to be done.
+
+ Returns a reference to a decoded pixmap that satisfies the
+ requirements of the request. The caller owns the returned
+ reference.
+
+
+
+Function type to destroy an images data
+when it's reference count reaches zero.
+
+
+
+ Decrement the store key reference count for an image. When the
+ total (normal + key) reference count reaches zero, the image and
+ its resources are freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the store key reference for an image. Returns the same
+ pointer. (This is the count of references for an image held by
+ keys in the image store).
+
+ Never throws exceptions.
+
+
+
+ Decrement the (normal) reference count for an image. When the
+ total (normal + key) reference count reaches zero, the image and
+ its resources are freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the (normal) reference count for an image. Returns the
+ same pointer.
+
+ Never throws exceptions.
+
+
+
+Calls fz_get_pixmap_from_image() with ctm, subarea, w and h all set to NULL.
+
+
+
+Like fz_get_pixmap_from_image but convert to an alpha only mask using
+luminance if the image is grayscale or RGB.
+
+
+
+ Called to get a handle to a pixmap from an image.
+
+ image: The image to retrieve a pixmap from.
+
+ subarea: The subarea of the image that we actually care about
+ (or NULL to indicate the whole image).
+
+ ctm: Optional, unless subarea is given. If given, then on
+ entry this is the transform that will be applied to the complete
+ image. It should be updated on exit to the transform to apply to
+ the given subarea of the image. This is used to calculate the
+ desired width/height for subsampling.
+
+ w: If non-NULL, a pointer to an int to be updated on exit to the
+ width (in pixels) that the scaled output will cover.
+
+ h: If non-NULL, a pointer to an int to be updated on exit to the
+ height (in pixels) that the scaled output will cover.
+
+ Returns a non NULL kept pixmap pointer. May throw exceptions.
+
+
+
+Images are storable objects from which we can obtain fz_pixmaps.
+These may be implemented as simple wrappers around a pixmap, or
+as more complex things that decode at different subsample
+settings on demand.
+
+
+Structure is public to allow other structures to
+be derived from it. Do not access members directly.
+
+
+
+Create a new, UNKNOWN format, compressed_buffer.
+
+
+
+ Drop a reference to a compressed buffer. Destroys the buffer
+ and frees any storage/other references held by it.
+
+ Never throws exceptions.
+
+
+
+Map from (case sensitive) image type string to FZ_IMAGE_*
+type value.
+
+
+
+ Map from FZ_IMAGE_* value to string.
+
+ The returned string is static and therefore must not be freed.
+
+
+
+Recognise image format strings in the first 8 bytes from image
+data.
+
+
+
+Open a stream to read the decompressed version of another stream
+with optional log2 subsampling.
+
+
+
+ Open a stream to read the decompressed version of a buffer,
+ with optional log2 subsampling.
+
+ l2factor = NULL for no subsampling, or a pointer to an integer
+ containing the maximum log2 subsample factor acceptable (0 =
+ none, 1 = halve dimensions, 2 = quarter dimensions etc). If
+ non-NULL, then *l2factor will be updated on exit with the actual
+ log2 subsample factor achieved.
+
+
+
+Open a stream to read the decompressed version of a buffer.
+
+
+
+ Return the storage size used for a buffer and its data.
+ Used in implementing store handling.
+
+ Never throws exceptions.
+
+
+
+Take a reference to an fz_compressed_buffer.
+
+
+
+4bit greyscale Thunderscan decoding from the chained filter.
+Decodes lines of w pixels to 8bpp greyscale.
+
+
+
+SGI Log 32bit (LUV) decode from the chained filter.
+Decodes lines of w pixels to 8bpc rgb.
+
+
+
+SGI Log 24bit (LUV) decode from the chained filter.
+Decodes lines of w pixels to 8bpc rgb.
+
+
+
+SGI Log 16bit (greyscale) decode from the chained filter.
+Decodes lines of w pixels to 8bpp greyscale.
+
+
+
+Return buffer containing jbig2 globals data stream.
+
+
+
+Special jbig2 globals drop function for use in implementing
+store support.
+
+
+
+ Decrement the reference count for a jbig2 globals record.
+ When the reference count hits zero, the record is freed.
+
+ Never throws an exception.
+
+
+
+ Increment the reference count for a jbig2 globals record.
+
+ Never throws an exception.
+
+
+
+ Create a jbig2 globals record from a buffer.
+
+ Immutable once created.
+
+
+
+Open a filter that performs jbig2 decompression on the chained
+stream, using the optional globals record.
+
+
+
+ predict filter performs pixel prediction on data read from
+ the chained filter.
+
+ predictor: 1 = copy, 2 = tiff, other = inline PNG predictor
+
+ columns: width of image in pixels
+
+ colors: number of components.
+
+ bpc: bits per component (typically 8)
+
+
+
+ lzwd filter performs LZW decoding of data read from the chained
+ filter.
+
+ early_change: (Default 1) specifies whether to change codes 1
+ bit early.
+
+ min_bits: (Default 9) specifies the minimum number of bits to
+ use.
+
+ reverse_bits: (Default 0) allows for compatibility with gif and
+ old style tiffs (1).
+
+ old_tiff: (Default 0) allows for different handling of the clear
+ code, as found in old style tiffs.
+
+
+
+brotlid filter performs Brotli decoding of data read
+from the chained filter.
+
+
+
+ libarchived filter performs generic compressed decoding of data
+ in any format understood by libarchive from the chained filter.
+
+ This will throw an exception if libarchive is not built in, or
+ if the compression format is not recognised.
+
+
+
+ flated filter performs LZ77 decoding (inflating) of data read
+ from the chained filter.
+
+ window_bits: How large a decompression window to use. Typically
+ 15. A negative number, -n, means to use n bits, but to expect
+ raw data with no header.
+
+
+
+ faxd filter performs FAX decoding of data read from
+ the chained filter.
+
+ k: see fax specification (fax default is 0).
+
+ end_of_line: whether we expect end of line markers (fax default
+ is 0).
+
+ encoded_byte_align: whether we align to bytes after each line
+ (fax default is 0).
+
+ columns: how many columns in the image (fax default is 1728).
+
+ rows: 0 for unspecified or the number of rows of data to expect.
+
+ end_of_block: whether we expect end of block markers (fax
+ default is 1).
+
+ black_is_1: determines the polarity of the image (fax default is
+ 0).
+
+
+
+ dctd filter performs DCT (JPEG) decoding of data read
+ from the chained filter.
+
+ color_transform implements the PDF color_transform option
+ use -1 for default behavior
+ use 0 to disable YUV-RGB / YCCK-CMYK transforms
+ use 1 to enable YUV-RGB / YCCK-CMYK transforms
+
+ invert_cmyk implements the necessary inversion for Photoshop CMYK images
+ use 0 if embedded in PDF
+ use 1 if not embedded in PDF
+
+ For subsampling on decode, set l2factor to the log2 of the
+ reduction required (therefore 0 = full size decode).
+
+ jpegtables is an optional stream from which the JPEG tables
+ can be read. Use NULL if not required.
+
+
+
+rld filter performs Run Length Decoding of data read
+from the chained filter.
+
+
+
+ahxd filter performs ASCII Hex decoding of data read
+from the chained filter.
+
+
+
+a85d filter performs ASCII 85 Decoding of data read
+from the chained filter.
+
+
+
+aesd filter performs AES decoding of data read from the chained
+filter using the supplied key.
+
+
+
+arc4 filter performs RC4 decoding of data read from the chained
+filter using the supplied key.
+
+
+
+ Add a chained stream to the end of the concatenate filter.
+
+ Ownership of chain is passed in.
+
+
+
+Concat filter concatenates several streams into one.
+
+
+
+The endstream filter reads a PDF substream, and starts to look
+for an 'endstream' token after the specified length.
+
+
+
+The range filter copies data from specified ranges of the
+chained stream.
+
+
+
+The null filter reads a specified amount of data from the
+substream.
+
+
+
+Compress bitmap data as CCITT Group 4 2D fax image.
+Creates a stream assuming the default PDF parameters, except
+K=-1 and the number of columns.
+
+
+
+Compress bitmap data as CCITT Group 3 1D fax image.
+Creates a stream assuming the default PDF parameters,
+except the number of columns.
+
+
+
+Compress the contents of a fz_buffer into a
+new block malloced for that purpose. *compressed_length is
+updated on exit to contain the size used. Ownership of the block
+is returned from this function, and the caller is therefore
+responsible for freeing it. The block may be considerably larger
+than is actually required. The caller is free to fz_realloc it
+down if it wants to.
+
+
+
+Compress source_length bytes of data starting
+at source, into a new memory block malloced for that purpose.
+*compressed_length is updated on exit to contain the size used.
+Ownership of the block is returned from this function, and the
+caller is therefore responsible for freeing it. The block may be
+considerably larger than is actually required. The caller is
+free to fz_realloc it down if it wants to.
+
+
+
+Compress source_length bytes of data starting
+at source, into a buffer of length *destLen, starting at dest.
+*compressed_length will be updated on exit to contain the size
+actually used.
+
+
+
+Returns the upper bound on the
+size of brotli compressed data of length size.
+
+
+
+Compress the contents of a fz_buffer into a
+new block malloced for that purpose. *compressed_length is
+updated on exit to contain the size used. Ownership of the block
+is returned from this function, and the caller is therefore
+responsible for freeing it. The block may be considerably larger
+than is actually required. The caller is free to fz_realloc it
+down if it wants to.
+
+
+
+Compress source_length bytes of data starting
+at source, into a new memory block malloced for that purpose.
+*compressed_length is updated on exit to contain the size used.
+Ownership of the block is returned from this function, and the
+caller is therefore responsible for freeing it. The block may be
+considerably larger than is actually required. The caller is
+free to fz_realloc it down if it wants to.
+
+
+
+Compress source_length bytes of data starting
+at source, into a buffer of length *compressed_length, starting at
+dest. *compressed_length will be updated on exit to contain the size
+actually used.
+
+
+
+Returns the upper bound on the
+size of flated data of length size.
+
+
+
+Check if the pixmap is a 1-channel image containing samples with
+only values 0 and 255
+
+
+
+ Convert an existing pixmap to a desired
+ colorspace. Other properties of the pixmap, such as resolution
+ and position are copied to the converted pixmap.
+
+ pix: The pixmap to convert.
+
+ default_cs: If NULL pix->colorspace is used. It is possible that
+ the data may need to be interpreted as one of the color spaces
+ in default_cs.
+
+ cs_des: Desired colorspace, may be NULL to denote alpha-only.
+
+ prf: Proofing color space through which we need to convert.
+
+ color_params: Parameters that may be used in conversion (e.g.
+ ri).
+
+ keep_alpha: If 0 any alpha component is removed, otherwise
+ alpha is kept if present in the pixmap.
+
+
+
+ Apply gamma correction to a pixmap. All components
+ of all pixels are modified (except alpha, which is unchanged).
+
+ gamma: The gamma value to apply; 1.0 for no change.
+
+
+
+Invert all the pixels in a non-premultiplied pixmap in a
+very naive manner.
+
+
+
+Invert all the pixels in a given rectangle of a (premultiplied)
+pixmap. All components of all pixels in the rectangle are
+inverted (except alpha, which is unchanged).
+
+
+
+ Tint all the pixels in an RGB, BGR, or Gray pixmap.
+
+ black: Map black to this hexadecimal RGB color.
+
+ white: Map white to this hexadecimal RGB color.
+
+
+
+ Transform the pixels in a pixmap so that luminance of each
+ pixel is inverted, and the chrominance remains unchanged (as
+ much as accuracy allows).
+
+ All components of all pixels are inverted (except alpha, which
+ is unchanged). Only supports Grey and RGB bitmaps.
+
+
+
+Invert the alpha of all the pixels in a pixmap.
+
+
+
+Invert all the pixels in a pixmap. All components (process and
+spots) of all pixels are inverted (except alpha, which is
+unchanged).
+
+
+
+ Sets all components (including alpha) of
+ all pixels in a pixmap to 0.
+
+ pix: The pixmap to clear.
+
+
+
+ Clears a subrect of a pixmap with the given value.
+
+ pix: The pixmap to clear.
+
+ value: Values in the range 0 to 255 are valid. Each component
+ sample for each pixel in the pixmap will be set to this value,
+ while alpha will always be set to 255 (non-transparent).
+
+ r: the rectangle.
+
+
+
+Fill pixmap with solid color.
+
+
+
+ Clears a pixmap with the given value.
+
+ pix: The pixmap to clear.
+
+ value: Values in the range 0 to 255 are valid. Each component
+ sample for each pixel in the pixmap will be set to this value,
+ while alpha will always be set to 255 (non-transparent).
+
+ This function is horrible, and should be removed from the
+ API and replaced with a less magic one.
+
+
+
+Set the pixels per inch resolution of the pixmap.
+
+
+
+Return the number of bytes in a row in the pixmap.
+
+
+
+ Returns a pointer to the pixel data of a pixmap.
+
+ Returns the pointer.
+
+
+
+ Return the number of alpha planes in a pixmap.
+
+ Returns the number of alphas. Does not throw exceptions.
+
+
+
+ Return the number of spots in a pixmap.
+
+ Returns the number of spots (components, less colorants and
+ alpha). Does not throw exceptions.
+
+
+
+ Return the number of colorants in a pixmap.
+
+ Returns the number of colorants (components, less any spots and
+ alpha).
+
+
+
+ Return the number of components in a pixmap.
+
+ Returns the number of components (including spots and alpha).
+
+
+
+ Return the colorspace of a pixmap
+
+ Returns colorspace.
+
+
+
+ Decrement the reference count for the pixmap. When the
+ reference count hits 0, the pixmap is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for the pixmap. The same pointer
+ is returned.
+
+ Never throws exceptions.
+
+
+
+ Clone a pixmap, copying the pixels and associated data to new
+ storage.
+
+ The reference count of 'old' is unchanged.
+
+
+
+ Create a new pixmap that represents a subarea of the specified
+ pixmap. A reference is taken to this pixmap that will be dropped
+ on destruction.
+
+ The supplied rectangle must be wholly contained within the
+ original pixmap.
+
+ Returns a pointer to the new pixmap. Throws exception on failure
+ to allocate.
+
+
+
+ Create a pixmap of a given size, location and pixel format,
+ using the supplied data block.
+
+ The bounding box specifies the size of the created pixmap and
+ where it will be located. The colorspace determines the number
+ of components per pixel. Alpha is always present. Pixmaps are
+ reference counted, so drop references using fz_drop_pixmap.
+
+ colorspace: Colorspace format used for the created pixmap. The
+ pixmap will keep a reference to the colorspace.
+
+ rect: Bounding box specifying location/size of created pixmap.
+
+ seps: Details of separations.
+
+ alpha: Number of alpha planes (0 or 1).
+
+ samples: The data block to keep the samples in.
+
+ Returns a pointer to the new pixmap. Throws exception on failure
+ to allocate.
+
+
+
+ Create a new pixmap, with its origin at
+ (0,0) using the supplied data block.
+
+ cs: The colorspace to use for the pixmap, or NULL for an alpha
+ plane/mask.
+
+ w: The width of the pixmap (in pixels)
+
+ h: The height of the pixmap (in pixels)
+
+ seps: Details of separations.
+
+ alpha: 0 for no alpha, 1 for alpha.
+
+ stride: The byte offset from the pixel data in a row to the
+ pixel data in the next row.
+
+ samples: The data block to keep the samples in.
+
+ Returns a pointer to the new pixmap. Throws exception on failure to
+ allocate.
+
+
+
+ Create a pixmap of a given size, location and pixel format.
+
+ The bounding box specifies the size of the created pixmap and
+ where it will be located. The colorspace determines the number
+ of components per pixel. Alpha is always present. Pixmaps are
+ reference counted, so drop references using fz_drop_pixmap.
+
+ colorspace: Colorspace format used for the created pixmap. The
+ pixmap will keep a reference to the colorspace.
+
+ bbox: Bounding box specifying location/size of created pixmap.
+
+ seps: Details of separations.
+
+ alpha: 0 for no alpha, 1 for alpha.
+
+ Returns a pointer to the new pixmap. Throws exception on failure
+ to allocate.
+
+
+
+ Create a new pixmap, with its origin at (0,0)
+
+ cs: The colorspace to use for the pixmap, or NULL for an alpha
+ plane/mask.
+
+ w: The width of the pixmap (in pixels)
+
+ h: The height of the pixmap (in pixels)
+
+ seps: Details of separations.
+
+ alpha: 0 for no alpha, 1 for alpha.
+
+ Returns a pointer to the new pixmap. Throws exception on failure
+ to allocate.
+
+
+
+Return sizeof fz_pixmap plus size of data, in bytes.
+
+
+
+Return the y value of the pixmap in pixels.
+
+
+
+Return the x value of the pixmap in pixels.
+
+
+
+Return the height of the pixmap in pixels.
+
+
+
+Return the width of the pixmap in pixels.
+
+
+
+Return the bounding box for a pixmap.
+
+
+
+Pixmaps represent a set of pixels for a 2 dimensional region of
+a plane. Each pixel has n components per pixel. The components
+are in the order process-components, spot-colors, alpha, where
+there can be 0 of any of those types. The data is in
+premultiplied alpha when rendering, but non-premultiplied for
+colorspace conversions and rescaling.
+
+
+
+Get the equivalent separation color in a given colorspace.
+
+
+
+Convert a color given in terms of one colorspace,
+to a color in terms of another colorspace/separations.
+
+
+
+Return a separations object with all the spots in the input
+separations object that are set to composite, reset to be
+enabled. If there ARE no spots in the object, this returns
+NULL. If the object already has all its spots enabled, then
+just returns another handle on the same object.
+
+
+
+ Compare 2 separations structures (or NULLs).
+
+ Return 0 if identical, non-zero if not identical.
+
+
+
+Return the number of active separations.
+
+
+
+Test for the current behavior of a separation.
+
+
+
+Control the rendering of a given separation.
+
+
+
+ Add a separation with equivalents (null terminated name,
+ colorspace)
+
+ (old, deprecated)
+
+
+
+Add a separation (null terminated name, colorspace)
+
+
+
+ Decrement the reference count for a separations structure.
+ When the reference count hits zero, the separations structure
+ is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for a separations structure.
+ Returns the same pointer.
+
+ Never throws exceptions.
+
+
+
+Create a new separations structure (initially empty)
+
+
+
+ Recover ISO 639 (639-{1,2,3,5}) language specification
+ strings losslessly from a 15 bit fz_text_language code.
+
+ No validation is carried out. See note above.
+
+
+
+ Convert ISO 639 (639-{1,2,3,5}) language specification
+ strings losslessly to a 15 bit fz_text_language code.
+
+ No validation is carried out. Obviously invalid (out
+ of spec) codes will be mapped to FZ_LANG_UNSET, but
+ well-formed (but undefined) codes will be blithely
+ accepted.
+
+
+
+ Find the bounds of a given text object.
+
+ text: The text object to find the bounds of.
+
+ stroke: Pointer to the stroke attributes (for stroked
+ text), or NULL (for filled text).
+
+ ctm: The matrix in use.
+
+ r: pointer to storage for the bounds.
+
+ Returns a pointer to r, which is updated to contain the
+ bounding box for the text object.
+
+
+
+ Measure the advance width of a UTF8 string should it be added to a text object.
+
+ This uses the same layout algorithms as fz_show_string, and can be used
+ to calculate text alignment adjustments.
+
+
+
+ Add a UTF8 string to a text object.
+
+ text: Text object to add to.
+
+ font: The font the string should be added in.
+
+ trm: The transform to use.
+
+ s: The utf-8 string to add.
+
+ wmode: 1 for vertical mode, 0 for horizontal.
+
+ bidi_level: The bidirectional level for this glyph.
+
+ markup_dir: The direction of the text as specified in the markup.
+
+ language: The language in use (if known, 0 otherwise)
+ (e.g. FZ_LANG_zh_Hans).
+
+ Returns the transform updated with the advance width of the
+ string.
+
+
+
+ Add a glyph/unicode value to a text object.
+
+ text: Text object to add to.
+
+ font: The font the glyph should be added in.
+
+ trm: The transform to use for the glyph.
+
+ glyph: The glyph id to add.
+
+ unicode: The unicode character for the glyph.
+
+ cid: The CJK CID value or raw character code.
+
+ wmode: 1 for vertical mode, 0 for horizontal.
+
+ bidi_level: The bidirectional level for this glyph.
+
+ markup_dir: The direction of the text as specified in the
+ markup.
+
+ language: The language in use (if known, 0 otherwise)
+ (e.g. FZ_LANG_zh_Hans).
+
+ Throws exception on failure to allocate.
+
+
+
+ Decrement the reference count for the text object. When the
+ reference count hits zero, the text object is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for the text object. The same
+ pointer is returned.
+
+ Never throws exceptions.
+
+
+
+ Create a new empty fz_text object.
+
+ Throws exception on failure to allocate.
+
+
+
+ Check whether a given path has all its segments closed.
+
+ This includes both explicit closepaths, and where segments are implicitly
+ closed by segments that end where they started.
+
+
+
+ Check whether a given path, under the given transform
+ is an axis-aligned rectangle.
+
+ We accept zero width or height rectangles, so
+ "move 100, 100; line 200, 100" would count as
+ a rectangle too.
+
+ bounds = NULL, or place to return the rectangle
+ bounds if the path is a rectangle.
+
+
+
+ Check whether a given path, under the given transform
+ is an axis-aligned rectangle.
+
+ We accept zero width or height rectangles, so
+ "move 100, 100; line 200, 100" would count as
+ a rectangle too.
+
+
+
+ Create an identical stroke_state structure and return a
+ reference to it.
+
+ stroke: The stroke state reference to clone.
+
+ Exceptions may be thrown in the event of a failure to
+ allocate.
+
+
+
+ Given a reference to a (possibly) shared stroke_state structure,
+ return a reference to a stroke_state structure (with room for a
+ given amount of dash data) that is guaranteed to be unshared
+ (i.e. one that can safely be modified).
+
+ shared: The reference to a (possibly) shared structure
+ to unshare. Ownership of this reference is passed in
+ to this function, even in the case of exceptions being
+ thrown.
+
+ Exceptions may be thrown in the event of failure to
+ allocate if required.
+
+
+
+ Given a reference to a (possibly) shared stroke_state structure,
+ return a reference to an equivalent stroke_state structure
+ that is guaranteed to be unshared (i.e. one that can
+ safely be modified).
+
+ shared: The reference to a (possibly) shared structure
+ to unshare. Ownership of this reference is passed in
+ to this function, even in the case of exceptions being
+ thrown.
+
+ Exceptions may be thrown in the event of failure to
+ allocate if required.
+
+
+
+Drop a reference to a stroke state structure, destroying the
+structure if it is the last reference.
+
+
+
+ Take an additional reference to a stroke state structure.
+
+ No modifications should be carried out on a stroke
+ state to which more than one reference is held, as
+ this can cause race conditions.
+
+
+
+ Create a new (empty) stroke state structure, with room for
+ dash data of the given length, and return a reference to it.
+
+ len: The number of dash elements to allow room for.
+
+ Throws exception on failure to allocate.
+
+
+
+ Create a new (empty) stroke state structure (with no dash
+ data) and return a reference to it.
+
+ Throws exception on failure to allocate.
+
+
+
+A sane 'default' stroke state.
+
+
+
+Given a rectangle (assumed to be the bounding box for a path),
+expand it to allow for the expansion of the bbox that would be
+seen by stroking the path with the given stroke state and
+transform.
+
+
+
+ Return a bounding rectangle for a path.
+
+ path: The path to bound.
+
+ stroke: If NULL, the bounding rectangle given is for
+ the filled path. If non-NULL the bounding rectangle
+ given is for the path stroked with the given attributes.
+
+ ctm: The matrix to apply to the path during stroking.
+
+ r: Pointer to a fz_rect which will be used to hold
+ the result.
+
+ Returns r, updated to contain the bounding rectangle.
+
+
+
+ Transform a path by a given
+ matrix.
+
+ path: The path to modify (must not be a packed path).
+
+ transform: The transform to apply.
+
+ Throws exceptions if the path is packed, or on failure
+ to allocate.
+
+
+
+ Close the current subpath.
+
+ path: The path to modify.
+
+ Throws exceptions on failure to allocate, attempting to modify
+ a packed path, and illegal path closes (i.e. closing a non open
+ path).
+
+
+
+ Append a 'curvetoy' command to an open path. (For a
+ cubic bezier with the second control coordinate equal to
+ the end point).
+
+ path: The path to modify.
+
+ x0, y0: The coordinates of the first control point for the
+ curve.
+
+ x2, y2: The end coordinates for the curve (and the second
+ control coordinate).
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'curvetov' command to an open path. (For a
+ cubic bezier with the first control coordinate equal to
+ the start point).
+
+ path: The path to modify.
+
+ x1, y1: The coordinates of the second control point for the
+ curve.
+
+ x2, y2: The end coordinates for the curve.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'curveto' command to an open path. (For a
+ cubic bezier).
+
+ path: The path to modify.
+
+ x0, y0: The coordinates of the first control point for the
+ curve.
+
+ x1, y1: The coordinates of the second control point for the
+ curve.
+
+ x2, y2: The end coordinates for the curve.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'quadto' command to an open path. (For a
+ quadratic bezier).
+
+ path: The path to modify.
+
+ x0, y0: The control coordinates for the quadratic curve.
+
+ x1, y1: The end coordinates for the quadratic curve.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'rectto' command to an open path.
+
+ The rectangle is equivalent to:
+ moveto x0 y0
+ lineto x1 y0
+ lineto x1 y1
+ lineto x0 y1
+ closepath
+
+ path: The path to modify.
+
+ x0, y0: First corner of the rectangle.
+
+ x1, y1: Second corner of the rectangle.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'lineto' command to an open path.
+
+ path: The path to modify.
+
+ x, y: The coordinate to line to.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Append a 'moveto' command to a path.
+ This 'opens' a path.
+
+ path: The path to modify.
+
+ x, y: The coordinate to move to.
+
+ Throws exceptions on failure to allocate, or attempting to
+ modify a packed path.
+
+
+
+ Return the current point that a path has
+ reached or (0,0) if empty.
+
+ path: path to return the current point of.
+
+
+
+Find out if a path is completely empty.
+
+
+
+ Clone the data for a path.
+
+ This is used in preference to fz_keep_path when a whole
+ new copy of a path is required, rather than just a shared
+ pointer. This probably indicates that the path is about to
+ be modified.
+
+ path: path to clone.
+
+ Throws exceptions on failure to allocate.
+
+
+
+ Pack a path into the given block.
+ To minimise the size of paths, this function allows them to be
+ packed into a buffer with other information. Paths can be used
+ interchangeably regardless of how they are packed.
+
+ pack: Pointer to a block of data to pack the path into. Should
+ be aligned by the caller to the same alignment as required for
+ a fz_path pointer.
+
+ path: The path to pack.
+
+ Returns the number of bytes within the block used. Callers can
+ access the packed path data by casting the value of pack on
+ entry to be a fz_path *.
+
+ Throws exceptions on failure to allocate.
+
+ Implementation details: Paths can be 'unpacked', 'flat', or
+ 'open'. Standard paths, as created are 'unpacked'. Paths
+ will be packed as 'flat', unless they are too large
+ (where large indicates that they exceed some private
+ implementation defined limits, currently including having
+ more than 256 coordinates or commands).
+
+ Large paths are 'open' packed as a header into the given block,
+ plus pointers to other data blocks.
+
+ Users should not have to care about whether paths are 'open'
+ or 'flat' packed. Simply pack a path (if required), and then
+ forget about the details.
+
+
+
+Return the number of bytes required to pack a path.
+
+
+
+ Minimise the internal storage used by a path.
+
+ As paths are constructed, the internal buffers
+ grow. To avoid repeated reallocations they
+ grow with some spare space. Once a path has
+ been fully constructed, this call allows the
+ excess space to be trimmed.
+
+
+
+ Decrement the reference count. When the reference count hits
+ zero, free the path.
+
+ All paths can be dropped, regardless of their packing type.
+ Packed paths do not own the blocks into which they are packed
+ so dropping them does not free those blocks.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count. Returns the same pointer.
+
+ All paths can be kept, regardless of their packing type.
+
+ Never throws exceptions.
+
+
+
+Create a new (empty) path structure.
+
+
+
+ Walk the segments of a path, calling the
+ appropriate callback function from a given set for each
+ segment of the path.
+
+ path: The path to walk.
+
+ walker: The set of callback functions to use. The first
+ 4 callback pointers in the set must be non-NULL. The
+ subsequent ones can either be supplied, or can be left
+ as NULL, in which case the top 4 functions will be
+ called as appropriate to simulate them.
+
+ arg: An opaque argument passed in to each callback.
+
+ Exceptions will only be thrown if the underlying callback
+ functions throw them.
+
+
+
+ Vector path buffer.
+ It can be stroked and dashed, or be filled.
+ It has a fill rule (nonzero or even_odd).
+
+ When rendering, they are flattened, stroked and dashed straight
+ into the Global Edge List.
+
+
+
+ Ensure that a font has its ascender/descender values calculated
+ from the actual bbox of the glyphs.
+
+ Note, that we combine the declared values from the font (or the
+ default values if those are not present) with the actual bbox to
+ get the final result. So this can only cause ascender/descender
+ to move further apart!
+
+
+
+Enumerate a cmap using a callback.
+
+
+
+Callback for use in font cmap enumeration.
+
+
+
+Unlock after a Harfbuzz call. This reuses
+FZ_LOCK_FREETYPE.
+
+
+
+Internal functions for our Harfbuzz integration
+to work around the lack of thread safety.
+
+Lock against Harfbuzz being called
+simultaneously in several threads. This reuses
+FZ_LOCK_FREETYPE.
+
+
+
+ map an FT error number to a
+ static string.
+
+ err: The error number to lookup.
+
+ Returns a pointer to a static textual representation
+ of a freetype error.
+
+
+
+Retrieve the MD5 digest for the font's data.
+
+
+
+Retrieve font descender in ems.
+
+
+
+Retrieve font ascender in ems.
+
+
+
+ Find the name of a glyph
+
+ font: The font to look for the glyph in.
+
+ glyph: The glyph id to look for.
+
+ buf: Pointer to a buffer for the name to be inserted into.
+
+ size: The size of the buffer.
+
+ If a font contains a name table, then the name of the glyph
+ will be returned in the supplied buffer. Otherwise a name
+ is synthesised. The name will be truncated to fit in
+ the buffer.
+
+
+
+ Find the glyph id for
+ a given unicode character within a font, falling back to
+ an alternative if not found.
+
+ font: The font to look for the unicode character in.
+
+ unicode: The unicode character to encode.
+
+ script: The script in use.
+
+ language: The language in use.
+
+ out_font: The font handle in which the given glyph represents
+ the requested unicode character. The caller does not own the
+ reference it is passed, so should call fz_keep_font if it is
+ not simply to be used immediately.
+
+ Returns the glyph id for the given unicode value in the supplied
+ font (and sets *out_font to font) if it is present. Otherwise
+ an alternative fallback font (based on script/language) is
+ searched for. If the glyph is found therein, *out_font is set
+ to this reference, and the glyph reference is returned. If it
+ cannot be found anywhere, the function returns 0.
+
+
+
+ Encode character.
+
+ Either by direct lookup of glyphname within a font, or, failing
+ that, by mapping glyphname to unicode and thence to the glyph
+ index within the given font.
+
+ Returns zero for type3 fonts.
+
+
+
+ Encode character, preferring small-caps variant if available.
+
+ font: The font to look for the unicode character in.
+
+ unicode: The unicode character to encode.
+
+ Returns the glyph id for the given unicode value, or 0 if
+ unknown.
+
+
+
+ Find the glyph id for a given unicode
+ character within a font.
+
+ font: The font to look for the unicode character in.
+
+ unicode: The unicode character to encode.
+
+ Returns the glyph id for the given unicode value, or 0 if
+ unknown.
+
+
+
+ Return the advance for a given glyph.
+
+ font: The font to look for the glyph in.
+
+ glyph: The glyph to find the advance for.
+
+ wmode: 1 for vertical mode, 0 for horizontal.
+
+ Returns the advance for the glyph.
+
+
+
+ Run a glyph from a Type3 font to
+ a given device.
+
+ font: The font to find the glyph in.
+
+ gid: The glyph to run.
+
+ trm: The transform to apply.
+
+ dev: The device to render onto.
+
+
+The different format handlers (pdf, xps etc) interpret pages to
+a device. These devices can then process the stream of calls
+they receive in various ways:
+ The trace device outputs debugging information for the calls.
+ The draw device will render them.
+ The list device stores them in a list to play back later.
+ The text device performs text extraction and searching.
+ The bbox device calculates the bounding box for the page.
+Other devices can (and will) be written in the future.
+
+
+
+ Determine if a given glyph in a font
+ is cacheable. Certain glyphs in a type 3 font cannot safely
+ be cached, as their appearance depends on the enclosing
+ graphic state.
+
+ font: The font to look for the glyph in.
+
+ gif: The glyph to query.
+
+ Returns non-zero if cacheable, 0 if not.
+
+
+
+ Return a bbox for a given glyph in a font.
+
+ font: The font to look for the glyph in.
+
+ gid: The glyph to bound.
+
+ trm: The matrix to apply to the glyph before bounding.
+
+ Returns rectangle by value containing the bounds of the given
+ glyph.
+
+
+
+ Set the font bbox.
+
+ font: The font to set the bbox for.
+
+ xmin, ymin, xmax, ymax: The bounding box.
+
+
+
+ Drop a reference to a fz_font, destroying the
+ font when the last reference is dropped.
+
+ font: The font to drop a reference to.
+
+
+
+ Add a reference to an existing fz_font.
+
+ font: The font to add a reference to.
+
+ Returns the same font.
+
+
+
+Control whether a given font should be embedded or not when writing.
+
+
+
+Create a new font from one of the built-in fonts.
+
+
+
+ Create a new font from a font file.
+
+ Fonts created in this way, will be eligible for embedding by default.
+
+ name: Name of font (leave NULL to use name from font).
+
+ path: File path to load from.
+
+ index: Which font from the file to load (0 for default).
+
+ use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
+
+ Returns new font handle, or throws exception on error.
+
+
+
+ Create a new font from a font file in a fz_buffer.
+
+ Fonts created in this way, will be eligible for embedding by default.
+
+ name: Name of font (leave NULL to use name from font).
+
+ buffer: Buffer to load from.
+
+ index: Which font from the file to load (0 for default).
+
+ use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
+
+ Returns new font handle, or throws exception on error.
+
+
+
+ Create a new font from a font file in memory.
+
+ Fonts created in this way, will be eligible for embedding by default.
+
+ name: Name of font (leave NULL to use name from font).
+
+ data: Pointer to the font file data.
+
+ len: Length of the font file data.
+
+ index: Which font from the file to load (0 for default).
+
+ use_glyph_box: 1 if we should use the glyph bbox, 0 otherwise.
+
+ Returns new font handle, or throws exception on error.
+
+
+
+ Create a new (empty) type3 font.
+
+ name: Name of font (or NULL).
+
+ matrix: Font matrix.
+
+ Returns a new font handle, or throws exception on
+ allocation failure.
+
+
+
+ Try to load a fallback font for the
+ given combination of font attributes. Whether a font is
+ present or not will depend on the configuration in which
+ MuPDF is built.
+
+ script: The script desired (e.g. UCDN_SCRIPT_KATAKANA).
+
+ language: The language desired (e.g. FZ_LANG_ja).
+
+ serif: 1 if serif desired, 0 otherwise.
+
+ bold: 1 if bold desired, 0 otherwise.
+
+ italic: 1 if italic desired, 0 otherwise.
+
+ Returns a new font handle, or NULL if not available.
+
+
+
+Look up the Noto font file name for a given script.
+From the returned font stem, you can look for Noto fonts on the system in the form:
+ Noto(Sans|Serif)${STEM}-Regular.(otf|ttf)
+
+
+
+Search the builtin noto fonts specific symbol fonts.
+Whether a font is present or not will depend on the
+configuration in which MuPDF is built.
+
+
+
+ Search the builtin noto fonts for a match.
+ Whether a font is present or not will depend on the
+ configuration in which MuPDF is built.
+
+ script: The script desired (e.g. UCDN_SCRIPT_KATAKANA).
+
+ lang: The language desired (e.g. FZ_LANG_ja).
+
+ len: Pointer to a place to receive the length of the discovered
+ font buffer.
+
+ Returns a pointer to the font file data, or NULL if not present.
+
+
+
+Return the matching FZ_ADOBE_* ordering
+for the given language tag, such as "zh-Hant", "zh-Hans", "ja", or "ko".
+
+
+
+ Search the builtin cjk fonts for a match for a given language.
+ Whether a font is present or not will depend on the
+ configuration in which MuPDF is built.
+
+ lang: Pointer to a (case sensitive) language string (e.g.
+ "ja", "ko", "zh-Hant" etc).
+
+ len: Pointer to a place to receive the length of the discovered
+ font buffer.
+
+ subfont: Pointer to a place to store the subfont index of the
+ discovered font.
+
+ Returns a pointer to the font file data, or NULL if not present.
+
+
+
+ Search the builtin cjk fonts for a match.
+ Whether a font is present or not will depend on the
+ configuration in which MuPDF is built.
+
+ ordering: The desired ordering of the font (e.g. FZ_ADOBE_KOREA).
+
+ len: Pointer to a place to receive the length of the discovered
+ font buffer.
+
+ Returns a pointer to the font file data, or NULL if not present.
+
+
+
+ Search the builtin base14 fonts for a match.
+ Whether a given font is present or not will depend on the
+ configuration in which MuPDF is built.
+
+ name: The name of the font desired.
+
+ len: Pointer to a place to receive the length of the discovered
+ font buffer.
+
+ Returns a pointer to the font file data, or NULL if not present.
+
+
+
+ Search the builtin fonts for a match.
+ Whether a given font is present or not will depend on the
+ configuration in which MuPDF is built.
+
+ name: The name of the font desired.
+
+ bold: 1 if bold desired, 0 otherwise.
+
+ italic: 1 if italic desired, 0 otherwise.
+
+ len: Pointer to a place to receive the length of the discovered
+ font buffer.
+
+ Returns a pointer to the font file data, or NULL if not present.
+
+
+
+ Attempt to load a given font from
+ the system.
+
+ name: The name of the desired font.
+
+ ordering: The ordering to load the font from (e.g. FZ_ADOBE_KOREA)
+
+ serif: 1 if serif desired, 0 otherwise.
+
+ Returns a new font handle, or NULL if no matching font was found
+ (or on error).
+
+
+
+ Attempt to load a given font from the system.
+
+ name: The name of the desired font.
+
+ bold: 1 if bold desired, 0 otherwise.
+
+ italic: 1 if italic desired, 0 otherwise.
+
+ needs_exact_metrics: 1 if an exact metrical match is required,
+ 0 otherwise.
+
+ Returns a new font handle, or NULL if no matching font was found
+ (or on error).
+
+
+
+ Install functions to allow MuPDF to request fonts from the
+ system.
+
+ Only one set of hooks can be in use at a time.
+
+
+
+ Type for user supplied fallback font loading hook.
+
+ name: The name of the font to load.
+
+ script: UCDN script enum.
+
+ language: FZ_LANG enum.
+
+ serif, bold, italic: boolean style flags.
+
+ Returns a new font handle, or NULL if no font found (or on error).
+
+
+
+ Type for user supplied cjk font loading hook.
+
+ name: The name of the font to load.
+
+ ordering: The ordering for which to load the font (e.g.
+ FZ_ADOBE_KOREA)
+
+ serif: 1 if a serif font is desired, 0 otherwise.
+
+ Returns a new font handle, or NULL if no font found (or on error).
+
+
+
+ Type for user supplied system font loading hook.
+
+ name: The name of the font to load.
+
+ bold: 1 if a bold font desired, 0 otherwise.
+
+ italic: 1 if an italic font desired, 0 otherwise.
+ needs_exact_metrics: 1 if an exact metric match is required for
+ the font requested.
+
+ Returns a new font handle, or NULL if no font found (or on error).
+
+
+
+ Retrieve the font bbox.
+
+ font: The font to query.
+
+ Returns the font bbox by value; it is valid only if
+ fz_font_flags(font)->invalid_bbox is zero.
+
+
+
+Query whether the font flags say that this font is monospaced.
+
+
+
+Query whether the font flags say that this font is serif.
+
+
+
+Query whether the font flags say that this font is italic.
+
+
+
+Query whether the font flags say that this font is bold.
+
+
+
+ Retrieve a pointer to the name of the font.
+
+ font: The font to query.
+
+ Returns a pointer to an internal copy of the font name.
+ Will never be NULL, but may be the empty string.
+
+
+
+ Retrieve a pointer to the shaper data
+ structure for the given font.
+
+ font: The font to query.
+
+ Returns a pointer to the shaper data structure (or NULL if
+ font is NULL).
+
+
+
+ Retrieve a pointer to the font flags
+ for a given font. These can then be updated as required.
+
+ font: The font to query
+
+ Returns a pointer to the flags structure (or NULL, if
+ the font is NULL).
+
+
+
+ Retrieve the Type3 procs
+ for a font.
+
+ font: The font to query
+
+ Returns the t3_procs pointer. Will be NULL for a
+ non type-3 font.
+
+
+
+Fonts come in two variants:
+Regular fonts are handled by FreeType.
+Type 3 fonts have callbacks to the interpreter.
+
+ Retrieve the FT_Face handle
+ for the font.
+
+ font: The font to query
+
+ Returns the FT_Face handle for the font, or NULL
+ if not a freetype handled font. (Cast to void *
+ to avoid nasty header exposure).
+
+
+
+An abstract font handle.
+
+
+
+A text decoder (to read arbitrary encodings and convert to unicode).
+
+
+
+ Set new defaults within the default colorspace structure.
+
+ New references are taken to the new default, and references to
+ the old defaults dropped.
+
+ Never throws exceptions.
+
+
+
+ Retrieve default colorspaces (typically page local).
+
+ If default_cs is non NULL, the default is retrieved from there,
+ otherwise the global default is retrieved.
+
+ These return borrowed references that should not be dropped,
+ unless they are kept first.
+
+
+
+ Returns a reference to a newly cloned default colorspaces
+ structure.
+
+ The new clone may safely be altered without fear of race
+ conditions as the caller is the only reference holder.
+
+
+
+ Drop a reference to the default colorspaces structure. When the
+ reference count reaches 0, the references it holds internally
+ to the underlying colorspaces will be dropped, and the structure
+ will be destroyed.
+
+ Never throws exceptions.
+
+
+
+ Keep an additional reference to the default colorspaces
+ structure.
+
+ Never throws exceptions.
+
+
+
+ Create a new default colorspace structure with values inherited
+ from the context, and return a reference to it.
+
+ These can be overridden using fz_set_default_xxxx.
+
+ These should not be overridden while more than one caller has
+ the reference for fear of race conditions.
+
+ The caller should drop this reference once finished with it.
+
+
+
+Convert color values sv from colorspace ss into colorvalues dv
+for colorspace ds, via an optional intervening space is,
+respecting the given color_params.
+
+
+
+Clamp the samples in a color to the correct ranges for a
+given colorspace.
+
+
+
+ Retrieve a the name for a colorant.
+
+ Returns a pointer with the same lifespan as the colorspace.
+
+
+
+ Assign a name for a given colorant in a colorspace.
+
+ Used while initially setting up a colorspace. The string is
+ copied into local storage, so need not be retained by the
+ caller.
+
+
+
+ Retrieve global default colorspaces.
+
+ These return borrowed references that should not be dropped,
+ unless they are kept first.
+
+
+
+ Get the 'base' colorspace for a colorspace.
+
+ For indexed colorspaces, this is the colorspace the index
+ decodes into. For all other colorspaces, it is the colorspace
+ itself.
+
+ The returned colorspace is 'borrowed' (i.e. no additional
+ references are taken or dropped).
+
+
+
+Check to see that a colorspace is appropriate to be used as
+a blending space (i.e. only grey, rgb or cmyk).
+
+
+
+Get checksum of underlying ICC profile.
+
+
+
+Tests for particular types of colorspaces
+
+
+
+True if DeviceN color space has cyan magenta yellow or black as
+one of its colorants.
+
+
+
+True if DeviceN color space has only colorants from the CMYK set.
+
+
+
+True for CMYK, Separation and DeviceN colorspaces.
+
+
+
+Query the number of colorants in a colorspace.
+
+
+
+ Query the name of a colorspace.
+
+ The returned string has the same lifespan as the colorspace
+ does. Caller should not free it.
+
+
+
+ Create a calibrated rgb colorspace.
+
+ The returned reference should be dropped when it is finished
+ with.
+
+ Colorspaces are immutable once created.
+
+
+
+ Create a calibrated gray colorspace.
+
+ The returned reference should be dropped when it is finished
+ with.
+
+ Colorspaces are immutable once created.
+
+
+
+ Create an indexed colorspace.
+
+ The supplied lookup table is high palette entries long. Each
+ entry is n bytes long, where n is given by the number of
+ colorants in the base colorspace, one byte per colorant.
+
+ Ownership of lookup is passed it; it will be freed on
+ destruction, so must be heap allocated.
+
+ The colorspace will keep an additional reference to the base
+ colorspace that will be dropped on destruction.
+
+ The returned reference should be dropped when it is finished
+ with.
+
+ Colorspaces are immutable once created.
+
+
+
+ Drops a reference to the colorspace.
+
+ When the reference count reaches zero, the colorspace is
+ destroyed.
+
+
+
+ Increment the reference count for the colorspace.
+
+ Returns the same pointer. Never throws an exception.
+
+
+
+ Creates a new colorspace instance and returns a reference.
+
+ No internal checking is done that the colorspace type (e.g.
+ CMYK) matches with the flags (e.g. FZ_COLORSPACE_HAS_CMYK) or
+ colorant count (n) or name.
+
+ The reference should be dropped when it is finished with.
+
+ Colorspaces are immutable once created (with the exception of
+ setting up colorant names for separation spaces).
+
+
+ Create a colorspace from an ICC profile supplied in buf.
+
+ Limited checking is done to ensure that the colorspace type is
+ appropriate for the supplied ICC profile.
+
+ An additional reference is taken to buf, which will be dropped
+ on destruction. Ownership is NOT passed in.
+
+ The returned reference should be dropped when it is finished
+ with.
+
+ Colorspaces are immutable once created.
+
+
+Query the type of colorspace.
+
+
+
+ Map from enumerated rendering intent to string.
+
+ The returned string is static and therefore must not be freed.
+
+
+
+Map from (case sensitive) rendering intent string to enumeration
+value.
+
+
+
+Pixmaps represent a set of pixels for a 2 dimensional region of
+a plane. Each pixel has n components per pixel. The components
+are in the order process-components, spot-colors, alpha, where
+there can be 0 of any of those types. The data is in
+premultiplied alpha when rendering, but non-premultiplied for
+colorspace conversions and rescaling.
+
+
+ Pixmaps represent a set of pixels for a 2 dimensional region of
+ a plane. Each pixel has n components per pixel. The components
+ are in the order process-components, spot-colors, alpha, where
+ there can be 0 of any of those types. The data is in
+ premultiplied alpha when rendering, but non-premultiplied for
+ colorspace conversions and rescaling.
+
+ x, y: The minimum x and y coord of the region in pixels.
+
+ w, h: The width and height of the region in pixels.
+
+ n: The number of color components in the image.
+ n = num composite colors + num spots + num alphas
+
+ s: The number of spot channels in the image.
+
+ alpha: 0 for no alpha, 1 for alpha present.
+
+ flags: flag bits.
+ Bit 0: If set, draw the image with linear interpolation.
+ Bit 1: If set, free the samples buffer when the pixmap
+ is destroyed.
+
+ stride: The byte offset from the data for any given pixel
+ to the data for the same pixel on the row below.
+
+ seps: NULL, or a pointer to a separations structure. If NULL,
+ s should be 0.
+
+ xres, yres: Image resolution in dpi. Default is 96 dpi.
+
+ colorspace: Pointer to a colorspace object describing the
+ colorspace the pixmap is in. If NULL, the image is a mask.
+
+ samples: Pointer to the first byte of the pixmap sample data.
+ This is typically a simple block of memory w * h * n bytes of
+ memory in which the components are stored linearly, but with the
+ use of appropriate stride values, scanlines can be stored in
+ different orders, and have different amounts of padding. The
+ first n bytes are components 0 to n-1 for the pixel at (x,y).
+ Each successive n bytes gives another pixel in scanline order
+ as we move across the line. The start of each scanline is offset
+ the start of the previous one by stride bytes.
+
+
+
+Describes a given colorspace.
+
+
+
+Opaque type for an ICC Profile.
+
+
+
+ Decrement the defer reap count.
+
+ If the defer reap count returns to 0, and the store
+ has reapable objects in, a reap pass will begin.
+
+ Call this at the end of a process during which you
+ potentially might drop many reapable objects.
+
+ It is vital that every fz_defer_reap_start is matched
+ by a fz_defer_reap_end call.
+
+
+
+ Increment the defer reap count.
+
+ No reap operations will take place (except for those
+ triggered by an immediate failed malloc) until the
+ defer reap count returns to 0.
+
+ Call this at the start of a process during which you
+ potentially might drop many reapable objects.
+
+ It is vital that every fz_defer_reap_start is matched
+ by a fz_defer_reap_end call.
+
+
+
+Output debugging information for the current state of the store
+to the given output channel.
+
+
+
+Filter the store and throw away any stored tiles drawn for a
+given document.
+
+
+
+ Filter every element in the store with a matching type with the
+ given function.
+
+ If the function returns 1 for an element, drop the element.
+
+
+
+ Callback function called by fz_filter_store on every item within
+ the store.
+
+ Return 1 to drop the item from the store, 0 to retain.
+
+
+
+ Evict items from the store until the total size of
+ the objects in the store is reduced to a given percentage of its
+ current size.
+
+ percent: %age of current size to reduce the store to.
+
+ Returns non zero if we managed to free enough memory, zero
+ otherwise.
+
+
+
+ External function for callers to use
+ to scavenge while trying allocations.
+
+ size: The number of bytes we are trying to have free.
+
+ phase: What phase of the scavenge we are in. Updated on exit.
+
+ Returns non zero if we managed to free any memory.
+
+
+
+ Internal function used as part of the scavenging
+ allocator; when we fail to allocate memory, before returning a
+ failure to the caller, we try to scavenge space within the store
+ by evicting at least 'size' bytes. The allocator then retries.
+
+ size: The number of bytes we are trying to have free.
+
+ phase: What phase of the scavenge we are in. Updated on exit.
+
+ Returns non zero if we managed to free any memory.
+
+
+
+Evict every item from the store.
+
+
+
+ Remove an item from the store.
+
+ If an item indexed by the given key exists in the store, remove
+ it.
+
+ drop: The function used to free the value (to ensure we get a
+ value of the correct type).
+
+ key: The key used to find the item to remove.
+
+ type: Functions used to manipulate the key.
+
+
+
+ Find an item within the store.
+
+ drop: The function used to free the value (to ensure we get a
+ value of the correct type).
+
+ key: The key used to index the item.
+
+ type: Functions used to manipulate the key.
+
+ Returns NULL for not found, otherwise returns a pointer to the
+ value indexed by key to which a reference has been taken.
+
+
+
+ Add an item to the store.
+
+ Add an item into the store, returning NULL for success. If an
+ item with the same key is found in the store, then our item will
+ not be inserted, and the function will return a pointer to that
+ value instead. This function takes its own reference to val, as
+ required (i.e. the caller maintains ownership of its own
+ reference).
+
+ key: The key used to index the item.
+
+ val: The value to store.
+
+ itemsize: The size in bytes of the value (as counted towards the
+ store size).
+
+ type: Functions used to manipulate the key.
+
+
+
+ Decrement the reference count for the store context. When the
+ reference count hits zero, the store context is freed.
+
+ Never throws exceptions.
+
+
+
+ Increment the reference count for the store context. Returns
+ the same pointer.
+
+ Never throws exceptions.
+
+
+
+ Create a new store inside the context
+
+ max: The maximum size (in bytes) that the store is allowed to
+ grow to. FZ_STORE_UNLIMITED means no limit.
+
+
+
+ Decrement the (key) reference count for a storable object.
+ When the total reference count hits zero, the drop function for
+ that object is called to free the object.
+
+ Never throws exceptions.
+
+
+
+ Increment the (key) reference count for a key storable
+ object. Returns the same pointer.
+
+ Never throws exceptions.
+
+
+
+ Decrement the (normal) reference count for a storable object.
+ When the total reference count hits zero, the drop function for
+ that object is called to free the object.
+
+ Never throws exceptions.
+
+
+
+ Increment the (normal) reference count for a key storable
+ object. Returns the same pointer.
+
+ Never throws exceptions.
+
+
+
+ Decrement the reference count for a storable object. When the
+ reference count hits zero, the drop function for that object
+ is called to free the object.
+
+ Never throws exceptions.
+
+
+
+Macros to initialise a storable object.
+
+Macro to initialise a key storable object.
+
+ Increment the reference count for a storable object.
+ Returns the same pointer.
+
+ Never throws exceptions.
+
+
+
+ Function type for a function to check whether a storable
+ object can be dropped at the moment.
+
+ Return 0 for 'cannot be dropped', 1 otherwise.
+
+
+
+ Function type for a function to drop a storable object.
+
+ Objects within the store are identified by type by comparing
+ their drop_fn pointers.
+
+
+
+ Resource store
+
+ MuPDF stores decoded "objects" into a store for potential reuse.
+ If the size of the store gets too big, objects stored within it
+ can be evicted and freed to recover space. When MuPDF comes to
+ decode such an object, it will check to see if a version of this
+ object is already in the store - if it is, it will simply reuse
+ it. If not, it will decode it and place it into the store.
+
+ All objects that can be placed into the store are derived from
+ the fz_storable type (i.e. this should be the first component of
+ the objects structure). This allows for consistent (thread safe)
+ reference counting, and includes a function that will be called
+ to free the object as soon as the reference count reaches zero.
+
+ Most objects offer fz_keep_XXXX/fz_drop_XXXX functions derived
+ from fz_keep_storable/fz_drop_storable. Creation of such objects
+ includes a call to FZ_INIT_STORABLE to set up the fz_storable
+ header.
+
+
+Any storable object should include an fz_storable structure
+at the start (by convention at least) of their structure.
+(Unless it starts with an fz_key_storable, see below).
+
+
+
+As for fz_write_xml, but direct to a file.
+
+
+
+ Write our xml structure out to an xml stream.
+
+ Properly formatted XML is only allowed to have a single top-level node
+ under which everything must sit. Our structures allow for multiple
+ top level nodes. If required, we will output an extra 'ROOT' node
+ at the top so that the xml is well-formed.
+
+ If 'indented' is non-zero then additional whitespace will be added to
+ make the XML easier to read in a text editor. It will NOT be properly
+ compliant.
+
+
+
+ Create a new dom text node.
+
+ This will NOT be linked in yet.
+
+
+
+ Create a new dom node.
+
+ This will NOT be linked in yet.
+
+
+
+Make new xml dom root element.
+
+
+
+ Enumerate through the attributes of an element.
+
+ Call with i=0,1,2,3... to enumerate attributes.
+
+ On return *att and the return value will be NULL if there are not
+ that many attributes to read. Otherwise, *att will be filled in
+ with a borrowed pointer to the attribute name, and the return
+ value will be a borrowed pointer to the value.
+
+
+
+ Retrieve the value of a given attribute from a given element.
+
+ Returns a borrowed pointer to the value or NULL if not found.
+
+
+
+Remove an attribute from an element.
+
+
+
+ Add an attribute to an element.
+
+ Ownership of att and value remain with the caller.
+
+
+
+Return a borrowed reference to the previous sibling of a node,
+or NULL if there isn't one.
+
+
+
+Return a borrowed reference to the next sibling of a node,
+or NULL if there isn't one.
+
+
+
+Return a borrowed reference to the parent of a node,
+or NULL if there isn't one.
+
+
+
+Return a borrowed reference to the first child of a node,
+or NULL if there isn't one.
+
+
+
+ Clone an element (and its children).
+
+ A borrowed reference to the clone is returned. The clone is not
+ yet linked into the DOM.
+
+
+
+ Remove an element from the DOM. The element can be added back elsewhere
+ if required.
+
+ No reference counting changes for the element.
+
+
+
+Insert an element (new_elt), after another element (node),
+unlinking the new_elt from its current position if required.
+
+
+
+Insert an element (new_elt), before another element (node),
+unlinking the new_elt from its current position if required.
+
+
+
+Insert an element as the last child of a parent, unlinking the
+child from its current position if required.
+
+
+
+Find the next element matching the requirements.
+
+
+
+ Find the first element matching the requirements in a depth first traversal from elt.
+
+ The tagname must match tag, unless tag is NULL, when all tag names are considered to match.
+
+ If att is NULL, then all tags match.
+ Otherwise:
+ If match is NULL, then only nodes that have an att attribute match.
+ If match is non-NULL, then only nodes that have an att attribute that matches match match.
+
+ Returns NULL (if no match found), or a borrowed reference to the first matching element.
+
+
+
+ Create a text node for the given DOM.
+
+ The element is not linked into the DOM yet.
+
+
+
+ Create an element of a given tag type for the given DOM.
+
+ The element is not linked into the DOM yet.
+
+
+
+Return a borrowed reference for the document (the top
+level element) of the DOM.
+
+
+
+DOM-like functions for html in xml.
+
+Return a borrowed reference for the 'body' element of
+the given DOM.
+
+
+
+Extract and concatenate all plain text data from XML tree into a new string.
+
+
+
+Perform a depth first search onwards from item, returning the first
+child that matches the given tag (or any tag if tag is NULL),
+with the given attribute (if att is non NULL), that matches
+match (if match is non NULL). The search stops if it ever reaches
+the top of the tree, or the declared 'top' item.
+
+
+
+Perform a depth first search onwards from item, returning the first
+child that matches the given tag (or any tag if tag is NULL),
+with the given attribute (if att is non NULL), that matches
+match (if match is non NULL).
+
+
+
+Perform a depth first search from item, returning the first
+child that matches the given tag (or any tag if tag is NULL),
+with the given attribute (if att is non NULL), that matches
+match (if match is non NULL). The search stops if it ever
+reaches the top of the tree, or the declared 'top' item.
+
+
+
+Perform a depth first search from item, returning the first
+child that matches the given tag (or any tag if tag is NULL),
+with the given attribute (if att is non NULL), that matches
+match (if match is non NULL).
+
+
+
+ Search the siblings of XML nodes starting with the first child
+ of item looking for the first with the given tag (or any tag if
+ tag is NULL), and with a matching attribute.
+
+ Return NULL if none found.
+
+
+
+ Search the siblings of XML nodes starting with the first sibling
+ of item looking for the first with the given tag (or any tag if tag
+ is NULL), and with a matching attribute.
+
+ Return NULL if none found.
+
+
+
+ Search the siblings of XML nodes starting with item looking for
+ the first with the given tag (or any tag if tag is NULL), and
+ with a matching attribute.
+
+ Return NULL if none found.
+
+
+
+ Search the siblings of XML nodes starting with the first child
+ of item looking for the first with the given tag.
+
+ Return NULL if none found.
+
+
+
+ Search the siblings of XML nodes starting with the first sibling
+ of item looking for the first with the given tag.
+
+ Return NULL if none found.
+
+
+
+ Search the siblings of XML nodes starting with item looking for
+ the first with the given tag.
+
+ Return NULL if none found.
+
+
+
+Pretty-print an XML tree to stdout. (Deprecated, use
+fz_output_xml in preference).
+
+
+
+Pretty-print an XML tree to given output.
+
+
+
+Return the text content of an XML node.
+Return NULL if the node is a tag.
+
+
+
+Add an attribute to an XML node.
+
+
+
+ Check for a matching attribute on an XML node.
+
+ If the node has the requested attribute (name), and the value
+ matches (match) then return 1. Otherwise, 0.
+
+
+
+Return the value of an attribute of an XML node.
+If the first attribute doesn't exist, try the second.
+NULL if neither attribute exists.
+
+
+
+Return the value of an attribute of an XML node.
+NULL if the attribute doesn't exist.
+
+
+
+Return tag of XML node. Return NULL for text nodes.
+
+
+
+Return true if the tag name matches.
+
+
+
+Return first child of XML node.
+
+
+
+Return parent of XML node.
+
+
+
+Return next sibling of XML node.
+
+
+
+Return previous sibling of XML node.
+
+
+
+Return the topmost XML node of a document.
+
+
+
+Detach a node from the tree, unlinking it from its parent,
+and setting the document root to the node.
+
+
+
+Drop a reference to the XML. When the last reference is
+dropped, the node and all its children and siblings will
+be freed.
+
+
+
+Add a reference to the XML.
+
+
+
+Parse the contents of a buffer into a tree of XML nodes,
+using the HTML5 parsing algorithm.
+
+
+
+ Try and parse the contents of an archive entry into a tree of xml nodes.
+
+ preserve_white: whether to keep or delete all-whitespace nodes.
+
+ Will return NULL if the archive entry can't be found. Otherwise behaves
+ the same as fz_parse_xml_archive_entry. May throw exceptions.
+
+
+
+ Parse the contents of an archive entry into a tree of xml nodes.
+
+ preserve_white: whether to keep or delete all-whitespace nodes.
+
+
+
+ Parse the contents of buffer into a tree of xml nodes.
+
+ preserve_white: whether to keep or delete all-whitespace nodes.
+
+
+
+ Parse the contents of buffer into a tree of xml nodes.
+
+ preserve_white: whether to keep or delete all-whitespace nodes.
+
+
+
+XML document model
+
+
+
+ Add an archive to the set of archives handled by a multi
+ archive.
+
+ If path is NULL, then the archive contents will appear at the
+ top level, otherwise, the archives contents will appear prefixed
+ by path.
+
+
+
+Create a new multi archive (initially empty).
+
+
+
+ Add a named block of data to an existing tree archive.
+
+ The data will be copied into a buffer, and so the caller
+ may free it as soon as this returns.
+
+
+
+ Add a named buffer to an existing tree archive.
+
+ The tree will take a new reference to the buffer. Ownership
+ is not transferred.
+
+
+
+ Create an archive that holds named buffers.
+
+ tree can either be a preformed tree with fz_buffers as values,
+ or it can be NULL for an empty tree.
+
+
+
+ Drop the reference to the zipfile.
+
+ In common with other 'drop' methods, this will never throw an
+ exception.
+
+
+
+ Close the zip file for writing.
+
+ This flushes any pending data to the file. This can throw
+ exceptions.
+
+
+
+Given a buffer of data, (optionally) compress it, and add it to
+the zip file with the given name.
+
+
+
+ Create a new zip writer that writes to a given output stream.
+
+ Ownership of out passes in immediately upon calling this function.
+ The caller should never drop the fz_output, even if this function throws
+ an exception.
+
+
+
+ Create a new zip writer that writes to a given file.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+
+
+fz_zip_writer offers methods for creating and writing zip files.
+It can be seen as the reverse of the fz_archive zip
+implementation.
+
+
+
+Open a zip archive from static data.
+
+
+
+ Open a zip archive stream.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+ An exception is thrown if the stream is not a zip archive as
+ indicated by the presence of a zip signature.
+
+
+
+
+ Open a zip archive file.
+
+ An exception is thrown if the file is not a zip archive as
+ indicated by the presence of a zip signature.
+
+ filename: a path to a zip archive file as it would be given to
+ open(2).
+
+
+
+fz_archive: zip implementation
+
+ Detect if stream object is a zip archive.
+
+ Assumes that the stream object is seekable.
+
+
+
+ Open a cfb file as an archive.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+ An exception is thrown if the file is not recognised as a chm.
+
+
+
+ Open a cfb file as an archive.
+
+ An exception is thrown if the file is not recognised as a cfb.
+
+ filename: a path to an archive file as it would be given to
+ open(2).
+
+
+
+ Open an archive using libarchive.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+ An exception is thrown if the stream is not supported by libarchive.
+
+
+
+ Open an archive using libarchive.
+
+ An exception is thrown if the file is not supported by libarchive.
+
+ filename: a path to an archive file as it would be given to
+ open(2).
+
+
+
+ Open a tar archive stream.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+ An exception is thrown if the stream is not a tar archive as
+ indicated by the presence of a tar signature.
+
+
+
+
+ Open a tar archive file.
+
+ An exception is thrown if the file is not a tar archive as
+ indicated by the presence of a tar signature.
+
+ filename: a path to a tar archive file as it would be given to
+ open(2).
+
+
+
+ Detect if stream object is a cfb archive.
+
+ Assumes that the stream object is seekable.
+
+
+
+ Detect if stream object is an archive supported by libarchive.
+
+ Assumes that the stream object is seekable.
+
+
+
+fz_archive: tar implementation
+
+ Detect if stream object is a tar archive.
+
+ Assumes that the stream object is seekable.
+
+
+
+ Reads all bytes in an archive entry
+ into a buffer.
+
+ name: Entry name to look for, this must be an exact match to
+ the entry name in the archive.
+
+ Returns NULL if a matching entry cannot be found. Otherwise behaves
+ the same as fz_read_archive_entry. Exceptions may be thrown.
+
+
+
+ Reads all bytes in an archive entry
+ into a buffer.
+
+ name: Entry name to look for, this must be an exact match to
+ the entry name in the archive.
+
+ Throws an exception if a matching entry cannot be found.
+
+
+
+ Opens an archive entry as a stream.
+
+ Returns NULL if a matching entry cannot be found, otherwise
+ behaves exactly as fz_open_archive_entry.
+
+
+
+ Opens an archive entry as a stream.
+
+ name: Entry name to look for, this must be an exact match to
+ the entry name in the archive.
+
+ Throws an exception if a matching entry cannot be found.
+
+
+
+ Check if entry by given name exists.
+
+ If named entry does not exist 0 will be returned, if it does
+ exist 1 is returned.
+
+ name: Entry name to look for, this must be an exact match to
+ the entry name in the archive.
+
+
+
+ Number of entries in archive.
+
+ Will always return a value >= 0.
+
+ May throw an exception if this type of archive cannot count the
+ entries (such as a directory).
+
+
+
+ Return a pointer to a string describing the format of the
+ archive.
+
+ The lifetime of the string is unspecified (in current
+ implementations the string will persist until the archive
+ is closed, but this is not guaranteed).
+
+
+
+Keep a reference to an archive.
+
+
+
+ Drop a reference to an archive.
+
+ When the last reference is dropped, this closes and releases
+ any memory or filehandles associated with the archive.
+
+
+
+ Determine if a given path is a directory.
+
+ In the case of the path not existing, or having no access
+ we will return 0.
+
+
+
+ Open a directory as if it was an archive.
+
+ A special case where a directory is opened as if it was an
+ archive.
+
+ Note that for directories it is not possible to retrieve the
+ number of entries or list the entries. It is however possible
+ to check if the archive has a particular entry.
+
+ path: a path to a directory as it would be given to opendir(3).
+
+
+
+ Open zip or tar archive stream.
+
+ Does the same as fz_open_archive_with_stream, but will not throw
+ an error in the event of failing to recognise the format. Will
+ still throw errors in other cases though!
+
+
+
+ Open zip or tar archive stream.
+
+ Open an archive using a seekable stream object rather than
+ opening a file or directory on disk.
+
+
+
+ Open a zip or tar archive
+
+ Open a file and identify its archive type based on the archive
+ signature contained inside.
+
+ filename: a path to a file as it would be given to open(2).
+
+
+
+ fz_archive:
+
+ fz_archive provides methods for accessing "archive" files.
+ An archive file is a conceptual entity that contains multiple
+ files, which can be counted, enumerated, and read.
+
+ Implementations of fz_archive based upon directories, zip
+ and tar files are included.
+
+
+Implementation details: Subject to change.
+
+
+
+ Prototype for callback function supplied to fz_bidi_fragment_text.
+
+ @param fragment first character in fragment
+ @param fragmentLen number of characters in fragment
+ @param bidiLevel The bidirectional level for this text.
+ The bottom bit will be set iff block
+ should concatenate with other blocks as
+ right-to-left
+ @param script the script in use for this fragment (other
+ than common or inherited)
+ @param arg data from caller of Bidi_fragmentText
+
+
+
+ Drop the tree.
+
+ The storage used by the tree is freed, and each value has
+ dropfunc called on it.
+
+
+
+ Insert a new key/value pair and rebalance the tree.
+ Return the new root of the tree after inserting and rebalancing.
+ May be called with a NULL root to create a new tree.
+
+ No data is copied into the tree structure; key and value are
+ merely kept as pointers.
+
+
+
+ Look for the value of a node in the tree with the given key.
+
+ Simple pointer equivalence is used for key.
+
+ Returns NULL for no match.
+
+
+
+AA-tree to look up things by strings.
+
+
+
+Get the length of the array.
+
+
+
+Lookup an element in the array.
+
+
+
+ Append an element to the end of the array.
+
+ Returns a pointer to the new element (initially all 0's), and
+ (optionally) the index of that element.
+
+
+
+Create a new pool array for a given type, with a given initial size.
+
+
+
+ Routines to handle a 'variable length array' within the pool.
+
+ Appending to the array, and looking up items within the array
+ are O(log n) operations.
+
+
+
+Drop a pool, freeing and invalidating all storage returned from
+the pool.
+
+
+
+ The current size of the pool.
+
+ The number of bytes of storage currently allocated to the pool.
+ This is the total of the storage used for the blocks making
+ up the pool, rather then total of the allocated blocks so far,
+ so it will increase in 'lumps'.
+ from the pool, then the pool size may still be X
+
+
+
+strdup equivalent allocating from the pool.
+
+
+
+Allocate a block of size bytes from the pool.
+
+
+
+Create a new pool to allocate from.
+
+
+
+ Simple pool allocators.
+
+ Allocate from the pool, which can then be freed at once.
+
+
+
+Iterate over the entries in a hash table, removing all the ones where callback returns true.
+Does NOT free the value of the entry, so the caller is expected to take care of this.
+
+
+
+Callback function called on each key/value pair in the hash
+table, when fz_hash_filter is run to remove entries where the
+callback returns true.
+
+
+
+Iterate over the entries in a hash table.
+
+
+
+Callback function called on each key/value pair in the hash
+table, when fz_hash_for_each is run.
+
+
+
+ Remove the entry for a given key.
+
+ The value is NOT freed, so the caller is expected to take care
+ of this.
+
+
+
+ Insert a new key/value pair into the hash table.
+
+ If an existing entry with the same key is found, no change is
+ made to the hash table, and a pointer to the existing value is
+ returned.
+
+ If no existing entry with the same key is found, ownership of
+ val passes in, key is copied, and NULL is returned.
+
+
+
+Search for a matching hash within the table, and return the
+associated value.
+
+
+
+ Destroy the hash table.
+
+ Values are dropped using the drop function.
+
+
+
+ Create a new hash table.
+
+ initialsize: The initial size of the hashtable. The hashtable
+ may grow (double in size) if it starts to get crowded (80%
+ full).
+
+ keylen: byte length for each key.
+
+ lock: -1 for no lock, otherwise the FZ_LOCK to use to protect
+ this table.
+
+ drop_val: Function to use to destroy values on table drop.
+
+
+
+ Function type called when a hash table entry is dropped.
+
+ Only used when the entire hash table is dropped.
+
+
+
+ Generic hash-table with fixed-length keys.
+
+ The keys and values are NOT reference counted by the hash table.
+ Callers are responsible for taking care the reference counts are
+ correct. Inserting a duplicate entry will NOT overwrite the old
+ value, and will return the old value.
+
+ The drop_val callback function is only used to release values
+ when the hash table is destroyed.
+
+
+
+Convert "-" to "/dev/stdout" for use with command lines.
+Also converts "nul" and "con" on Windows.
+
+
+
+ Return the index of a (case-insensitive) option within an optlist.
+
+ For instance for optlist = "Foo|Bar|Baz", and opt = "bar",
+ this would return 1.
+
+ If the optlist ends with "|*" then that is a catch all case and
+ matches all options allowing the caller to process it itself.
+ fz_optarg will be set to point to the option, and the return
+ value will be the index of the '*' option within that list.
+
+ If an optlist entry ends with ':' (e.g. "Foo:") then that option
+ may have suboptions appended to it (for example "JPG:80") and
+ fz_optarg will be set to point at "80". Otherwise fz_optarg will
+ be set to NULL.
+
+ In the event of no-match found, prints an error and returns -1.
+
+
+
+ The item number for the most recently matched item list.
+
+ First item in the list is numbered 0. No match is -1.
+
+
+
+fz_optlong is a pointer to the record for the most recently
+read long option. (i.e. if a long option is detected, this
+will be set to point to the record for that option, otherwise
+it will be NULL).
+
+
+
+fz_optarg is a pointer to the argument data for the most recently
+read option.
+
+
+
+fz_optind is updated to point to the current index being read from the
+arguments.
+
+
+
+Identical to fz_getopt_long, but with a NULL longopts field, signifying no long
+options.
+
+
+
+ Simple functions/variables for use in tools.
+
+ ostr = option string. Comprises single letter options, followed by : if there
+ is an argument to the option.
+
+ longopts: NULL (indicating no long options), or a pointer to an array of
+ longoptions, terminated by an entry with option == NULL.
+
+ In the event of matching a single char option, this function will normally
+ return the char. The exception to this is when the option requires an
+ argument and none is supplied; in this case we return ':'.
+
+ In the event of matching a long option, this function returns 0, with fz_optlong
+ set to point to the matching option.
+
+ A long option entry may be followed with : to indicate there is an argument to the
+ option. If the need for an argument is specified in this way, and no argument is
+ given, an error will be displayed and argument processing will stop. If an argument
+ is given, and the long option record contains a non-null flag pointer, then the code
+ will decode the argument and fill in that flag pointer. Specifically,
+ case-insensitive matches to 'yes', 'no', 'true' and 'false' will cause a value of 0
+ or 1 as appropriate to be written; failing this the arg will be interpreted as a
+ decimal integer using atoi.
+
+ A long option entry may be followed by an list of options (e.g. myoption=foo|bar|baz)
+ and the option will be passed to fz_opt_from_list. The return value of that will be
+ placed in fz_optitem. If the return value of that function is -1, then an error will
+ be displayed and argument processing will stop.
+
+ In the event of reaching the end of the arg list or '--', this function returns EOF.
+
+ In the event of failing to match anything, an error is printed, and we return '?'.
+
+ If an argument is expected for the option, then fz_optarg will be returned pointing
+ at the start of the argument. Examples of supported argument formats: '-r500', '-r 500',
+ '--resolution 500', '--resolution=500'.
+
+
+
+ AES block processing. Encrypts or Decrypts (according to mode,
+ which must match what was initially set up) length bytes (which
+ must be a multiple of 16), using (and modifying) the insertion
+ vector iv, reading from input, and writing to output.
+
+ Never throws an exception.
+
+
+
+ AES decryption initialization. Fills in the supplied context
+ and prepares for decryption using the given key.
+
+ Returns non-zero for error (key size other than 128/192/256).
+
+ Never throws an exception.
+
+
+
+ AES encryption initialization. Fills in the supplied context
+ and prepares for encryption using the given key.
+
+ Returns non-zero for error (key size other than 128/192/256).
+
+ Never throws an exception.
+
+
+
+ RC4 finalization. Zero the context.
+
+ Never throws an exception.
+
+
+
+ RC4 block encrypt operation; encrypt src into dst (both of
+ length len) updating the RC4 state as we go.
+
+ Never throws an exception.
+
+
+
+ RC4 initialization. Begins an RC4 operation, writing a new
+ context.
+
+ Never throws an exception.
+
+
+
+ SHA384 finalization. Ends an SHA384 message-digest operation,
+ writing the message digest and zeroizing the context.
+
+ Never throws an exception.
+
+
+
+ SHA384 block update operation. Continues an SHA384 message-
+ digest operation, processing another message block, and updating
+ the context.
+
+ Never throws an exception.
+
+
+
+ SHA384 initialization. Begins an SHA384 operation, initialising
+ the supplied context.
+
+ Never throws an exception.
+
+
+
+ SHA512 finalization. Ends an SHA512 message-digest operation,
+ writing the message digest and zeroizing the context.
+
+ Never throws an exception.
+
+
+
+ SHA512 block update operation. Continues an SHA512 message-
+ digest operation, processing another message block, and updating
+ the context.
+
+ Never throws an exception.
+
+
+
+ SHA512 initialization. Begins an SHA512 operation, initialising
+ the supplied context.
+
+ Never throws an exception.
+
+
+
+ MD5 finalization. Ends an MD5 message-digest operation, writing
+ the message digest and zeroizing the context.
+
+ Never throws an exception.
+
+
+
+ SHA256 block update operation. Continues an SHA256 message-
+ digest operation, processing another message block, and updating
+ the context.
+
+ Never throws an exception.
+
+
+
+ SHA256 initialization. Begins an SHA256 operation, initialising
+ the supplied context.
+
+ Never throws an exception.
+
+
+
+ MD5 finalization. Ends an MD5 message-digest operation, writing
+ the message digest and zeroizing the context.
+
+ Never throws an exception.
+
+
+
+ MD5 block update operation. Continues an MD5 message-digest
+ operation, processing an int64, and updating the context.
+
+ Never throws an exception.
+
+
+
+ MD5 block update operation. Continues an MD5 message-digest
+ operation, processing another message block, and updating the
+ context.
+
+ Never throws an exception.
+
+
+
+ MD5 initialization. Begins an MD5 operation, writing a new
+ context.
+
+ Never throws an exception.
+
+
+
+ Internal function to actually do the opening of the logfile.
+
+ Caller should close/drop the output when finished with it.
+
+
+
+Output a line to the log for a given module.
+
+
+
+ Compression and other filtering outputs.
+
+ These outputs write encoded data to another output. Create a
+ filter output with the destination, write to the filter, then
+ close and drop it when you're done. These can also be chained
+ together, for example to write ASCII Hex encoded, Deflate
+ compressed, and RC4 encrypted data to a buffer output.
+
+ Output streams don't use reference counting, so make sure to
+ close all of the filters in the reverse order of creation so
+ that data is flushed properly.
+
+ Accordingly, ownership of 'chain' is never passed into the
+ following functions, but remains with the caller, whose
+ responsibility it is to ensure they exist at least until
+ the returned fz_output is dropped.
+
+
+
+Save the contents of a buffer to a file.
+
+
+
+ Allocated sprintf.
+
+ Returns a null terminated allocated block containing the
+ formatted version of the format string/args.
+
+
+
+The non va_list equivalent of fz_vsnprintf.
+
+
+
+A vsnprintf work-alike, using our custom formatter.
+
+
+
+Copy the stream contents to the output.
+
+
+
+Sync to byte boundary after writing bits.
+
+
+
+Write num_bits of data to the end of the output stream, assumed to be packed
+most significant bits first.
+
+
+
+Write a base64 encoded fz_buffer, optionally with periodic
+newlines.
+
+
+
+Write a base64 encoded data block, optionally with periodic
+newlines.
+
+
+
+Write a UTF-8 encoded unicode character.
+
+
+
+Write different sized data to an output stream.
+
+
+
+Write a string. Does not write zero terminator.
+
+
+
+ Write data to output.
+
+ data: Pointer to data to write.
+ size: Size of data to write in bytes.
+
+
+
+ Truncate the output at the current position.
+
+ This allows output streams which have seeked back from the end
+ of their storage to be truncated at the current point.
+
+
+
+ Obtain the fz_output in the form of a fz_stream.
+
+ This allows data to be read back from some forms of fz_output
+ object. When finished reading, the fz_stream should be released
+ by calling fz_drop_stream. Until the fz_stream is dropped, no
+ further operations should be performed on the fz_output object.
+
+
+
+Query whether a given fz_output supports fz_stream_from_output.
+
+
+
+Free an output stream. Don't forget to close it first!
+
+
+
+Reset a closed output stream. Returns state to
+(broadly) that which it was in when opened. Not
+all outputs can be reset, so this may throw an
+exception.
+
+
+
+Flush pending output and close an output stream.
+
+
+
+Flush unwritten data.
+
+
+
+ Return the current file position.
+
+ Throw an error on untellable outputs.
+
+
+
+ Seek to the specified file position.
+ See fseek for arguments.
+
+ Throw an error on unseekable outputs.
+
+
+
+va_list version of fz_write_printf.
+
+
+
+Format and write data to an output stream.
+See fz_format_string for formatting details.
+
+
+
+ Retrieve an fz_output for the default debugging stream. On
+ Windows this will be OutputDebugString for non-console apps.
+ Otherwise, it is always fz_stderr.
+
+ Optionally may be fz_dropped when finished with.
+
+
+
+Set the output stream to be used for fz_stddbg. Set to NULL to
+reset to default (stderr).
+
+
+
+ Retrieve an fz_output that directs to OutputDebugString.
+
+ Optionally may be fz_dropped when finished with.
+
+
+
+ Retrieve an fz_output that directs to stdout.
+
+ Optionally may be fz_dropped when finished with.
+
+
+
+ Retrieve an fz_output that directs to stdout.
+
+ Optionally may be fz_dropped when finished with.
+
+
+
+ Open an output stream that appends
+ to a buffer.
+
+ buf: The buffer to append to.
+
+
+
+ Open an output stream that writes to a
+ given FILE *.
+
+ file: The file pointers to write to. NULL is interpreted as effectively
+ meaning /dev/null or similar.
+
+
+
+ Open an output stream that writes to a
+ given path. This stream will always be a binary stream.
+
+ On Windows, if this stream is stdout or stderr, these will
+ be set to binary.
+
+ filename: The filename to write to (specified in UTF-8).
+
+ append: non-zero if we should append to the file, rather than
+ overwriting it.
+
+
+
+ Create a new output object with the given
+ internal state and function pointers.
+
+ state: Internal state (opaque to everything but implementation).
+
+ write: Function to output a given buffer.
+
+ close: Cleanup function to destroy state when output closed.
+ May permissibly be null.
+
+
+
+A function type for use when implementing
+fz_outputs. The supplied function of this type is called
+when fz_truncate_output is called to truncate the file
+at that point.
+
+
+
+A function type for use when implementing
+fz_outputs. The supplied function of this type is called
+when the fz_stream_from_output is called.
+
+
+
+A function type for use when implementing
+fz_outputs. The supplied function of this type is called
+when the output stream is dropped, to release the stream
+specific state information.
+
+
+
+A function type for use when implementing
+fz_outputs. The supplied function of this type is called
+when the output stream is reset, and resets the state
+to that when it was first initialised.
+
+
+
+A function type for use when implementing
+fz_outputs. The supplied function of this type is called
+when the output stream is closed, to flush any pending writes.
+
+
+
+ A function type for use when implementing
+ fz_outputs. The supplied function of this type is called when
+ fz_tell_output is requested.
+
+ state: The output stream state to report on.
+
+ Returns the offset within the output stream.
+
+
+
+ A function type for use when implementing
+ fz_outputs. The supplied function of this type is called when
+ fz_seek_output is requested.
+
+ state: The output stream state to seek within.
+
+ offset, whence: as defined for fz_seek().
+
+
+
+Generic output streams - generalise between outputting to a
+file, a buffer, etc.
+
+ A function type for use when implementing
+ fz_outputs. The supplied function of this type is called
+ whenever data is written to the output.
+
+ state: The state for the output stream.
+
+ data: a pointer to a buffer of data to write.
+
+ n: The number of bytes of data to write.
+
+
+
+Create a stream from a FILE * that will not be closed
+when the stream is dropped.
+
+
+
+ Query if the stream has reached EOF (during bitwise
+ reading).
+
+ See fz_is_eof for the equivalent function for bytewise
+ reading.
+
+
+
+Called after reading bits to tell the stream
+that we are about to return to reading bytewise. Resyncs
+the stream to whole byte boundaries.
+
+
+
+ Read the next n bits from a stream (assumed to
+ be packed least significant bit first).
+
+ stm: The stream to read from.
+
+ n: The number of bits to read, between 1 and 8*sizeof(int)
+ inclusive.
+
+ Returns (unsigned int)-1 for EOF, or the required number of bits.
+
+
+
+ Read the next n bits from a stream (assumed to
+ be packed most significant bit first).
+
+ stm: The stream to read from.
+
+ n: The number of bits to read, between 1 and 8*sizeof(int)
+ inclusive.
+
+ Returns -1 for EOF, or the required number of bits.
+
+
+
+ Query if the stream has reached EOF (during normal bytewise
+ reading).
+
+ See fz_is_eof_bits for the equivalent function for bitwise
+ reading.
+
+
+
+ Unread the single last byte successfully
+ read from a stream. Do not call this without having
+ successfully read a byte.
+
+ stm: The stream to operate upon.
+
+
+
+ Peek at the next byte in a stream.
+
+ stm: The stream to peek at.
+
+ Returns -1 for EOF, or the next byte that will be read.
+
+
+
+ Read the next byte from a stream.
+
+ stm: The stream t read from.
+
+ Returns -1 for end of stream, or the next byte. May
+ throw exceptions.
+
+
+
+ Ask how many bytes are available immediately from
+ a given stream.
+
+ stm: The stream to read from.
+
+ max: A hint for the underlying stream; the maximum number of
+ bytes that we are sure we will want to read. If you do not know
+ this number, give 1.
+
+ Returns the number of bytes immediately available between the
+ read and write pointers. This number is guaranteed only to be 0
+ if we have hit EOF. The number of bytes returned here need have
+ no relation to max (could be larger, could be smaller).
+
+
+
+Skip over a given string in a stream. Return 0 if successfully
+skipped, non-zero otherwise. As many characters will be skipped
+over as matched in the string.
+
+
+
+ Read a line from stream into the buffer until either a
+ terminating newline or EOF, which it replaces with a null byte
+ ('\0').
+
+ Returns buf on success, and NULL when end of file occurs while
+ no characters have been read.
+
+
+
+ Attempt to read a stream into a buffer. If truncated
+ is NULL behaves as fz_read_all, sets a truncated flag in case of
+ error.
+
+ stm: The stream to read from.
+
+ initial: Suggested initial size for the buffer.
+
+ truncated: Flag to store success/failure indication in.
+
+ worst_case: 0 for unknown, otherwise an upper bound for the
+ size of the stream.
+
+ Returns a buffer created from reading from the stream.
+
+
+
+ Create a new stream object with the given
+ internal state and function pointers.
+
+ state: Internal state (opaque to everything but implementation).
+
+ next: Should provide the next set of bytes (up to max) of stream
+ data. Return the number of bytes read, or EOF when there is no
+ more data.
+
+ drop: Should clean up and free the internal state. May not
+ throw exceptions.
+
+
+
+ A function type for use when implementing
+ fz_streams. The supplied function of this type is called when
+ fz_seek is requested, and the arguments are as defined for
+ fz_seek.
+
+ The stream can find it's private state in stm->state.
+
+
+
+ A function type for use when implementing
+ fz_streams. The supplied function of this type is called
+ when the stream is dropped, to release the stream specific
+ state information.
+
+ state: The stream state to release.
+
+
+
+ A function type for use when implementing
+ fz_streams. The supplied function of this type is called
+ whenever data is required, and the current buffer is empty.
+
+ stm: The stream to operate on.
+
+ max: a hint as to the maximum number of bytes that the caller
+ needs to be ready immediately. Can safely be ignored.
+
+ Returns -1 if there is no more data in the stream. Otherwise,
+ the function should find its internal state using stm->state,
+ refill its buffer, update stm->rp and stm->wp to point to the
+ start and end of the new data respectively, and then
+ "return *stm->rp++".
+
+
+
+ Read a utf-16 rune from a stream. (little endian and
+ big endian respectively).
+
+ In the event of encountering badly formatted utf-16 codes
+ (mismatched surrogates) no error/exception is given, but
+ undefined values may be returned.
+
+
+
+ Read a utf-8 rune from a stream.
+
+ In the event of encountering badly formatted utf-8 codes
+ (such as a leading code with an unexpected number of following
+ codes) no error/exception is given, but undefined values may be
+ returned.
+
+
+
+Read a null terminated string from the stream into
+a buffer of a given length. The buffer will be null terminated.
+Throws on failure (including the failure to fit the entire
+string including the terminator into the buffer).
+
+
+
+ fz_read_[u]int(16|24|32|64)(_le)?
+
+ Read a 16/32/64 bit signed/unsigned integer from stream,
+ in big or little-endian byte orders.
+
+ Throws an exception if EOF is encountered.
+
+
+
+ Read all the contents of a file into a buffer.
+
+ Returns NULL if the file does not exist, otherwise
+ behaves exactly as fz_read_file.
+
+
+
+Read all the contents of a file into a buffer.
+
+
+
+ Read all of a stream into a buffer.
+
+ stm: The stream to read from
+
+ initial: Suggested initial size for the buffer.
+
+ Returns a buffer created from reading from the stream. May throw
+ exceptions on failure to allocate.
+
+
+
+ Read from a stream discarding data.
+
+ stm: The stream to read from.
+
+ len: The number of bytes to read.
+
+ Returns the number of bytes read. May throw exceptions.
+
+
+
+ Read from a stream into a given data block.
+
+ stm: The stream to read from.
+
+ data: The data block to read into.
+
+ len: The length of the data block (in bytes).
+
+ Returns the number of bytes read. May throw exceptions.
+
+
+
+ Seek within a stream.
+
+ stm: The stream to seek within.
+
+ offset: The offset to seek to.
+
+ whence: From where the offset is measured (see fseek).
+ SEEK_SET - start of stream.
+ SEEK_CUR - current position.
+ SEEK_END - end of stream.
+
+
+
+
+return the current reading position within a stream
+
+
+
+ Decrements the reference count for a stream.
+
+ When the reference count for the stream hits zero, frees the
+ storage used for the fz_stream itself, and (usually)
+ releases the underlying resources that the stream is based upon
+ (depends on the method used to open the stream initially).
+
+
+
+ Increments the reference count for a stream. Returns the same
+ pointer.
+
+ Never throws exceptions.
+
+
+
+ Attach a filter to a stream that will store any
+ characters read from the stream into the supplied buffer.
+
+ chain: The underlying stream to leech from.
+
+ buf: The buffer into which the read data should be appended.
+ The buffer will be resized as required.
+
+ Returns pointer to newly created stream. May throw exceptions on
+ failure to allocate.
+
+
+
+ Open a buffer as a stream.
+
+ buf: The buffer to open. Ownership of the buffer is NOT passed
+ in (this function takes its own reference).
+
+ Returns pointer to newly created stream. May throw exceptions on
+ failure to allocate.
+
+
+
+ Open a block of memory as a stream.
+
+ data: Pointer to start of data block. Ownership of the data
+ block is NOT passed in.
+
+ len: Number of bytes in data block.
+
+ Returns pointer to newly created stream. May throw exceptions on
+ failure to allocate.
+
+
+
+ Return the filename (UTF-8 encoded) from which a stream was opened.
+
+ Returns NULL if the filename is not available (or the stream was
+ opened from a source other than a file).
+
+
+
+ Open the named file and wrap it in a stream.
+
+ This function is only available when compiling for Win32.
+
+ filename: Wide character path to the file as it would be given
+ to _wfopen().
+
+
+
+ Open the named file and wrap it in a stream.
+
+ Does the same as fz_open_file, but in the event the file
+ does not open, it will return NULL rather than throw an
+ exception.
+
+
+
+Do the same as fz_open_file, but delete the file upon close.
+
+
+
+ Open the named file and wrap it in a stream.
+
+ filename: Path to a file. On non-Windows machines the filename
+ should be exactly as it would be passed to fopen(2). On Windows
+ machines, the path should be UTF-8 encoded so that non-ASCII
+ characters can be represented. Other platforms do the encoding
+ as standard anyway (and in most cases, particularly for MacOS
+ and Linux, the encoding they use is UTF-8 anyway).
+
+
+
+ fz_stream is a buffered reader capable of seeking in both
+ directions.
+
+ Streams are reference counted, so references must be dropped
+ by a call to fz_drop_stream.
+
+ Only the data between rp and wp is valid.
+
+
+
+Return true if the named file exists and is readable.
+
+
+
+Unicode aware tolower and toupper functions.
+
+
+
+Check and parse string into page ranges:
+ /,?(-?\d+|N)(-(-?\d+|N))?/
+
+
+
+Locale-independent decimal to binary conversion. On overflow
+return (-)INFINITY and set errno to ERANGE. On underflow return
+0 and set errno to ERANGE. Special inputs (case insensitive):
+"NAN", "INF" or "INFINITY".
+
+
+
+ Count how many runes the UTF-8 encoded string
+ consists of.
+
+ s: The UTF-8 encoded, NUL-terminated text string.
+
+ Returns the number of runes in the string.
+
+
+
+ Obtain a pointer to the char representing the rune
+ at a given index.
+
+ str: Pointer to beginning of a string.
+
+ idx: Index of a rune to return a char pointer to.
+
+ Returns a pointer to the char where the desired rune starts,
+ or NULL if the string ends before the index is reached.
+
+
+
+ Compute the index of a rune in a string.
+
+ str: Pointer to beginning of a string.
+
+ p: Pointer to a char in str.
+
+ Returns the index of the rune pointed to by p in str.
+
+
+
+ Count how many chars are required to represent a rune.
+
+ rune: The rune to encode.
+
+ Returns the number of bytes required to represent this run in
+ UTF8.
+
+
+
+ UTF8 encode a rune to a sequence of chars.
+
+ str: Pointer to a place to put the UTF8 encoded character.
+
+ rune: Pointer to a 'rune'.
+
+ Returns the number of bytes the rune took to output.
+
+
+
+ UTF8 decode a single rune from a sequence of chars
+ of given length.
+
+ rune: Pointer to an int to assign the decoded 'rune' to.
+ (0xFFFD on error).
+
+ str: Pointer to a UTF8 encoded string.
+
+ n: The number of bytes available at str.
+
+ Returns the number of bytes consumed.
+
+
+
+ UTF8 decode a single rune from a sequence of chars.
+
+ rune: Pointer to an int to assign the decoded 'rune' to.
+ (0xFFFD on error).
+
+ str: Pointer to a UTF8 encoded string.
+
+ Returns the number of bytes consumed.
+
+
+
+ Case insensitive (UTF8) string comparison.
+
+ n = maximum number of bytes to read from either a or b.
+
+
+
+Case insensitive (UTF8) string comparison.
+
+
+
+Resolve a path to an absolute file name.
+The resolved path buffer must be of at least PATH_MAX size.
+
+
+
+ rewrite path to the shortest string that names the same path.
+
+ Eliminates multiple and trailing slashes, interprets "." and
+ "..". Allocates a new string that the caller must free.
+
+
+
+ rewrite path to the shortest string that names the same path.
+
+ Eliminates multiple and trailing slashes, interprets "." and
+ "..". Overwrites the string in place.
+
+
+
+ create output file name using a template.
+
+ If the path contains %[0-9]*d, the first such pattern will be
+ replaced with the page number. If the template does not contain
+ such a pattern, the page number will be inserted before the
+ filename extension. If the template does not have a filename
+ extension, the page number will be added to the end.
+
+
+
+Return a new string representing the provided string encoded as an URI path name.
+This also encodes the special reserved characters except /.
+
+
+
+Return a new string representing the provided string encoded as a URI.
+
+
+
+Return a new string representing the unencoded version of the given URI component.
+This decodes all escape sequences!
+
+
+
+Like fz_decode_uri_component but in-place.
+
+
+
+portable strverscmp(3) function
+
+
+
+Find the filename component in a path.
+
+
+
+extract the directory component from a path.
+
+
+
+Find the start of the first occurrence of the substring needle in haystack.
+
+
+
+ Safe case-insensitive strstr function. (Accepts UTF-8).
+
+ haystack: Where to look (may be NULL).
+
+ needled: What to look for.
+
+ Returns NULL if unmatched, or pointer to start of match.
+
+
+
+ Safe strstr function.
+
+ haystack: Where to look (may be NULL).
+
+ needled: What to look for.
+
+ Returns NULL if unmatched, or pointer to start of match.
+
+
+
+ Concatenate 2 strings, with a maximum length.
+
+ dst: pointer to first string in a buffer of n bytes.
+
+ src: pointer to string to concatenate.
+
+ n: Size (in bytes) of buffer that dst is in.
+
+ Returns the real length that a concatenated dst + src would have
+ been (not including terminator).
+
+
+
+ Copy at most n-1 chars of a string into a destination
+ buffer with null termination, returning the real length of the
+ initial string (excluding terminator).
+
+ dst: Destination buffer, at least n bytes long.
+
+ src: C string (non-NULL).
+
+ n: Size of dst buffer in bytes.
+
+ Returns the length (excluding terminator) of src.
+
+
+
+ Given a pointer to a C string (or a pointer to NULL) break
+ it at the first occurrence of a delimiter char (from a given
+ set).
+
+ stringp: Pointer to a C string pointer (or NULL). Updated on
+ exit to point to the first char of the string after the
+ delimiter that was found. The string pointed to by stringp will
+ be corrupted by this call (as the found delimiter will be
+ overwritten by 0).
+
+ delim: A C string of acceptable delimiter characters.
+
+ Returns a pointer to a C string containing the chars of stringp
+ up to the first delimiter char (or the end of the string), or
+ NULL.
+
+
+
+Safe string functions
+
+Return strlen(s), if that is less than maxlen, or maxlen if
+there is no null byte ('\0') among the first maxlen bytes.
+
+
+
+ Take ownership of buffer contents.
+
+ Performs the same task as fz_buffer_storage, but ownership of
+ the data buffer returns with this call. The buffer is left
+ empty.
+
+ Note: Bad things may happen if this is called on a buffer with
+ multiple references that is being used from multiple threads.
+
+ data: Pointer to place to retrieve data pointer.
+
+ Returns length of stream.
+
+
+
+ Create an MD5 digest from buffer contents.
+
+ Never throws exceptions.
+
+
+
+ Zero-terminate buffer in order to use as a C string.
+
+ This byte is invisible and does not affect the length of the
+ buffer as returned by fz_buffer_storage. The zero byte is
+ written *after* the data, and subsequent writes will overwrite
+ the terminating byte.
+
+ Subsequent changes to the size of the buffer (such as by
+ fz_buffer_trim, fz_buffer_grow, fz_resize_buffer, etc) may
+ invalidate this.
+
+
+
+fz_append_vprintf: Format and append data to buffer using
+printf-like formatting with varargs (see fz_vsnprintf).
+
+
+
+ fz_append_printf: Format and append data to buffer using
+ printf-like formatting (see fz_vsnprintf).
+
+ The buffer will automatically grow as required.
+
+
+
+ fz_append_pdf_string: Append a string with PDF syntax quotes and
+ escapes.
+
+ The buffer will automatically grow as required.
+
+
+
+ fz_append_*: Append data to a buffer.
+
+ The buffer will automatically grow as required.
+
+
+
+Append a base64 encoded fz_buffer, optionally with periodic newlines.
+
+
+
+Write a base64 encoded data block, optionally with periodic newlines.
+
+
+
+ Append the contents of the source buffer onto the end of the
+ destination buffer, extending automatically as required.
+
+ Ownership of buffers does not change.
+
+
+
+ Empties the buffer. Storage is not freed, but is held ready
+ to be reused as the buffer is refilled.
+
+ Never throws exceptions.
+
+
+
+Trim wasted capacity from a buffer by resizing internal memory.
+
+
+
+Make some space within a buffer (i.e. ensure that
+capacity > size).
+
+
+
+ Ensure that a buffer has a given capacity,
+ truncating data if required.
+
+ capacity: The desired capacity for the buffer. If the current
+ size of the buffer contents is smaller than capacity, it is
+ truncated.
+
+
+
+Create a new buffer with data decoded from a base64 input string.
+
+
+
+Make a new buffer, containing a copy of the data used in
+the original.
+
+
+
+Create a new buffer with printf formatted data.
+
+
+
+Create a new buffer containing a copy of the passed data.
+
+
+
+Like fz_new_buffer, but does not take ownership.
+
+
+
+ Create a new buffer with existing data.
+
+ data: Pointer to existing data.
+ size: Size of existing data.
+
+ Takes ownership of data. Does not make a copy. Calls fz_free on
+ the data when the buffer is deallocated. Do not use 'data' after
+ passing to this function.
+
+ Returns pointer to new buffer. Throws exception on allocation
+ failure.
+
+
+
+Ensure that a buffer's data ends in a
+0 byte, and return a pointer to it.
+
+
+
+ Retrieve internal memory of buffer.
+
+ datap: Output parameter that will be pointed to the data.
+
+ Returns the current size of the data in bytes.
+
+
+
+ Drop a reference to the buffer. When the reference count reaches
+ zero, the buffer is destroyed.
+
+ Never throws exceptions.
+
+
+
+ Take an additional reference to the buffer. The same pointer
+ is returned.
+
+ Never throws exceptions.
+
+
+
+Unlock one of the user supplied mutexes.
+
+
+
+Lock one of the user supplied mutexes.
+
+
+
+Fill block with len bytes of pseudo-randomness.
+
+
+
+Portable strdup implementation, using fz allocators.
+
+
+
+fz_free equivalent, for blocks allocated via fz_malloc_aligned.
+
+
+
+fz_malloc equivalent, except that the block is guaranteed aligned.
+Block must be freed later using fz_free_aligned.
+
+
+
+fz_realloc equivalent that returns NULL rather than throwing
+exceptions.
+
+
+
+fz_calloc equivalent that returns NULL rather than throwing
+exceptions.
+
+
+
+Flexible array member allocation helpers.
+
+fz_malloc equivalent that returns NULL rather than throwing
+exceptions.
+
+
+
+ Free a previously allocated block of memory.
+
+ fz_free(ctx, NULL) does nothing.
+
+ Never throws exceptions.
+
+
+
+ Reallocates a block of memory to given size. Existing contents
+ up to min(old_size,new_size) are maintained. The rest of the
+ block is uninitialised.
+
+ fz_realloc(ctx, NULL, size) behaves like fz_malloc(ctx, size).
+
+ fz_realloc(ctx, p, 0); behaves like fz_free(ctx, p).
+
+ Throws exception in the event of failure to allocate.
+
+
+
+ Allocate array of memory of count entries of size bytes.
+ Clears the memory to zero.
+
+ Throws exception in the event of failure to allocate.
+
+
+
+ Memory Allocation and Scavenging:
+
+ All calls to MuPDF's allocator functions pass through to the
+ underlying allocators passed in when the initial context is
+ created, after locks are taken (using the supplied locking
+ function) to ensure that only one thread at a time calls
+ through.
+
+ If the underlying allocator fails, MuPDF attempts to make room
+ for the allocation by evicting elements from the store, then
+ retrying.
+
+ Any call to allocate may then result in several calls to the
+ underlying allocator, and result in elements that are only
+ referred to by the store being freed.
+
+ Allocate memory for a structure, clear it, and tag the pointer
+ for Memento.
+
+ Throws exception in the event of failure to allocate.
+
+ Allocate memory for an array of structures, clear it, and tag
+ the pointer for Memento.
+
+ Throws exception in the event of failure to allocate.
+
+ Allocate uninitialized memory for an array of structures, and
+ tag the pointer for Memento. Does NOT clear the memory!
+
+ Throws exception in the event of failure to allocate.
+
+ Allocate uninitialized memory of a given size.
+ Does NOT clear the memory!
+
+ May return NULL for size = 0.
+
+ Throws exception in the event of failure to allocate.
+
+
+
+Disable icc profile based operation.
+
+
+
+Enable icc profile based operation.
+
+
+
+Toggle whether to respect document styles in HTML and EPUB.
+
+
+
+Return whether to respect document styles in HTML and EPUB.
+
+
+
+Set the user stylesheet by loading the source from a file.
+If the file is missing, do nothing.
+
+
+
+Set the user stylesheet source text for use with HTML and EPUB.
+
+
+
+Get the user stylesheet source text.
+
+
+
+ Set the minimum line width to be
+ used for stroked lines.
+
+ min_line_width: The minimum line width to use (in pixels).
+
+
+
+ Get the minimum line width to be
+ used for stroked lines.
+
+ min_line_width: The minimum line width to use (in pixels).
+
+
+
+ Set the number of bits of antialiasing we
+ should use for graphics.
+
+ bits: The number of bits of antialiasing to use (values are
+ clamped to within the 0 to 8 range).
+
+
+
+Get the number of bits of antialiasing we are
+using for graphics. Between 0 and 8.
+
+
+
+ Set the number of bits of antialiasing we
+ should use for text.
+
+ bits: The number of bits of antialiasing to use (values are
+ clamped to within the 0 to 8 range).
+
+
+
+Get the number of bits of antialiasing we are
+using for text. Between 0 and 8.
+
+
+
+ Set the number of bits of antialiasing we should
+ use (for both text and graphics).
+
+ bits: The number of bits of antialiasing to use (values are
+ clamped to within the 0 to 8 range).
+
+
+
+Get the number of bits of antialiasing we are
+using (for graphics). Between 0 and 8.
+
+
+
+ Set the tuning function to use for
+ image scaling.
+
+ image_scale: Function to use.
+
+ arg: Opaque argument to be passed to tuning function.
+
+
+
+ Set the tuning function to use for
+ image decode.
+
+ image_decode: Function to use.
+
+ arg: Opaque argument to be passed to tuning function.
+
+
+
+ Given the source width and height of
+ image, together with the actual required width and height,
+ decide whether we should use mitchell scaling.
+
+ arg: The caller supplied opaque argument.
+
+ dst_w, dst_h: The actual width/height required on the target
+ device.
+
+ src_w, src_h: The source width/height of the image.
+
+ Return 0 not to use the Mitchell scaler, 1 to use the Mitchell
+ scaler. All other values reserved.
+
+
+
+In order to tune MuPDF's behaviour, certain functions can
+(optionally) be provided by callers.
+
+ Given the width and height of an image,
+ the subsample factor, and the subarea of the image actually
+ required, the caller can decide whether to decode the whole
+ image or just a subarea.
+
+ arg: The caller supplied opaque argument.
+
+ w, h: The width/height of the complete image.
+
+ l2factor: The log2 factor for subsampling (i.e. image will be
+ decoded to (w>>l2factor, h>>l2factor)).
+
+ subarea: The actual subarea required for the current operation.
+ The tuning function is allowed to increase this in size if
+ required.
+
+
+
+Retrieve the currently set warning callback, or NULL if none
+has been set. Optionally, if user is non-NULL, the user pointer
+given when the warning callback was set is also passed back to
+the caller.
+
+
+
+ Set the warning callback. This will be called as part of the
+ exception handling.
+
+ The callback must not throw exceptions!
+
+
+
+Retrieve the currently set error callback, or NULL if none
+has been set. Optionally, if user is non-NULL, the user pointer
+given when the warning callback was set is also passed back to
+the caller.
+
+
+
+ Set the error callback. This will be called as part of the
+ exception handling.
+
+ The callback must not throw exceptions!
+
+
+
+A callback called whenever a warning message is generated.
+The user pointer passed to fz_set_warning_callback() is
+passed along with the warning message.
+
+
+
+A callback called whenever an error message is generated.
+The user pointer passed to fz_set_error_callback() is passed
+along with the error message.
+
+
+
+The default warning callback. Declared publicly just so that
+the warning callback can be set back to this after it has been
+overridden.
+
+
+
+ FIXME: Better not to expose fz_default_error_callback, and
+ fz_default_warning callback and to allow 'NULL' to be used
+ int fz_set_xxxx_callback to mean "defaults".
+
+ FIXME: Do we need/want functions like
+ fz_error_callback(ctx, message) to allow callers to inject
+ stuff into the error/warning streams?
+
+The default error callback. Declared publicly just so that the
+error callback can be set back to this after it has been
+overridden.
+
+
+
+Read the user field from the context.
+
+
+
+ Set the user field in the context.
+
+ NULL initially, this field can be set to any opaque value
+ required by the user. It is copied on clones.
+
+
+
+ Free a context and its global state.
+
+ The context and all of its global state is freed, and any
+ buffered warnings are flushed (see fz_flush_warnings). If NULL
+ is passed in nothing will happen.
+
+ Must not be called for a context that is being used in an active
+ fz_try(), fz_always() or fz_catch() block.
+
+
+
+ Allocate context containing global state.
+
+ The global state contains an exception stack, resource store,
+ etc. Most functions in MuPDF take a context argument to be
+ able to reference the global state. See fz_drop_context for
+ freeing an allocated context.
+
+ alloc: Supply a custom memory allocator through a set of
+ function pointers. Set to NULL for the standard library
+ allocator. The context will keep the allocator pointer, so the
+ data it points to must not be modified or freed during the
+ lifetime of the context.
+
+ locks: Supply a set of locks and functions to lock/unlock
+ them, intended for multi-threaded applications. Set to NULL
+ when using MuPDF in a single-threaded applications. The
+ context will keep the locks pointer, so the data it points to
+ must not be modified or freed during the lifetime of the
+ context.
+
+ max_store: Maximum size in bytes of the resource store, before
+ it will start evicting cached resources such as fonts and
+ images. FZ_STORE_UNLIMITED can be used if a hard limit is not
+ desired. Use FZ_STORE_DEFAULT to get a reasonable size.
+
+ May return NULL.
+
+ Make a clone of an existing context.
+
+ This function is meant to be used in multi-threaded
+ applications where each thread requires its own context, yet
+ parts of the global state, for example caching, are shared.
+
+ ctx: Context obtained from fz_new_context to make a copy of.
+ ctx must have had locks and lock/functions setup when created.
+ The two contexts will share the memory allocator, resource
+ store, locks and lock/unlock functions. They will each have
+ their own exception stacks though.
+
+ May return NULL.
+
+
+
+ Flush any repeated warnings.
+
+ Repeated warnings are buffered, counted and eventually printed
+ along with the number of repetitions. Call fz_flush_warnings
+ to force printing of the latest buffered warning and the
+ number of repetitions, for example to make sure that all
+ warnings are printed before exiting an application.
+
+
+
+Now, a debugging feature. If FZ_VERBOSE_EXCEPTIONS is 1 then
+some of the above functions are replaced by versions that print
+FILE and LINE information.
+
+
+
+Log a (preformatted) string to the registered
+error stream (stderr by default).
+
+
+
+Format an error message, and log it to the registered
+error stream (stderr by default).
+
+
+
+ Within an fz_catch() block, rethrow the current exception
+ if the errcode of the current exception matches.
+
+ This assumes no intervening use of fz_try/fz_catch.
+
+
+
+ Within an fz_catch() block, retrieve the error code for
+ the current exception.
+
+ This assumes no intervening use of fz_try/fz_catch.
+
+
+
+ Within an fz_catch() block, retrieve the formatted message
+ string for the current exception.
+
+ This assumes no intervening use of fz_try/fz_catch.
+
+
+
+ Log a warning.
+
+ This goes to the registered warning stream (stderr by
+ default).
+
+
+
+Called within a catch block this modifies the current
+exception's code. If it's of type 'fromcode' it is
+modified to 'tocode'. Typically used for 'downgrading'
+exception severity.
+
+
+
+Exception macro definitions. Just treat these as a black box -
+pay no attention to the man behind the curtain.
+
+ These macros provide a simple exception handling system. Use them as
+ follows:
+
+ fz_try(ctx)
+ ...
+ fz_catch(ctx)
+ ...
+
+ or as:
+
+ fz_try(ctx)
+ ...
+ fz_always(ctx)
+ ...
+ fz_catch(ctx)
+ ...
+
+ Code within the fz_try() section can then throw exceptions using fz_throw()
+ (or fz_vthrow()).
+
+ They are implemented with setjmp/longjmp, which can have unfortunate
+ consequences for 'losing' local variable values on a throw. To avoid this
+ we recommend calling 'fz_var(variable)' before the fz_try() for any
+ local variable whose value may change within the fz_try() block and whose
+ value will be required afterwards.
+
+ Do not call anything in the fz_always() section that can throw.
+
+ Any exception can be rethrown from the fz_catch() section using fz_rethrow()
+ as long as there has been no intervening use of fz_try/fz_catch.
+
+ Throw an exception.
+
+ This assumes an enclosing fz_try() block within the callstack.
+
+
+
+ Intersection test for quads.
+
+ This may break down if quads are not 'well formed'.
+
+
+
+ Inclusion test for quad in quad.
+
+ This may break down if quads are not 'well formed'.
+
+
+
+ Inclusion test for irects.
+
+ rects are assumed to be both open or both closed.
+
+ No invalid rect can include any other rect.
+ No invalid rect can be included by any rect.
+ Empty (point) rects can include themselves.
+ Empty (line) rects can include many (subline) rects.
+
+
+
+ Inclusion test for rects.
+
+ rects are assumed to be both open or both closed.
+
+ No invalid rect can include any other rect.
+ No invalid rect can be included by any rect.
+ Empty (point) rects can include themselves.
+ Empty (line) rects can include many (subline) rects.
+
+
+
+Inclusion test for irects. (Rect is assumed to be open, i.e.
+top right corner is not included).
+
+
+
+Inclusion test for rects. (Rect is assumed to be open, i.e.
+top right corner is not included).
+
+
+
+Inclusion test for quads.
+
+
+
+Transform a quad by a matrix.
+
+
+
+Convert a quad to the smallest rect that covers it.
+
+
+
+Convert a rect to a quad (losslessly).
+
+
+
+Is a quad infinite?
+
+
+
+Is a quad empty?
+
+
+
+Is a quad valid?
+
+
+
+Inline convenience construction function.
+
+
+
+Find the largest expansion performed by this matrix.
+(i.e. max(abs(m.a),abs(m.b),abs(m.c),abs(m.d))
+
+
+
+ Grid fit a matrix.
+
+ as_tiled = 0 => adjust the matrix so that the image of the unit
+ square completely covers any pixel that was touched by the
+ image of the unit square under the original matrix.
+
+ as_tiled = 1 => adjust the matrix so that the corners of the
+ image of the unit square align with the closest integer corner
+ of the image of the unit square under the original matrix.
+
+
+
+Normalize a vector to length one.
+
+
+
+ Apply a transform to a rectangle.
+
+ After the four corner points of the axis-aligned rectangle
+ have been transformed it may not longer be axis-aligned. So a
+ new axis-aligned rectangle is created covering at least the
+ area of the transformed rectangle.
+
+ transform: Transformation matrix to apply. See fz_concat,
+ fz_scale and fz_rotate for how to create a matrix.
+
+ rect: Rectangle to be transformed. The two special cases
+ fz_empty_rect and fz_infinite_rect, may be used but are
+ returned unchanged as expected.
+
+
+
+ Apply a transformation to a vector.
+
+ transform: Transformation matrix to apply. See fz_concat,
+ fz_scale and fz_rotate for how to create a matrix. Any
+ translation will be ignored.
+
+ vector: Pointer to vector to update.
+
+
+
+ Apply a transformation to a point.
+
+ transform: Transformation matrix to apply. See fz_concat,
+ fz_scale, fz_rotate and fz_translate for how to create a
+ matrix.
+
+ point: Pointer to point to update.
+
+ Returns transform (unchanged).
+
+
+
+ Test rectangle overlap.
+
+ Returns true if the area of the overlap is
+ non zero.
+
+
+
+ Test rectangle inclusion.
+
+ Return true if a entirely contains b.
+
+
+
+ Translate bounding box.
+
+ Translate a bbox by a given x and y offset. Allows for overflow.
+
+
+
+Expand a bbox to include a given point.
+To create a rectangle that encompasses a sequence of points, the
+rectangle must first be set to be the empty rectangle at one of
+the points before including the others.
+
+
+
+Expand a bbox by a given amount in all directions.
+
+
+
+ Convert a bbox into a rect.
+
+ For our purposes, a rect can represent all the values we meet in
+ a bbox, so nothing can go wrong.
+
+ rect: A place to store the generated rectangle.
+
+ bbox: The bbox to convert.
+
+ Returns rect (updated).
+
+
+
+ Round rectangle coordinates.
+
+ Coordinates in a bounding box are integers, so rounding of the
+ rects coordinates takes place. The top left corner is rounded
+ upwards and left while the bottom right corner is rounded
+ downwards and to the right.
+
+ This differs from fz_irect_from_rect, in that fz_irect_from_rect
+ slavishly follows the numbers (i.e any slight over/under
+ calculations can cause whole extra pixels to be added).
+ fz_round_rect allows for a small amount of rounding error when
+ calculating the bbox.
+
+
+
+ Convert a rect into the minimal bounding box
+ that covers the rectangle.
+
+ Coordinates in a bounding box are integers, so rounding of the
+ rects coordinates takes place. The top left corner is rounded
+ upwards and left while the bottom right corner is rounded
+ downwards and to the right.
+
+
+
+ Compute union of two rectangles.
+
+ Given two rectangles, update the first to be the smallest
+ axis-aligned rectangle that encompasses both given rectangles.
+ If either rectangle is infinite then the union is also infinite.
+ If either rectangle is empty then the union is simply the
+ non-empty rectangle. Should both rectangles be empty, then the
+ union is also empty.
+
+
+
+ Compute intersection of two bounding boxes.
+
+ Similar to fz_intersect_rect but operates on two bounding
+ boxes instead of two rectangles.
+
+
+
+ Compute intersection of two rectangles.
+
+ Given two rectangles, update the first to be the smallest
+ axis-aligned rectangle that covers the area covered by both
+ given rectangles. If either rectangle is empty then the
+ intersection is also empty. If either rectangle is infinite
+ then the intersection is simply the non-infinite rectangle.
+ Should both rectangles be infinite, then the intersection is
+ also infinite.
+
+
+
+Calculate average scaling factor of matrix.
+
+
+
+ Check if a transformation is rectilinear.
+
+ Rectilinear means that no shearing is present and that any
+ rotations present are a multiple of 90 degrees. Usually this
+ is used to make sure that axis-aligned rectangles before the
+ transformation are still axis-aligned rectangles afterwards.
+
+
+
+ Attempt to create an inverse matrix.
+
+ inv: Place to store inverse matrix.
+
+ src: Matrix to invert. A degenerate matrix, where the
+ determinant is equal to zero, can not be inverted.
+
+ Returns 1 if matrix is degenerate (singular), or 0 otherwise.
+
+
+
+ Create an inverse matrix.
+
+ matrix: Matrix to invert. A degenerate matrix, where the
+ determinant is equal to zero, can not be inverted and the
+ original matrix is returned instead.
+
+ Returns inverse.
+
+
+
+Create transform matrix to draw page
+at a given resolution and rotation. Adjusts the scaling
+factors so that the page covers whole number of
+pixels and adjust the page origin to be at 0,0.
+
+
+
+ Translate a matrix by premultiplication.
+
+ m: The matrix to translate
+
+ tx, ty: Translation distances along the X- and Y-axes. A
+ translation of 0 will not cause any translation along the
+ relevant axis.
+
+ Returns m.
+
+
+
+ Create a translation matrix.
+
+ The returned matrix is of the form [ 1 0 0 1 tx ty ].
+
+ m: A place to store the created matrix.
+
+ tx, ty: Translation distances along the X- and Y-axes. A
+ translation of 0 will not cause any translation along the
+ relevant axis.
+
+ Returns m.
+
+
+
+ Rotate a transformation by premultiplying.
+
+ The premultiplied matrix is of the form
+ [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].
+
+ m: Pointer to matrix to premultiply.
+
+ degrees: Degrees of counter clockwise rotation. Values less
+ than zero and greater than 360 are handled as expected.
+
+ Returns m (updated).
+
+
+
+ Create a rotation matrix.
+
+ The returned matrix is of the form
+ [ cos(deg) sin(deg) -sin(deg) cos(deg) 0 0 ].
+
+ m: Pointer to place to store matrix
+
+ degrees: Degrees of counter clockwise rotation. Values less
+ than zero and greater than 360 are handled as expected.
+
+ Returns m.
+
+
+
+ Premultiply a matrix with a shearing matrix.
+
+ The shearing matrix is of the form [ 1 sy sx 1 0 0 ].
+
+ m: pointer to matrix to premultiply
+
+ sx, sy: Shearing factors. A shearing factor of 0.0 will not
+ cause any shearing along the relevant axis.
+
+ Returns m (updated).
+
+
+
+ Create a shearing matrix.
+
+ The returned matrix is of the form [ 1 sy sx 1 0 0 ].
+
+ m: pointer to place to store returned matrix
+
+ sx, sy: Shearing factors. A shearing factor of 0.0 will not
+ cause any shearing along the relevant axis.
+
+ Returns m.
+
+
+
+ Scale a matrix by postmultiplication.
+
+ m: Pointer to the matrix to scale
+
+ sx, sy: Scaling factors along the X- and Y-axes. A scaling
+ factor of 1.0 will not cause any scaling along the relevant
+ axis.
+
+ Returns m (updated).
+
+
+
+ Scale a matrix by premultiplication.
+
+ m: Pointer to the matrix to scale
+
+ sx, sy: Scaling factors along the X- and Y-axes. A scaling
+ factor of 1.0 will not cause any scaling along the relevant
+ axis.
+
+ Returns m (updated).
+
+
+
+ Create a scaling matrix.
+
+ The returned matrix is of the form [ sx 0 0 sy 0 0 ].
+
+ m: Pointer to the matrix to populate
+
+ sx, sy: Scaling factors along the X- and Y-axes. A scaling
+ factor of 1.0 will not cause any scaling along the relevant
+ axis.
+
+ Returns m.
+
+
+
+ Multiply two matrices.
+
+ The order of the two matrices are important since matrix
+ multiplication is not commutative.
+
+ Returns result.
+
+
+
+Identity transform matrix.
+
+
+
+Return the height of an irect. Invalid irects return 0.
+
+
+
+Return the width of an irect. Invalid irects return 0.
+
+
+
+Check if an integer rectangle is valid.
+
+
+
+Check if rectangle is valid.
+
+
+
+Check if an integer rectangle
+is infinite.
+
+
+
+Check if rectangle is infinite.
+
+
+
+ Check if rectangle is empty.
+
+ An empty rectangle is defined as one whose area is zero.
+ All invalid rectangles are empty.
+
+
+
+An invalid rectangle.
+
+
+
+An infinite rectangle.
+
+
+
+An empty rectangle with an area equal to zero.
+
+
+
+ A rectangle with sides of length one.
+
+ The bottom left corner is at (0, 0) and the top right corner
+ is at (1, 1).
+
+
+
+Some standard math functions, done as static inlines for speed.
+People with compilers that do not adequately implement inline
+may like to reimplement these using macros.
+
+
+
+ size_t atoi that copes with NULL.
+
+ NOTE: limited to 63bits. Negative numbers
+ are returned as 0.
+
+
+
+64bit atoi that copes with NULL
+
+
+
+atoi that copes with NULL
+
+
+
+Expand a value A from the 0...255 range to the 0..256 range
+
+Combine values A (in any range) and B (in the 0..256 range),
+to give a single value in the same range as A was.
+
+Combine values A and C (in the same (any) range) and B and D (in
+the 0..256 range), to give a single value in the same range as A
+and C were.
+
+Blend SRC and DST (in the same range) together according to
+AMOUNT (in the 0...256 range).
+
+Range checking atof
+
+
+
+Undo alpha premultiplication.
+
+
+
+Multiply scaled two integers in the 0..255 range
+
+
+
+Spot architectures where we have optimisations.
+
+Some differences in libc can be smoothed over
+
+Where possible (i.e. on platforms on which they are provided),
+use sigsetjmp/siglongjmp in preference to setjmp/longjmp. We
+don't alter signal handlers within mupdf, so there is no need
+for us to store/restore them - hence we use the non-restoring
+variants. This makes a large speed difference on MacOSX (and
+probably other platforms too.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/App/Processor/Mupdf/MuPDFExtensions.cs b/App/Processor/Mupdf/MuPDFExtensions.cs
index 25b27bc..97c36ce 100644
--- a/App/Processor/Mupdf/MuPDFExtensions.cs
+++ b/App/Processor/Mupdf/MuPDFExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Text;
@@ -10,6 +11,9 @@ namespace MuPDF.Extensions;
public static class MuPDFExtensions
{
#region 文档基础结构
+ public static bool IsContainer(this PdfObject obj) {
+ return obj.TypeKind.CeqAny(Kind.Dictionary, Kind.Array, Kind.Stream);
+ }
public static TObj Get(this PdfArray array, int index) where TObj : PdfObject {
return array[index].UnderlyingObject as TObj;
}
@@ -19,9 +23,53 @@ public static class MuPDFExtensions
public static TObj Get(this PdfDictionary dict, PdfNames key) where TObj : PdfObject {
return dict[key].UnderlyingObject as TObj;
}
+ public static bool TryGet(this PdfDictionary dict, PdfNames key, out TObj value) where TObj : PdfObject {
+ return (value = dict[key].UnderlyingObject as TObj) is not null;
+ }
+ public static bool HasNameValue(this PdfDictionary dict, PdfNames key, PdfNames valueToCompare) {
+ return (dict[key].UnderlyingObject as PdfName)?.Equals(valueToCompare) == true;
+ }
public static TObj Get(this PdfDictionary dict, PdfNames key, PdfNames alias) where TObj : PdfObject {
return dict.GetValue(key, alias).UnderlyingObject as TObj;
}
+
+ public static string GetName(this Kind kind) {
+ return kind switch {
+ Kind.Array => "array",
+ Kind.Boolean => "bool",
+ Kind.Dictionary => "dictionary",
+ Kind.Reference => "reference",
+ Kind.Name => "name",
+ Kind.Null => "null",
+ Kind.Integer or Kind.Float => "number",
+ Kind.Stream => "stream",
+ Kind.String => "string",
+ _ => String.Empty,
+ };
+ }
+
+ internal static string GetArrayString(this IEnumerable array) {
+ var sb = StringBuilderCache.Acquire();
+ int k = 0;
+ foreach (var item in array) {
+ if (++k > 1) {
+ sb.Append(' ');
+ }
+ if (item.TypeKind == Kind.Array) {
+ sb.Append('[');
+ sb.Append(GetArrayString(item as PdfArray));
+ sb.Append(']');
+ }
+ else if (item.TypeKind.CeqAny(Kind.Dictionary, Kind.Stream)) {
+ sb.Append("<<...>>");
+ }
+ else {
+ sb.Append(item);
+ }
+ }
+ return StringBuilderCache.GetStringAndRelease(sb);
+ }
+
#endregion
#region 几何尺寸