mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-04-27 16:30:42 +02:00
Add finer-grained fallback support to the PDF surface
The stream handling has been changed to support writing the content to one or more group objects. Each page has a top level knockout group. The first operation in the knockout group paints another group containing the content. Fallback images are painted from the knockout group. This ensures that fallback images do not composite with any content under the image.
This commit is contained in:
parent
1e8446609b
commit
1cdd11873b
3 changed files with 984 additions and 487 deletions
|
|
@ -277,8 +277,10 @@ _paint_page (cairo_paginated_surface_t *surface)
|
|||
return status;
|
||||
}
|
||||
|
||||
/* Finer grained fallbacks are currently only supported for PostScript surfaces */
|
||||
if (surface->target->type == CAIRO_SURFACE_TYPE_PS) {
|
||||
/* Finer grained fallbacks are currently only supported for PDF
|
||||
* and PostScript surfaces */
|
||||
if (surface->target->type == CAIRO_SURFACE_TYPE_PDF ||
|
||||
surface->target->type == CAIRO_SURFACE_TYPE_PS) {
|
||||
has_supported = _cairo_analysis_surface_has_supported (analysis);
|
||||
has_page_fallback = FALSE;
|
||||
has_finegrained_fallback = _cairo_analysis_surface_has_unsupported (analysis);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
*
|
||||
* Copyright © 2004 Red Hat, Inc
|
||||
* Copyright © 2006 Red Hat, Inc
|
||||
* Copyright © 2007 Adrian Johnson
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it either under the terms of the GNU Lesser General Public
|
||||
|
|
@ -34,6 +35,7 @@
|
|||
* Contributor(s):
|
||||
* Kristian Høgsberg <krh@redhat.com>
|
||||
* Carl Worth <cworth@cworth.org>
|
||||
* Adrian Johnson <ajohnson@redneon.com>
|
||||
*/
|
||||
|
||||
#ifndef CAIRO_PDF_SURFACE_PRIVATE_H
|
||||
|
|
@ -47,6 +49,14 @@ typedef struct _cairo_pdf_resource {
|
|||
unsigned int id;
|
||||
} cairo_pdf_resource_t;
|
||||
|
||||
typedef struct _cairo_pdf_group_resources {
|
||||
cairo_array_t alphas;
|
||||
cairo_array_t smasks;
|
||||
cairo_array_t patterns;
|
||||
cairo_array_t xobjects;
|
||||
cairo_array_t fonts;
|
||||
} cairo_pdf_group_resources_t;
|
||||
|
||||
typedef struct _cairo_pdf_surface cairo_pdf_surface_t;
|
||||
|
||||
struct _cairo_pdf_surface {
|
||||
|
|
@ -62,13 +72,11 @@ struct _cairo_pdf_surface {
|
|||
|
||||
cairo_array_t objects;
|
||||
cairo_array_t pages;
|
||||
cairo_array_t patterns;
|
||||
cairo_array_t xobjects;
|
||||
cairo_array_t streams;
|
||||
cairo_array_t alphas;
|
||||
cairo_array_t smasks;
|
||||
cairo_array_t rgb_linear_functions;
|
||||
cairo_array_t alpha_linear_functions;
|
||||
cairo_array_t knockout_group;
|
||||
cairo_array_t content_group;
|
||||
|
||||
cairo_scaled_font_subsets_t *font_subsets;
|
||||
cairo_array_t fonts;
|
||||
|
|
@ -81,21 +89,38 @@ struct _cairo_pdf_surface {
|
|||
cairo_pdf_resource_t self;
|
||||
cairo_pdf_resource_t length;
|
||||
long start_offset;
|
||||
cairo_bool_t compressed;
|
||||
cairo_output_stream_t *old_output;
|
||||
} current_stream;
|
||||
cairo_bool_t compressed;
|
||||
cairo_output_stream_t *old_output;
|
||||
} pdf_stream;
|
||||
|
||||
struct {
|
||||
cairo_pattern_type_t type;
|
||||
double red;
|
||||
double green;
|
||||
double blue;
|
||||
int alpha;
|
||||
cairo_pdf_resource_t smask;
|
||||
cairo_pdf_resource_t pattern;
|
||||
cairo_bool_t active;
|
||||
cairo_output_stream_t *stream;
|
||||
cairo_output_stream_t *old_output;
|
||||
cairo_pdf_group_resources_t resources;
|
||||
cairo_bool_t is_knockout;
|
||||
cairo_pdf_resource_t first_object;
|
||||
} group_stream;
|
||||
|
||||
struct {
|
||||
cairo_bool_t active;
|
||||
cairo_output_stream_t *stream;
|
||||
cairo_output_stream_t *old_output;
|
||||
cairo_pdf_group_resources_t resources;
|
||||
} content_stream;
|
||||
|
||||
struct {
|
||||
cairo_pattern_type_t type;
|
||||
double red;
|
||||
double green;
|
||||
double blue;
|
||||
double alpha;
|
||||
cairo_pdf_resource_t smask;
|
||||
cairo_pdf_resource_t pattern;
|
||||
} emitted_pattern;
|
||||
|
||||
cairo_bool_t has_clip;
|
||||
cairo_array_t *current_group;
|
||||
cairo_pdf_group_resources_t *current_resources;
|
||||
|
||||
cairo_paginated_mode_t paginated_mode;
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue