CLIP_POLY ​
Restrict drawing to an area by setting or modifying the clipping region with a closed shape by connecting several points.
Syntax ​
Syntax with a fixed amount of points:
CLIP_POLY intValue
[ x1:measureValue ] [ y1:measureValue ]
[ x2:measureValue ] [ y2:measureValue ]
...
[ xn:measureValue ] [ yn:measureValue ]
[ combine-mode: CombineMode ] .
Syntax using an array of points:
CLIP_POLY arrayValue
[ combine-mode: CombineMode ] .
Parameters ​
Parameters for fixed amount of points:
<main-parameter>
(intValue) - Used in the fixed amount of points version to specify the amount of points.x<intValue>
(measureValue, optional) - The x-coordinate of the n-th point where n-th is specified through<intValue>
. The default is0cm
.y<intValue>
(measureValue, optional) - The y-coordinate of the n-th point where n-th is specified through<intValue>
. The default is0cm
.combine-mode
(modifier, optional) - Whether and how to combine the clipping region with an existing clipping region. Should be one ofcopy
,and
,or
,diff
orxor
. The default iscopy
.
Parameters for array of points:
<main-parameter>
(arrayValue) - Used in the array version to specify the points. The array must have an even amount of measure values.combine-mode
(modifier, optional) - Whether and how to combine the clipping region with an existing clipping region. Should be one ofcopy
,and
,or
,diff
orxor
. The default iscopy
.
Details ​
This command restricts the area in which anything is drawn by setting a clipping region or modifying an existing clipping region. All drawing which lies outside the current clipping region is ineffective, while all parts of elements inside are visible. The clipping region can be of any shape by combining several basic shapes. A clipping region can even consist of disjoint parts.
The CLIP_POLY
command sets / modifies the clipping region with a custom polygonal shape. For additional details about polygons and their parameters see the POLYGON
command.
At the beginning of a GraphRep drawing, no clipping is active. When reaching a clipping command, the current clipping region is set to the given shape. If clipping is already active, the new region can either replace the current clipping region (combine-mode:copy
, which is the default) or can be combined with the current clipping region with one of the following combine-mode
operators:
and
: The resulting clipping region includes everything which belongs to both regions (intersection).or
: The resulting clipping region includes everything which belongs at least to one of both regions (union).diff
: The resulting clipping region is the current clipping region with the given region removed from it (difference, subtraction).xor
: The resulting clipping region includes everything which belongs to exactly one of both regions (symmetric difference).
The current clipping region can be deactivated with the CLIP_OFF
command.
The combine-mode:and
, combine-mode:diff
and combine-mode:xor
are not fully supported in SVG Graphics. Instead of combinations, separate clippings have to be defined.
See Also ​
Examples ​
Draw a white circle with a red outline and a red stripe going diagonally through the middle (using a polygon with a "fixed" amount of points).
GRAPHREP
# Note: SHADOW is on by default.
# Draw the white circle.
PEN color:"red" w:0.2cm
FILL color:"white"
ELLIPSE rx:0.9cm ry:0.9cm
# Overlay a white diagonal stripe on top using a clipping region.
CLIP_POLY 4
x1:-1.5cm y1:0.7cm
x2:-1.5cm y2:0.2cm
x3:1.5cm y3:-0.7cm
x4:1.5cm y4:-0.2cm
FILL color:"red"
ELLIPSE rx:0.9cm ry:0.9cm
Draw a white circle with a red outline and a red stripe going diagonally through the middle (using a polygon with an array of points).
GRAPHREP
# Note: SHADOW is on by default.
# Draw the white circle.
PEN color:"red" w:0.2cm
FILL color:"white"
ELLIPSE rx:0.9cm ry:0.9cm
# Overlay a white diagonal stripe on top using a clipping region.
CLIP_POLY { -1.5cm, 0.7cm, -1.5cm, 0.2cm, 1.5cm, -0.7cm, 1.5cm, -0.2cm }
FILL color:"red"
ELLIPSE rx:0.9cm ry:0.9cm
Versions and Changes ​
Available since ADOxx 1.3