Class: Tioga::Using_Paths
- Inherits:
-
Object
- Object
- Tioga::Using_Paths
- Defined in:
- lib/Tioga/Using_Paths.rb
Overview
These are the methods and attributes related to using previously created paths in PDF graphics operations. See also Tutorial::Tutorial::SimpleFigure.
Instance Method Summary collapse
-
#clip ⇒ Object
:call-seq: clip Sets clipping path using the winding number rule (see #fill for description).
-
#close_and_stroke ⇒ Object
:call-seq: close_and_stroke Close and #stroke the current path.
-
#close_eofill_and_stroke ⇒ Object
:call-seq: close_eofill_and_stroke Close, fill, and then stroke the path, using the even-odd rule to determine the region to fill.
-
#close_fill_and_stroke ⇒ Object
:call-seq: close_fill_and_stroke Close, fill, and then stroke the path, using the nonzero winding number rule to determine the region to fill (see #fill).
-
#eoclip ⇒ Object
:call-seq: eoclip Sets clipping path using the even-odd rule (see #eofill for description).
-
#eofill ⇒ Object
:call-seq: eofill Fill the path, using the even-odd rule to determine the region to fill.
-
#eofill_and_stroke ⇒ Object
:call-seq: eofill_and_stroke Fill and then stroke the path, using the even-odd rule to determine the region to fill (see #eofill).
-
#fill ⇒ Object
:call-seq: fill Fill the path, using the nonzero winding number rule to determine the region to fill.
-
#fill_and_stroke ⇒ Object
:call-seq: fill_and_stroke Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill (see #fill).
-
#fill_color ⇒ Object
:call-seq: fill_color fill_color = a_color.
-
#line_color ⇒ Object
:call-seq: line_color line_color = a_color.
-
#stroke ⇒ Object
:call-seq: stroke Paints a line along the current path.
-
#stroke_color ⇒ Object
:call-seq: stroke_color stroke_color = a_color.
Instance Method Details
#clip ⇒ Object
:call-seq:
clip
Sets clipping path using the winding number rule (see #fill for description).
151 152 |
# File 'lib/Tioga/Using_Paths.rb', line 151 def clip end |
#close_and_stroke ⇒ Object
:call-seq:
close_and_stroke
Close and #stroke the current path.
72 73 |
# File 'lib/Tioga/Using_Paths.rb', line 72 def close_and_stroke end |
#close_eofill_and_stroke ⇒ Object
:call-seq:
close_eofill_and_stroke
Close, fill, and then stroke the path, using the even-odd rule to determine the region to fill.
144 145 |
# File 'lib/Tioga/Using_Paths.rb', line 144 def close_eofill_and_stroke end |
#close_fill_and_stroke ⇒ Object
:call-seq:
close_fill_and_stroke
Close, fill, and then stroke the path, using the nonzero winding number rule to determine the region to fill (see #fill).
137 138 |
# File 'lib/Tioga/Using_Paths.rb', line 137 def close_fill_and_stroke end |
#eoclip ⇒ Object
:call-seq:
eoclip
Sets clipping path using the even-odd rule (see #eofill for description).
158 159 |
# File 'lib/Tioga/Using_Paths.rb', line 158 def eoclip end |
#eofill ⇒ Object
:call-seq:
eofill
Fill the path, using the even-odd rule to determine the region to fill. The even-odd rule determines the insideness of a point by drawing a ray from that point in any direction and simply counting the number of path segments that cross the ray, regardless of direction. If this number is odd, the point is inside; if even, the point is outside. This yields the same results as the nonzero winding number rule for paths with simple shapes, but produces different results for more complex shapes. See also #fill.
111 112 |
# File 'lib/Tioga/Using_Paths.rb', line 111 def eofill end |
#eofill_and_stroke ⇒ Object
:call-seq:
eofill_and_stroke
Fill and then stroke the path, using the even-odd rule to determine the region to fill (see #eofill).
129 130 |
# File 'lib/Tioga/Using_Paths.rb', line 129 def eofill_and_stroke end |
#fill ⇒ Object
:call-seq:
fill
Fill the path, using the nonzero winding number rule to determine the region to fill. Any subpaths that are open are implicitly closed before being filled. The nonzero winding number rule determines whether a given point is inside a path by conceptually drawing a ray from that point to infinity in any direction and then examining the places where a segment of the path crosses the ray. Starting with a count of 0, the rule adds 1 each time a path segment crosses the ray from left to right and subtracts 1 each time a segment crosses from right to left. After counting all the crossings, if the result is 0 then the point is outside the path; otherwise it is inside.
For simple convex paths, the nonzero winding number rule defines the inside and outside as one would intuitively expect. The more interesting cases are those involving complex or self-intersecting paths. For a path consisting of a five-pointed star, drawn with five connected straight line segments intersecting each other, the rule considers the inside to be the entire area enclosed by the star, including the pentagon in the center. For a path composed of nested squares, the area enclosed by both is considered to be inside, provided that both squares are drawn in the same direction. If the squares are drawn in opposite directions, only the area between them is inside, according to the nonzero winding number rule. See also #eofill.
98 99 |
# File 'lib/Tioga/Using_Paths.rb', line 98 def fill end |
#fill_and_stroke ⇒ Object
:call-seq:
fill_and_stroke
Fill and then stroke the path, using the nonzero winding number rule to determine the region to fill (see #fill). This produces the same result as constructing two identical path objects, painting the first with #fill and the second with #stroke. Note, however, that the filling and stroking portions of the operation consult different values of several graphics state parameters, such as the current color.
122 123 |
# File 'lib/Tioga/Using_Paths.rb', line 122 def fill_and_stroke end |
#fill_color ⇒ Object
:call-seq:
fill_color
fill_color = a_color
Defines the color to use for painting by #fill and other non-stroke graphics operations.
30 31 |
# File 'lib/Tioga/Using_Paths.rb', line 30 def fill_color end |
#line_color ⇒ Object
:call-seq:
line_color
line_color = a_color
Alias for stroke_color.
22 23 |
# File 'lib/Tioga/Using_Paths.rb', line 22 def line_color end |
#stroke ⇒ Object
:call-seq:
stroke
Paints a line along the current path. The stroked line follows each straight or curved segment in the path, centered on the segment with sides parallel to it. Each of the path’s subpaths is treated separately.
The results of the stroke operator depend on the current settings of various parameters in the graphics state.
-
The width of the stroked line is determined by the current line_width attribute.
-
The color of the line is determined by the current stroke_color attribute.
-
The line can be painted either solid or with a dash pattern, as specified by the current line_type attribute.
-
If a subpath is open, the unconnected ends are treated according to the current line_cap attribute, which may be
LINE_CAP_BUTT
,LINE_CAP_ROUND
, orLINE_CAP_SQUARE
. -
Wherever two consecutive segments are connected, the joint between them is treated according to the current line_join attribute, which may be
LINE_JOIN_MITER
,LINE_JOIN_ROUND
, orLINE_JOIN_BEVEL
. Mitered joins are also subject to the current miter_limit setting.
NOTE: Points at which unconnected segments happen to meet or intersect receive no special treatment. In particular, connecting the ends of a subpath with an explicit add_point_to_path operator rather than with close_path may result in a messy corner, because line caps will be applied instead of a line join.
If a subpath is degenerate (consists of a single-point closed path or of two or more points at the same coordinates), the stroke operator paints it only if round line caps have been specified, producing a filled circle centered at the single point. If butt or projecting square line caps have been specified, stroke produces no output, because the orientation of the caps would be indeterminate. A single-point open subpath (specified by a trailing move_to_point operator) produces no output.
65 66 |
# File 'lib/Tioga/Using_Paths.rb', line 65 def stroke end |
#stroke_color ⇒ Object
:call-seq:
stroke_color
stroke_color = a_color
Defines the color to use for painting by #stroke operations.
14 15 |
# File 'lib/Tioga/Using_Paths.rb', line 14 def stroke_color end |