Browse Source

Added an example fo with Rounded Corners

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1396996 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-2_0
Peter Hancock 11 years ago
parent
commit
c8395e945d
1 changed files with 120 additions and 0 deletions
  1. 120
    0
      examples/fo/advanced/rounded-corners.fo

+ 120
- 0
examples/fo/advanced/rounded-corners.fo View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="main" page-width="21cm" page-height="29.7cm" margin-top="5mm">
<fo:region-body margin-bottom="30pt" margin-right="60pt" margin-left="60pt" margin-top="30pt"/>
<fo:region-after extent="4in"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="main">
<fo:flow flow-name="xsl-region-body" font-size="12pt">
<fo:block font-size="14pt" font-weight="bold">
Examples using Rounded Corners
</fo:block>
<fo:block margin="20pt 0 40pt 0">
<fo:block>The "border-radius" property in the http://xmlgraphics.apache.org/fop/extensions namespace is a shorthand property for setting appropriate values for "border-*-radius-*" (see below), and is used to specify round corners on block areas. The property takes one or two values:
</fo:block>
<fo:block-container margin="10 20pt 20pt 20pt">
<fo:block border-style="solid" border-width="10" border-color="#00f" fox:border-radius="20pt" padding="20pt" text-align="center" margin-bottom="10pt"> Circular corners are specified when 'border-radius' is set to a single value. This value is the radius of the outer quadrant of the corner.</fo:block>
<fo:block border-style="solid" border-width="10" border-color="#00f" fox:border-radius="20pt 40pt" padding="20pt" text-align="center" margin-bottom="10pt">Quarter-ellipse corners can be generated by setting two values for the property. The first value is the radius in the Inline Progression Direction. The second value is the radius in the Block Progression Direction.
</fo:block>
</fo:block-container>
</fo:block>
<fo:block margin="20pt 0 40pt 0">
<fo:block>To specify the corner radii of two adjacent border segments, A and B, the properties border-A-radius-B and border-B-radius-A are set. The value border-A-radius-B is the radius of the A-B corner in the direction perpendicular to segment A.
</fo:block>
<fo:table border-collapse="separate" margin-top="10pt">
<fo:table-column column-width="200pt"/>
<fo:table-column column-width="200pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block margin-left="50pt" border-style="solid" border-width="50pt 0 0 50pt" border-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="100pt" height="100pt">
<fo:block padding="50pt"/>
</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-left="50pt" border-style="solid" border-width="50pt 0 0 50pt" border-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="200pt" height="100pt">
<fo:block padding="50pt"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block margin="20pt">
<fo:block border-style="solid" background-color="#aaf" border-width="10" border-color="#00f" fox:border-radius="50pt" padding="20pt" text-align="center" margin-bottom="20pt">Backgrounds are cropped&#8230;</fo:block>
<fo:block break-after="page" border-style="solid" background-color="#aaf" border-width="0" border-color="#00f" fox:border-radius="50pt" padding="20pt" text-align="center" margin-bottom="20pt">&#8230;even with zero width borders.</fo:block>
</fo:block>
<fo:block>There are two canonical cases for rounded corners distinguished by the following condition: The width of each border segment is less than the corner radius perpendicular to that segment. This is demonstrated in Case <fo:inline font-style="italic">I</fo:inline> when this condition is <fo:inline font-style="italic">true</fo:inline> and Case <fo:inline font-style="italic">II</fo:inline> when <fo:inline font-style="italic">false</fo:inline>.</fo:block>
<fo:table border-collapse="separate" margin-bottom="25pt">
<fo:table-column column-width="200pt"/>
<fo:table-column column-width="200pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell height="100pt">
<fo:block margin-left="50pt" border-style="solid" border-width="70pt 0 0 70pt" border-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="100pt" height="100pt">
<fo:block padding="50pt" text-align="center">
<fo:inline font-style="italic">I</fo:inline>
</fo:block>
</fo:block>
</fo:table-cell>
<fo:table-cell height="100pt">
<fo:block margin-left="50pt" border-style="solid" border-width="70pt 0 0 70pt" border-color="#00f" fox:border-before-radius-start="50pt" fox:border-start-radius-before="50pt" height="100pt">
<fo:block padding="50pt" text-align="center">
<fo:inline font-style="italic">II</fo:inline>
</fo:block>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
<fo:table border-collapse="separate" margin="40pt 0 20pt 0">
<fo:table-column column-width="150pt"/>
<fo:table-column column-width="150pt"/>
<fo:table-column column-width="150pt"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell number-columns-spanned="3">
<fo:block margin-bottom="20pt">The border segments join at a line that coincides with the one that interesects the inner and outer corners of the equivalent rectangular corner. This is clearly demonstrated below where rounded borders are overlayed on top of rectangular borders.</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="50pt" fox:border-start-radius-before="50pt" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="100pt" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="150pt" border-before-width="50pt" border-start-width="50pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="50pt" fox:border-start-radius-before="50pt" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="100pt" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
<fo:table-cell border-style="solid" border-width="0" border-before-color="#afa" border-start-color="#aaf" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-top="-50pt" border-style="solid" border-width="0" border-before-color="#0f0" border-start-color="#00f" fox:border-before-radius-start="100pt" fox:border-start-radius-before="150pt" border-before-width="50pt" border-start-width="100pt" height="100pt">
<fo:block margin-bottom="100pt"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>

Loading…
Cancel
Save