summaryrefslogtreecommitdiff
path: root/src/cairo-pdf-surface-private.h
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-181-24/+175
| | | | Fixes #508
* PDF Type 3 color fontsAdrian Johnson2023-01-291-0/+10
| | | | | | | | | This implements Type 3 color fonts for PDF for any font with a CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE. This includes user-fonts, SVG fonts, and COLR fonts. Glyphs with foreground colors are not yet implemented as Type 3 glyphs and will be rendered as images by cairo-surface.
* Fix shared use of recording surface with paginated targetsAdrian Johnson2023-01-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is _cairo_recording_surface_replay_and_create_regions() stores the cairo_recording_region_type_t in the same structure as the recording commands. This does not work well when the recording surface is used as source by multiple surfaces Fix this by moving the cairo_recording_region_type_t into a separate struct cairo_recording_regions_array_t. This struct is stored in a list that allows multiple create regions results to be store in the surface. The new function _cairo_recording_surface_region_array_attach() is used to create a new cairo_recording_regions_array_t, attach it to the recording surface and return a unique region id. The _cairo_recording_surface_replay_and_create_regions() and _cairo_recording_surface_replay_region() functions use this region id to identify the cairo_recording_regions_array_t. To handle nested recording surfaces, when replaying a recording, the region id is passed to the target as an extra parameter in the surface pattern. The wrapper surface makes a temporary copy of the pattern to ensure the snapshot pattern in the recording surface is not modified. cairo_recording_regions_array_t has a reference count so the target can hold on to the cairo_recording_regions_array_t after the paginated surface has called _cairo_recording_surface_region_array_remove().
* Merge branch 'custom-metadata' into 'master'Adrian Johnson2021-09-161-0/+11
|\ | | | | | | | | Add cairo_pdf_surface_set_custom_metadata() See merge request cairo/cairo!240
| * Add cairo_pdf_surface_set_custom_metadata()Adrian Johnson2021-08-221-0/+11
| |
* | Allow > 2GB PDF files on platforms with 32-bit longAdrian Johnson2021-09-021-1/+1
|/
* pdf links: fix forward references to dest names with 'internal' flagAdrian Johnson2021-07-291-0/+1
|
* pdf: add support for object streams for PDF >= 1.5Adrian Johnson2021-07-261-0/+15
| | | | | | | | This allows all objects that were previously emitted uncompressed to be compressed into a an object stream. Currently only /Page, /Pages, and /Catalog have been converted to use object streams.
* pdf: use cross-reference stream for PDF >= 1.5Adrian Johnson2021-07-261-1/+1
| | | | This reduces the output size and is required for object streams.
* tags: allow links to page numbers not yet createdAdrian Johnson2021-07-241-0/+8
| | | | | | | | | | | | | Previously, forward references were required to use named destinations. This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr> that converted all links to indirect objects written at the end of the document. I have reworked the patch so that only forward references to future page numbers are written as indirect objects. Backward references and named destinations remain as they are. This is to minimize the number of objects written to the PDF file. Fixes #336
* pdf: Properly pass on stdio write errorsUli Schlachter2021-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | cairo-pdf was silently ignoring write errors in _cairo_pdf_surface_finish(). Any write errors that happened here ended up setting a "status" variable, but the value in this variable was then unused. This commit fixes this bug by passing this error on to the caller. Additionally, this also adds a test case for this behaviour based on writing to /dev/full. This file is non-standard and thus the test first checks that this file exists and is writable before trying to write to it. This bug was found based on a report from Knut Petersen [0]. [0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html Signed-off-by: Uli Schlachter <psychon@znc.in>
* Cairo trivial typosUnknown2018-04-021-1/+1
| | | | | | | | | | | | | Found using `codespell -q 3 -I cairo-whitelist.txt` whereby whitelist contained: ``` amin iff lod writen ``` Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* pdf: fix some annotation bugsAdrian Johnson2017-11-261-6/+8
| | | | | | | | | - each annotation was emitted on every page instead of just the page that contains the annotation - the document structure did not correctly link to annotation objects - fix some annotation related memory leaks
* pdf: fix mime-unique-id unbounded recording testAdrian Johnson2017-11-091-2/+5
| | | | | | PDF XObjects need to specify the bounding box. Emit unbounded surfaces when finishing as at this point the extents of all uses of the unbounded surface are known.
* pdf: set ca/CA instead of using an smask when the mask has constant alphaAdrian Johnson2017-10-241-0/+1
|
* Add CCITT_FAX mime type for PDF and PS surfacesAdrian Johnson2017-10-221-1/+1
| | | | | | | | | | | This completes the full set of PDF/PS image filters allowing image data to be passed though without decompressing then recompresssing in a less efficient format. The difficulty with CCITT_FAX is it needs some decoding parameters that are not stored inside the image data. This is achieved by using an additional mime type CCITT_FAX_PARAMS that contains the params in key=value format.
* pdf: use explicit dest instead of named dest when 'internal' attribute is setAdrian Johnson2017-08-291-1/+0
|
* pdf: use link attributes instead of dest name for cairo_pdf_surface_add_outlineAdrian Johnson2017-08-261-1/+1
| | | | | In PDF outline targets are specified the same way as link targets so there is no need to restrict the target to dest names.
* pdf: fix link positionsAdrian Johnson2017-08-261-2/+2
| | | | | | | | | | | | | | | Converting the link position from cairo to pdf coordinates requires the page height. Since the link may point to a different page, build an array of the height of each page and use the target page height for the conversion. Don't default to a [0,0] position if "pos" is not specified. PDF allows a null destination position to be specified which means don't change the position if the page is already displayed or show top left if switching to a different page. This is more useful default particularly for external files where the coordinates (which must be in PDF coordinates as we don't know the page height) of the top left corner may not be known.
* fix make checkAdrian Johnson2016-10-041-1/+1
|
* pdf: thumbnail APIAdrian Johnson2016-10-011-0/+4
|
* pdf: page label APIAdrian Johnson2016-10-011-0/+3
|
* pdf: metadata APIAdrian Johnson2016-10-011-0/+17
|
* pdf: add document outline APIAdrian Johnson2016-10-011-0/+22
|
* pdf: structured text and hyperlink supportAdrian Johnson2016-10-011-0/+111
|
* pdf: fix record-replay-extend test failuresAdrian Johnson2016-06-051-0/+1
|
* Fix PDF record-neg-extents test failureAdrian Johnson2016-06-051-2/+8
| | | | | | Modify PDF surface to allow surface extents to have negative x, y. When emitting recording surfaces, set the surface extents to the recording extents.
* pdf: change from pdf coordinates to cairo coordinatesAdrian Johnson2016-06-051-0/+12
| | | | | | | | | | | | | | | | | When an unbounded recording surface is used multiple times with different extents for each operation we need the XObject containing the recording surface to have the same origin for each operation. This is not possible when the recording surface is converted to PDF coordinates because each operation has different extents resulting in a different origin when the Y-axis is flipped (since the flip matrix depends on the recording surface height which for unbounded surfaces depends on the extents of the operation that paints the recording surface). Switching to cairo coordinates by emitting a Y-axis flip matrix as the first object of each page allows the recording surface to be emitted in cairo coordinates. This results in the same origin for all operations using the recording surface XObject.
* pdf: combine source and mask images into single imageAdrian Johnson2013-09-291-0/+2
| | | | | | | | | | | Since PDF stores the alpha component of images in a separate stream which can have a different resolution and encoding to the color components we can optimize the case where the source and mask are both images. If the source and mask are both images with the same extents and the source is opaque, combine the images into a single PDF image (ie the source is written the the image stream and the mask is written to the smask stream).
* pdf: support JBIG2 mime dataAdrian Johnson2013-09-151-0/+8
| | | | | | | | | | JBIG2 images may have shared global data that is stored in a separate stream in PDF. The CAIRO_MIME_TYPE_JBIG2 mime type is for the JBIG2 data for each image. All images that use global data must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. One of the images must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL to the global data. The global data will be shared by all JBIG2 images with the same CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.
* pdf: avoid making groups a transparency group if not requiredAdrian Johnson2013-09-111-0/+2
| | | | | | | If the group contains only a combination of clear and opaque alpha and only OPERATOR_OVER is used in the group and to paint the group, a transparency group is not required. This allows the pdf viewer to replay the group in place.
* pdf: fix the offset of padded imagesAdrian Johnson2012-06-021-2/+0
| | | | Bug 50598
* pdf: support RASTER_SOURCE patternsAdrian Johnson2012-01-111-0/+4
|
* pdf: avoid using pdf patterns to paint/fill opaque linear/radial gradientsAdrian Johnson2011-12-061-0/+2
| | | | | Patterns are slower and use more memory to print. For painting and filling we can use the shading operator to draw gradients.
* pdf: use _emit_smask() instead of _emit_imagemask to emit stencil maskAdrian Johnson2011-09-061-1/+1
| | | | | | | | Now that _emit_smask() can generate A1 masks, the _emit_imagemask() code can be removed and emit_smask() used instead. An additional benefit is stencil masks can be generated from ARGB32 and A8 images as well as A1 providing that the analysis of the transparency shows that the image is opaque or has bilevel alpha.
* pdf: use ink extents for pattern bboxAdrian Johnson2011-09-051-0/+1
|
* pdf: use ink extents for smask bboxAdrian Johnson2011-09-051-0/+2
| | | | | | | | | | | There are some inkscape bugs reporting very slow rendering of inkscape generated PDFs (inkscape uses cairo for PDF output). These bugs are caused by cairo specifying a page sized bounding box in XObjects and Patterns. PDF renderers usually use the BBox as the image size when compositing. As PDFs generated from SVG tends to use a lot of XObjects and Patterns this can lead to very long rendering times. These three patches tighten up all the BBoxes in PDF output.
* PDF: Output a stencil mask for cairo_mask() with solid source and A1 maskAdrian Johnson2010-12-051-0/+1
| | | | | | | | | | | | In https://bugs.launchpad.net/ubuntu/+source/libcairo/+bug/680628 a 65K PDF printed to PDF using poppler-cairo turns into an 8MB PDF. The original PDF contains a very large number of stencil mask images (an A1 image used as a mask for the current color). The PDF surface was not optimized for this particular case. It was drawing a solid color in a group and then using an smask with the image in another group. Fix this by checking for source = solid and mask = A1 image and emitting a stencil mask image.
* pdf: Silence compiler warningsAndrea Canciani2010-11-261-1/+1
| | | | | | | | | | | The compiler complains about a const pointer being free'd and memcpy'd to: cairo-pdf-surface.c: In function ‘_cairo_pdf_surface_add_source_surface’: cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__builtin___memcpy_chk’ discards qualifiers from pointer target type cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__inline_memcpy_chk’ discards qualifiers from pointer target type cairo-pdf-surface.c: In function ‘_cairo_pdf_source_surface_entry_pluck’: cairo-pdf-surface.c:1666: warning: passing argument 1 of ‘free’ discards qualifiers from pointer target type
* Add unique_id mime typeAdrian Johnson2010-11-231-0/+2
| | | | | to ensure surfaces with the same unique_id mime type are not embedded more than once in PDF files.
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* Constify stroke style and matrices.Chris Wilson2010-01-221-6/+5
| | | | | | As a simple step to ensure that we do not inadvertently modify (or at least generate compiler warns if we try) user data, mark the incoming style and matrices as constant.
* Remove clip handling from generic surface layer.Chris Wilson2009-07-231-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling clip as part of the surface state, as opposed to being part of the operation state, is cumbersome and a hindrance to providing true proxy surface support. For example, the clip must be copied from the surface onto the fallback image, but this was forgotten causing undue hassle in each backend. Another example is the contortion the meta surface endures to ensure the clip is correctly recorded. By contrast passing the clip along with the operation is quite simple and enables us to write generic handlers for providing surface wrappers. (And in the future, we should be able to write more esoteric wrappers, e.g. automatic 2x FSAA, trivially.) In brief, instead of the surface automatically applying the clip before calling the backend, the backend can call into a generic helper to apply clipping. For raster surfaces, clip regions are handled automatically as part of the composite interface. For vector surfaces, a clip helper is introduced to replay and callback into an intersect_clip_path() function as necessary. Whilst this is not primarily a performance related change (the change should just move the computation of the clip from the moment it is applied by the user to the moment it is required by the backend), it is important to track any potential regression: ppc: Speedups ======== image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup ▌ image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup ▎ image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup ▏ image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup ▏ Slowdowns ========= image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown ▏
* [pdf] Add support for the extra blend modesAdrian Johnson2009-07-141-0/+4
| | | | HSL modes support added by Benjamin Otte <otte@gnome.org>
* Fix PDF pattern embeddingAdrian Johnson2009-06-141-6/+15
| | | | | | | | | | The PDF snapshot cow patch was reusing a previously emitted surface pattern if the surface unique id matched the current surface. This resulted in incorrect output as the new pattern may have a different pattern matrix. This patch fixes the PDF backend to always emit a new pattern but re-use previously emitted image or metasurface XObjects.
* PDF: Don't embed the same pattern more than onceAdrian Johnson2009-06-021-3/+10
| | | | | | The PDF surface now keeps track of all the patterns it is embedding in a hash table keyed by the unique_id returned by the _cairo_surface_get_unique_id().
* PDF: Add cairo_pdf_surface_restrict_to_version APIAdrian Johnson2008-11-241-0/+2
| | | | | Now that we are using PDF 1.5 features, add an api to select between version 1.4 or 1.5.
* PDF: Store the operation extents in each patternAdrian Johnson2008-11-021-0/+1
| | | | | | The extents will be used by EXTEND_PAD patterns as well as any other pattern that can benefit from knowing the extents of the operation it will be used with.
* [show_text_glyphs] Replace the bool backward with cairo_text_cluster_flagsBehdad Esfahbod2008-09-181-1/+1
| | | | | | | | | | Chris rightfully complained that having a boolean function argument is new in cairo_show_text_glyphs, and indeed avoiding them has been one of the API design criteria for cairo. Trying to come up with alternatives, Owen suggested using a flag type which nicely solves the problem AND future-proofs such a complex API. Please welcome _flags_t APIs to cairo.h
* Add show_text_glyphs to PDF surfaceAdrian Johnson2008-06-291-0/+5
|