mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-30 13:08:48 -06:00
chore(vendor): renumber the CMYK-group patches after rebasing onto main
main has taken hayro-interpret patches up to (66) and hayro up to (25) since #3777 was opened, and open PRs claim hayro-interpret (67)-(69) and hayro (26). The isolated DeviceCMYK group patches become hayro-interpret (70) and hayro (27). vendor/README.md names the tests by their new path, raster::tests::isolated_cmyk_groups. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4fe2d9210
commit
d1f5658c89
@@ -7004,8 +7004,8 @@ mod default_colour_spaces;
|
||||
// (vendored hayro-syntax patch 28, hayro-interpret patch 55).
|
||||
mod devicen_inks;
|
||||
|
||||
// #3776: isolated DeviceCMYK groups blend in CMYK (vendored hayro-interpret patch 45, hayro
|
||||
// patch 21).
|
||||
// #3776: isolated DeviceCMYK groups blend in CMYK (vendored hayro-interpret patch 70, hayro
|
||||
// patch 27).
|
||||
mod isolated_cmyk_groups;
|
||||
|
||||
/// #3109 / #3116: clipping-only text (`7 Tr`) installs a clip for subsequent painting
|
||||
|
||||
@@ -11,7 +11,7 @@ use std::sync::Arc;
|
||||
/// §11.3.5.3 blends C, M and Y as complemented R, G and B and takes K from the backdrop
|
||||
/// (from the source for Luminosity). PdfCraft blended the colours converted to RGB, so
|
||||
/// magenta under black with Difference came out magenta instead of green. Vendored
|
||||
/// hayro-interpret patch (45) and hayro patch (21): an isolated group (§11.4.7: its own
|
||||
/// hayro-interpret patch (70) and hayro patch (27): an isolated group (§11.4.7: its own
|
||||
/// transparent backdrop) blending in DeviceCMYK is blended in CMYK.
|
||||
///
|
||||
/// Each cell is a square painted in the CMYK the blend should give, with a smaller isolated
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,4 +1,4 @@
|
||||
//! PdfCraft patch (45): an isolated transparency group that blends in `DeviceCMYK`.
|
||||
//! PdfCraft patch (70): an isolated transparency group that blends in `DeviceCMYK`.
|
||||
//!
|
||||
//! ISO 32000-2 §11.3.4: a group's elements blend in the group's colour space, and the
|
||||
//! components of a subtractive space are complemented before the blend function and
|
||||
@@ -26,7 +26,7 @@ use kurbo::{Affine, Rect, Shape};
|
||||
use std::ops::Deref;
|
||||
|
||||
/// An isolated, non-knockout transparency group whose blending colour space is `DeviceCMYK`,
|
||||
/// captured where it is painted (PdfCraft patch (45); see the module documentation).
|
||||
/// captured where it is painted (PdfCraft patch (70); see the module documentation).
|
||||
pub struct CmykGroup<'a, 'b> {
|
||||
form: &'b FormXObject<'a>,
|
||||
resources: &'b Resources<'a>,
|
||||
|
||||
Vendored
+2
-2
@@ -1399,7 +1399,7 @@ impl Color {
|
||||
.to_rgba(&self.components, self.opacity, false)
|
||||
}
|
||||
|
||||
/// PdfCraft patch (45): the colour as process ink tints `[C, M, Y, K]` (0 = no ink) and
|
||||
/// PdfCraft patch (70): the colour as process ink tints `[C, M, Y, K]` (0 = no ink) and
|
||||
/// its opacity, for blending in a `DeviceCMYK` transparency group (ISO 32000-2 §11.3.4).
|
||||
///
|
||||
/// `DeviceCMYK` gives its components. `DeviceGray` is black ink alone, `K = 1 − gray`
|
||||
@@ -1433,7 +1433,7 @@ impl Color {
|
||||
}
|
||||
}
|
||||
|
||||
/// PdfCraft patch (45): `input`, 8-bit `DeviceCMYK` pixels (four bytes each), converted to
|
||||
/// PdfCraft patch (70): `input`, 8-bit `DeviceCMYK` pixels (four bytes each), converted to
|
||||
/// 8-bit sRGB in `output` (three bytes each) through the CMYK profile pages are drawn with,
|
||||
/// so a colour blended in CMYK lands where the same colour painted directly does.
|
||||
pub fn cmyk_to_srgb8(input: &[u8], output: &mut [u8]) -> Option<()> {
|
||||
|
||||
Vendored
+2
-2
@@ -108,14 +108,14 @@ pub trait Device<'a> {
|
||||
fn begin_knockout_erase(&mut self) {}
|
||||
/// PdfCraft patch (39): see `knockout_erase_wanted`.
|
||||
fn end_knockout_erase(&mut self) {}
|
||||
/// PdfCraft patch (45): draw the contents of an isolated transparency group that blends
|
||||
/// PdfCraft patch (70): draw the contents of an isolated transparency group that blends
|
||||
/// in `DeviceCMYK` (ISO 32000-2 §11.3.4), already inside the layer it is composited
|
||||
/// through. Return `true` when the device drew them; on `false` (the default) the
|
||||
/// interpreter draws the contents into the device as for any other group.
|
||||
fn draw_isolated_cmyk_group(&mut self, _group: &CmykGroup<'a, '_>) -> bool {
|
||||
false
|
||||
}
|
||||
/// PdfCraft patch (45): an isolated transparency group that names a blending colour space
|
||||
/// PdfCraft patch (70): an isolated transparency group that names a blending colour space
|
||||
/// other than `DeviceCMYK` is about to be drawn. A device drawing an enclosing group in CMYK
|
||||
/// can no longer draw that group right, since this one blends in its own space.
|
||||
fn group_blends_outside_device_cmyk(&mut self) {}
|
||||
|
||||
+2
-2
@@ -211,7 +211,7 @@ pub(crate) fn draw_form_xobject<'a, 'b>(
|
||||
|
||||
let resources = Resources::for_form(x_object.resources.clone(), resources.clone());
|
||||
|
||||
// PdfCraft patch (45): an isolated group blending in DeviceCMYK starts from a backdrop of
|
||||
// PdfCraft patch (70): an isolated group blending in DeviceCMYK starts from a backdrop of
|
||||
// its own, so a device able to blend in CMYK computes its interior apart and composites the
|
||||
// result through the layer pushed above (see `cmyk_group`). Knockout groups are left out:
|
||||
// their elements composite with the group's initial backdrop, not with each other.
|
||||
@@ -252,7 +252,7 @@ pub(crate) fn draw_form_xobject<'a, 'b>(
|
||||
}
|
||||
|
||||
/// The contents of form `x_object`, in `context` as prepared for them (the form's `/Matrix`
|
||||
/// applied, its root transform pushed), clipped to its `/BBox`. PdfCraft patch (45): shared by
|
||||
/// applied, its root transform pushed), clipped to its `/BBox`. PdfCraft patch (70): shared by
|
||||
/// [`draw_form_xobject`] and [`CmykGroup::interpret`].
|
||||
pub(crate) fn interpret_form_contents<'a>(
|
||||
resources: &Resources<'a>,
|
||||
|
||||
Vendored
+8
-8
@@ -436,7 +436,7 @@ enum PaintSetup {
|
||||
Nothing,
|
||||
}
|
||||
|
||||
/// PdfCraft patch (21): the largest group, in device pixels, blended in CMYK (2^24, a 4096 ×
|
||||
/// PdfCraft patch (27): the largest group, in device pixels, blended in CMYK (2^24, a 4096 ×
|
||||
/// 4096 square). Each pixel costs about 20 bytes more than drawing the group as before (two
|
||||
/// pass canvases, its tints, their RGB and the result); a larger group is drawn as before.
|
||||
const MAX_CMYK_GROUP_PIXELS: u64 = 1 << 24;
|
||||
@@ -469,12 +469,12 @@ pub(crate) struct Renderer {
|
||||
pub(crate) preview: bool,
|
||||
// TODO: Remove this once vello_cpu bug with non-transparent images is fixed
|
||||
image_transparency_stack: Vec<bool>,
|
||||
/// PdfCraft patch (21): set while this renderer draws one ink pass of a group blending
|
||||
/// PdfCraft patch (27): set while this renderer draws one ink pass of a group blending
|
||||
/// in `DeviceCMYK` (see [`Renderer::draw_isolated_cmyk_group`]).
|
||||
ink: InkState,
|
||||
}
|
||||
|
||||
/// PdfCraft patch (21): which inks a pass of a `DeviceCMYK` group draws, and whether the
|
||||
/// PdfCraft patch (27): which inks a pass of a `DeviceCMYK` group draws, and whether the
|
||||
/// group asked for something a pass can't draw.
|
||||
///
|
||||
/// A pass paints the complement of ink tints as colour — no ink is white — so the RGB blend
|
||||
@@ -1126,7 +1126,7 @@ impl Renderer {
|
||||
.fill_rect(&Rect::new(0.0, 0.0, width as f64, height as f64));
|
||||
}
|
||||
|
||||
/// PdfCraft patch (21): one ink pass of `group` (see [`InkState`]) on a `width` × `height`
|
||||
/// PdfCraft patch (27): one ink pass of `group` (see [`InkState`]) on a `width` × `height`
|
||||
/// canvas whose corner is device point `offset`; `None` when the group holds something the
|
||||
/// pass has no tints for.
|
||||
fn ink_pass(
|
||||
@@ -1219,7 +1219,7 @@ impl Renderer {
|
||||
// covers its triangles alone and must not repeat outside them.
|
||||
let mut extend = peniko::Extend::Repeat;
|
||||
|
||||
// PdfCraft patch (21): an ink pass paints tints, and has none for a pattern.
|
||||
// PdfCraft patch (27): an ink pass paints tints, and has none for a pattern.
|
||||
if let Some(pass) = self.ink.pass {
|
||||
let color = match paint {
|
||||
Paint::Color(c) => self.ink.paint(pass, c),
|
||||
@@ -1635,7 +1635,7 @@ impl Renderer {
|
||||
|
||||
impl<'a> Device<'a> for Renderer {
|
||||
fn draw_image(&mut self, image: hayro_interpret::Image<'a, '_>, mut transform: Affine) {
|
||||
// PdfCraft patch (21): an image's pixels are converted to RGB before they reach the
|
||||
// PdfCraft patch (27): an image's pixels are converted to RGB before they reach the
|
||||
// device, so an ink pass has no tints for them; the group is drawn as before.
|
||||
if self.ink.pass.is_some() {
|
||||
self.ink.unsupported = true;
|
||||
@@ -1818,7 +1818,7 @@ impl<'a> Device<'a> for Renderer {
|
||||
self.push_clip_path_inner(&clip_path.path, clip_path.fill);
|
||||
}
|
||||
|
||||
/// PdfCraft patch (21), with hayro-interpret patch (45): an isolated group that blends in
|
||||
/// PdfCraft patch (27), with hayro-interpret patch (70): an isolated group that blends in
|
||||
/// `DeviceCMYK` (ISO 32000-2 §11.3.4). Its contents are drawn twice on canvases of their own,
|
||||
/// as cyan-magenta-yellow and as black (see [`InkState`]), and the tints those passes leave
|
||||
/// are converted to RGB through the CMYK profile solid CMYK colour is drawn with. The
|
||||
@@ -1826,7 +1826,7 @@ impl<'a> Device<'a> for Renderer {
|
||||
/// with the group's opacity, soft mask and blend mode as before. Declined (and so drawn as
|
||||
/// before) under reading colours, inside a pass (a nested group then blends in the pass's
|
||||
/// own CMYK), and for contents a pass has no tints for.
|
||||
/// PdfCraft patch (21): a nested group blending in another space can't be drawn in a pass.
|
||||
/// PdfCraft patch (27): a nested group blending in another space can't be drawn in a pass.
|
||||
fn group_blends_outside_device_cmyk(&mut self) {
|
||||
if self.ink.pass.is_some() {
|
||||
self.ink.unsupported = true;
|
||||
|
||||
Reference in New Issue
Block a user