mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-08 03:52:04 +00:00
ISO 32000-2 §11.3.4: the elements of a transparency group blend in the group's colour space. For a subtractive space, each component is complemented before the blend function and again after it. §11.3.5.3: the nonseparable modes blend C, M and Y as their complements R, G and B, and K comes from the backdrop (Hue, Saturation, Color) or from the source (Luminosity). PdfCraft converted each colour to RGB and blended in RGB. A print test file's blend-mode patch then showed an X in almost every cell: magenta under black with Difference stayed magenta, not green. hayro-interpret patch (45): CmykGroup and Device::draw_isolated_cmyk_group (default false) for isolated, non-knockout groups with /CS /DeviceCMYK. interpret_form_contents is now a function of its own. Color::ink_tints and color::cmyk_to_srgb8 are new. hayro patch (21): the renderer draws such a group as a CMY pass and a K pass of complemented tints. It converts the tints to RGB with the CMYK profile and composites the result through the group's layer. The group is drawn as before with reading colours, for contents without process tints (RGB, spot colours, patterns, images) and above 2^24 pixels. Test: raster::tests::isolated_groups_blend_in_device_cmyk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
1.9 KiB
Rust
67 lines
1.9 KiB
Rust
/*!
|
|
A crate for interpreting PDF files.
|
|
|
|
This crate provides an abstraction to interpret the content of a PDF file and render them
|
|
into an abstract [`Device`], which clients can implement as needed. This allows you, for
|
|
example, to render PDF files to bitmaps (which is what the `hayro` crate does), or other formats
|
|
such as SVG.
|
|
|
|
It should be noted that this crate is still very much in development. Therefore it currently
|
|
lacks pretty much any documentation on how to use it. It's current API also only really makes it
|
|
useful for rendering to PNG or SVG, though this will be improved upon in the future.
|
|
|
|
# Examples
|
|
See the `examples` folder on the GitHub repository. Apart from that, you can also consult
|
|
the implementation of `hayro` and `hayro-svg` to get an idea on how to use this crate.
|
|
|
|
# Safety
|
|
This crate forbids unsafe code via a crate-level attribute.
|
|
|
|
# Cargo features
|
|
This crate has one optional feature:
|
|
- `embed-fonts`: PDF processors are required to support 14 predefined fonts that do not need to be
|
|
embedded into a PDF file. If you enable this feature, hayro will embed a (permissively-licensed)
|
|
substitute for each font, so that you don't have to implement your custom font loading logic. This
|
|
will add around ~240KB to your binary.
|
|
*/
|
|
|
|
#![forbid(unsafe_code)]
|
|
#![deny(missing_docs)]
|
|
|
|
#[macro_use]
|
|
mod log;
|
|
|
|
mod cache;
|
|
mod cmyk_group;
|
|
mod context;
|
|
mod convert;
|
|
mod device;
|
|
mod function;
|
|
mod interpret;
|
|
mod ocg;
|
|
mod soft_mask;
|
|
mod types;
|
|
mod x_object;
|
|
/// PdfCraft patch: exported for its regression test.
|
|
pub use x_object::image_size_ok;
|
|
|
|
pub mod color;
|
|
pub mod encode;
|
|
pub mod font;
|
|
pub mod gradient;
|
|
pub mod pattern;
|
|
pub mod shading;
|
|
pub mod util;
|
|
|
|
pub use cache::CacheKey;
|
|
pub use cmyk_group::CmykGroup;
|
|
pub use context::*;
|
|
pub use device::*;
|
|
pub use function::Function;
|
|
pub use hayro_cmap;
|
|
pub use hayro_syntax;
|
|
pub use interpret::*;
|
|
pub use soft_mask::*;
|
|
pub use types::*;
|
|
pub use util::{RectExt, TransformExt};
|