From d83833a0a64872d705cbaa01bef088662e26e8a7 Mon Sep 17 00:00:00 2001 From: David Warring Date: Mon, 9 Sep 2024 07:35:34 +1200 Subject: [PATCH] Add small clipping example --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6409c92..1b72df4 100644 --- a/README.md +++ b/README.md @@ -691,6 +691,8 @@ $gfx.transform: :rotate(pi/4), :scale(2); ``` Unlike [Text Transforms](#text-transform), Graphics Transforms accumulate; and are applied in addition to any existing transforms. +Text transforms are scoped to a [graphics](#graphics) block. + ### paint Synopsis: `$gfx.paint( &block?, :close, :stroke, :fill, :even-odd)` @@ -716,7 +718,7 @@ The graphics state is saved and restored if the optional block is provided. The ```raku use PDF::Content::Color :rgb; -given $gfx: { +given $gfx { .Save; .FillColor = rgb(.7, .7, .9); .StrokeColor = rgb(.9, .5, .5); @@ -1831,6 +1833,18 @@ Method | Code | Description Clip() | W | Modify the current clipping path by intersecting it with the current path, using the nonzero winding number rule to determine which regions lie inside the clipping path. | EOClip() | W* | Modify the current clipping path by intersecting it with the current path, using the even-odd rule to determine which regions lie inside the clipping path. | +The current clipping path is applied to the next painting or text output +operation. For example: + +```raku +given $gfx { + .Rectangle: 100, 100, 125, 20; + .Clip; + .EndPath; + .say: 'Clip me', :position[98, 98]; +} +``` + ### Marked Content Method | Code | Description | Notes