Fix patterns with spacing in PDF (#3793)

This commit is contained in:
Eric Biedert 2024-04-01 22:37:05 +02:00 committed by GitHub
parent eef3c3c5ff
commit 72c5b42a30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -73,7 +73,9 @@ pub(crate) fn write_patterns(ctx: &mut PdfContext) {
resources_map.finish();
tiling_pattern
.matrix(transform_to_array(
transform.pre_concat(Transform::scale(Ratio::one(), -Ratio::one())),
transform
.pre_concat(Transform::scale(Ratio::one(), -Ratio::one()))
.post_concat(Transform::translate(Abs::zero(), pattern.spacing().y)),
))
.filter(Filter::FlateDecode);
}
@ -82,7 +84,7 @@ pub(crate) fn write_patterns(ctx: &mut PdfContext) {
/// A pattern and its transform.
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct PdfPattern {
/// The transform to apply to the gradient.
/// The transform to apply to the pattern.
pub transform: Transform,
/// The pattern to paint.
pub pattern: Pattern,