You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Theresa Jayne Forster <th...@inbrand.co.uk> on 2011/12/16 16:46:58 UTC
Problem with clippath
As previously requested I am working with trying to clip images with the
method passed to me through this list,
But this is not working so I would appreciate some feedback, it should be an
image with rounded corners, unfortunately its appearing with square corners.
<?xml version="1.0" encoding="UTF-8"?>
<?xep-pdf-crop-offset 24pt?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:inbrand="http://www.inbrand1.co.uk/xsl"
xmlns:fox="http://xml.apache.org/fop/extensions"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:svg="http://www.w3.org/2000/svg">
<fo:layout-master-set>
<fo:simple-page-master column-gap="5mm"
column-count="2" margin-right="0cm" margin-left="0cm" margin-bottom="0cm"
margin-top="0cm" page-width="216mm" page-height="303mm"
master-name="a4window">
<fo:region-body
column-gap="4mm" column-count="2" margin-bottom="0mm" margin-right="13mm"
margin-left="13mm" margin-top="249.75mm" region-name="xsl-region-body"/>
<fo:region-before
extent="52mm" region-name="xsl-region-before"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="a4window">
<fo:static-content
flow-name="xsl-region-before">
<fo:block-container left="0"
top="0" position="absolute" height="52mm" width="216mm"
background-color="cmyk(11%,1%,0%,64%)">
<fo:block
text-align="right">
<fo:instream-foreign-object width="216mm" content-width="scale-to-fit">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="216mm" height="52mm"
viewBox="-1 -1 217 53">
<clipPath id="myClip">
d="M 20 0 L 196 0 Q 216,0 216,20 L 216 32 Q 216,52 196,52 L 20 52 Q 0,52
0,32 L 0 20 Q 0,0 20,0"
</clipPath>
<image clip-path="url(#myClip)" width="216" height="52"
xlink:href="/preprocessor/filestore/002.jpg"/>
</svg>
</fo:instream-foreign-object>
</fo:block>
</fo:block-container>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block/>
</fo:flow>
</fo:page-sequence>
</fo:root>
Kindest regards
Theresa Forster
Senior Software Developer
Re: Problem with clippath
Posted by Luis Bernardo <lm...@gmail.com>.
You are missing the <path /> element...
<clipPath id="myClip">
<path d="M 20 0 L 196 0 Q 216,0 216,20 L 216 32 Q
216,52 196,52 L 20 52 Q
0,52 0,32 L 0 20 Q 0,0 20,0" />
</clipPath>
Then it works. See attached output (needs some tweaking...).
On 12/16/11 3:46 PM, Theresa Jayne Forster wrote:
>
> As previously requested I am working with trying to clip images with
> the method passed to me through this list,
>
> But this is not working so I would appreciate some feedback, it should
> be an image with rounded corners, unfortunately its appearing with
> square corners.
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <?xep-pdf-crop-offset 24pt?>
>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
> xmlns:inbrand="http://www.inbrand1.co.uk/xsl"
> xmlns:fox="http://xml.apache.org/fop/extensions"
> xmlns:date="http://exslt.org/dates-and-times"
> xmlns:svg="http://www.w3.org/2000/svg">
>
> <fo:layout-master-set>
>
> <fo:simple-page-master column-gap="5mm" column-count="2"
> margin-right="0cm" margin-left="0cm" margin-bottom="0cm"
> margin-top="0cm" page-width="216mm" page-height="303mm"
> master-name="a4window">
>
> <fo:region-body column-gap="4mm" column-count="2" margin-bottom="0mm"
> margin-right="13mm" margin-left="13mm" margin-top="249.75mm"
> region-name="xsl-region-body"/>
>
> <fo:region-before extent="52mm" region-name="xsl-region-before"/>
>
> </fo:simple-page-master>
>
> </fo:layout-master-set>
>
> <fo:page-sequence master-reference="a4window">
>
> <fo:static-content flow-name="xsl-region-before">
>
> <fo:block-container left="0" top="0" position="absolute" height="52mm"
> width="216mm" background-color="cmyk(11%,1%,0%,64%)">
>
> <fo:block text-align="right">
>
> <fo:instream-foreign-object width="216mm" content-width="scale-to-fit">
>
> <svg xmlns="http://www.w3.org/2000/svg"
>
>
> xmlns:xlink="http://www.w3.org/1999/xlink"
>
>
> width="216mm" height="52mm"
>
>
> viewBox="-1 -1 217 53">
>
> <clipPath id="myClip">
>
>
> d="M 20 0 L 196 0 Q 216,0 216,20 L 216 32 Q 216,52 196,52 L 20 52 Q
> 0,52 0,32 L 0 20 Q 0,0 20,0"
>
> </clipPath>
>
> <image clip-path="url(#myClip)" width="216" height="52"
>
>
> xlink:href="/preprocessor/filestore/002.jpg"/>
>
> </svg>
>
> </fo:instream-foreign-object>
>
> </fo:block>
>
> </fo:block-container>
>
> </fo:static-content>
>
> <fo:flow flow-name="xsl-region-body">
>
> <fo:block/>
>
> </fo:flow>
>
> </fo:page-sequence>
>
> </fo:root>
>
> Kindest regards
>
>
> Theresa Forster
>
> Senior Software Developer
>