Skip to content

Commit

Permalink
Add clipping to PDF form rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
Otfried Cheong committed May 25, 2024
1 parent bc45f20 commit b5f6f75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/news.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Ipe 7.2.29
restricted transformations (translations only or rigid motions
only) (bug #493).

* Add clipping to PDF form rendering (ipepresenter bug #12).

----------------------------------------------------------------------

Ipe 7.2.28 (2023-08-13)
Expand Down
5 changes: 5 additions & 0 deletions src/ipecairo/ipecairopainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,11 @@ void CairoPainter::execute(const PdfDict *xform, const PdfDict *resources, bool
mx.a[i] = m[i];
cairoTransform(iCairo, mx);
}
std::vector<double> bbox;
if (xform->getNumberArray("BBox", nullptr, bbox) && bbox.size() == 4) {
cairo_rectangle(iCairo, bbox[0], bbox[1], bbox[2] - bbox[0], bbox[3] - bbox[1]);
cairo_clip(iCairo);
}
Buffer buffer = xform->inflate();
BufferSource source(buffer);
PdfParser parser(source);
Expand Down

0 comments on commit b5f6f75

Please sign in to comment.