96 lines
4.4 KiB
XML
96 lines
4.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<xml>
|
|
<include src="settings/generic.xml"/>
|
|
<synopsis
|
|
name="RContour"
|
|
description="belongs to a Glyph, contains Segments"
|
|
keywords="objects, contour, glyph, component"/>
|
|
<title>RoboFab Objects: RContour</title>
|
|
|
|
|
|
<div id="titlepic">
|
|
<img src="img/offdrawmodel_30.gif" alt="" border="0"/>
|
|
</div>
|
|
|
|
<div class="content">
|
|
<h1>RoboFab RContour</h1>
|
|
|
|
|
|
|
|
<h3>Usage</h3>
|
|
<pythonsource src="examples/usageContour.py"/>
|
|
|
|
<python type="output"><![CDATA[
|
|
< RContour for Mailer-Regular.a[0] >
|
|
]]></python>
|
|
|
|
<h3>Description</h3>
|
|
<p>
|
|
RContour is an object for, well, contours. A contour is a single path of any number of points and shape. A glyph usually consists of a couple fo contours, and this the object that represents each one. The RContour object offers access to the outline matter in various ways. The parent of RContour is usually RGlyph.
|
|
</p>
|
|
|
|
<h3>Understanding Contours and outlines</h3>
|
|
<p>
|
|
The way outline data is organised in RoboFab, and how the various objects relate is described here: <a href="howto/understandcontours.html">understanding contours</a>.
|
|
|
|
|
|
<p class="note">If you want to add new contours to a glyph it's easier to <a href="howto/usepens.html">draw them with a pen</a> than to construct the shapes from segments.</p>
|
|
</p>
|
|
<h3>Attributes</h3>
|
|
<ul>
|
|
<li><strong>index</strong>: the index of the contour in the Glyph.</li>
|
|
<li><strong>selected</strong>: returns 1 if the contour is selected, 0 if it isn't.</li>
|
|
<li><strong>box</strong>: the bounding box for the contour (read only).</li>
|
|
<li><strong>clockwise</strong>: direction of contour: 1=clockwise 0=counterclockwise</li>
|
|
<li><strong>points</strong>: the contour as a list of <a href="objects/points.py">Points</a>.</li>
|
|
<li><strong>bPoints</strong>: the contour as a list of <a href="objects/bpoints.py">bPoints</a>.</li>
|
|
</ul>
|
|
<h3>Attribute examples</h3>
|
|
<p>
|
|
<a href="howto/understandcontours.html">Examples with contours and points here.</a>
|
|
</p>
|
|
<h3>Methods for segments</h3>
|
|
<p>For regular drawing in glyphs: please use <a href="howto/usepens.html">Pens</a>. If you want to mess with segments on a lower level, be our guest:
|
|
</p>
|
|
<ul>
|
|
<li><strong>appendSegment(segmentType, points, smooth=False)</strong>: add a segment to the contour. Parameters?</li>
|
|
<li><strong>insertSegment(index, segmentType, points, smooth=False)</strong>: insert a segment into the contour. </li>
|
|
<li><strong>removeSegment(index)</strong>: remove a segment from the contour.</li>
|
|
<li><strong>setStartSegment(segmentIndex)</strong>: set the first node on the contour.</li>
|
|
</ul>
|
|
<h3>Methods for points</h3>
|
|
<p>
|
|
</p>
|
|
<ul>
|
|
<li><strong>appendBPoint(pointType, anchor, bcpIn=(0, 0), bcpOut=(0, 0))</strong>: append a bPoint to the contour.</li>
|
|
<li><strong>autoStartSegment()</strong>: automatically set the lower left point of the contour as the first point.</li>
|
|
<li><strong>insertBPoint(index, pointType, anchor, bcpIn=(0, 0), bcpOut=(0, 0))</strong>: insert a bPoint at index on the contour.</li>
|
|
</ul>
|
|
<h3>Other methods</h3>
|
|
<p>
|
|
</p>
|
|
<ul>
|
|
<li><strong>reverseContour()</strong>: reverse contour direction.</li>
|
|
<li><strong>copy()</strong>: duplicate this contour.</li>
|
|
<li><strong>draw(aPen)</strong>: draw the object with a RoboFab segment pen.</li>
|
|
<li><strong>drawPoints(aPen)</strong>: draw the object with a point pen.</li>
|
|
<li><strong>move((x, y))</strong>: move the contour.</li>
|
|
<li><strong>pointInside((x, y), evenOdd=0)</strong>: determine if the point is inside or ouside of the contour.</li>
|
|
<li><strong>round()</strong>: round the value of all points in the contour.</li>
|
|
<li>
|
|
<strong>scale((x, y), center=(0, 0))</strong>: Scale the contour by x and y. Optionally set the center of the scale.
|
|
</li>
|
|
<li>
|
|
<strong>rotate(angle, offset=None)</strong>: Rotate the contour by angle (in degrees). Optionally set an offset value.
|
|
</li>
|
|
<li>
|
|
<strong>skew(angle, offset=None)</strong>: Skew the contour by angle (in degrees). Optionally set an offset value.
|
|
</li>
|
|
<li><strong>transform(matrix)</strong>: transform this contour.
|
|
Use a Transform matrix object to mess with the contour. See also <a href="howto/usetransformations.html">how to use transformations.</a></li>
|
|
</ul>
|
|
<h3>Method examples</h3>
|
|
<pythonsource src="examples/contourMethods.py"/>
|
|
|
|
</div>
|
|
</xml> |