Skip to content

CLIP_ELLIPSE ​

Restrict drawing to an area by setting or modifying the clipping region with an circle or ellipse shape.

Syntax ​

leo-grammar
CLIP_ELLIPSE [ x:measureValue ] [ y:measureValue ] [ rx:measureValue ] [ ry:measureValue ]
    [ combine-mode: CombineMode ] .

CombineMode :  copy | and | or | diff | xor .

Parameters ​

  • x (measureValue, optional) - The x-coordinate of the ellipse's center. The default is 0cm.
  • y (measureValue, optional) - The y-coordinate of the ellipse's center. The default is 0cm.
  • rx (measureValue, optional) - The horizontal radius (half the width) of the ellipse. The default is 0cm.
  • ry (measureValue, optional) - The vertical radius (half the height) of the ellipse. The default is 0cm.
  • combine-mode (modifier, optional) - Whether and how to combine the clipping region with an existing clipping region. Should be one of copy, and, or, diff or xor. The default is copy.

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_ELLIPSE command sets / modifies the clipping region with a ellipse shape. For additional details about ellipses and their parameters see the ELLIPSE 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 green rectangle with part of an orange circle on the left side inside of it.
A green rectangle with part of an orange circle on its left side inside

leo
GRAPHREP
SHADOW off

PEN style:null
FILL color:"green"
RECTANGLE x:-1.3cm y:-0.8cm w:2.6cm h:1.6cm

CLIP_ELLIPSE x:-1.1cm rx:0.7cm ry:0.7cm
FILL color:"orange"
RECTANGLE x:-1.3cm y:-0.8cm w:1cm h:1.6cm

A complex collection of various shapes showing the combination of CLIP_ELLIPSE and CLIP_RECT.
Too complex to describe

leo
GRAPHREP
SHADOW off

# Drawing without a clipping region.
PEN style:null
FILL color:"green"
RECTANGLE x:0cm y:0cm w:2cm h:2cm
FONT "Arial" h:60pt line-orientation:10 bold underline
TEXT "TestTest" x:-3.5cm y:1cm

# Setting and modifying the clipping region.
CLIP_ELLIPSE x:0cm y:2cm rx:1.5cm ry:1.5cm
CLIP_ELLIPSE x:2cm y:2cm rx:1.5cm ry:1.5cm combine-mode:xor
CLIP_RECT x:-0.5cm y:1.3cm w:3cm h:0.2cm combine-mode:diff
CLIP_RECT x:-0.5cm y:1.9cm w:3cm h:0.2cm combine-mode:diff
CLIP_RECT x:-0.5cm y:2.5cm w:3cm h:0.2cm combine-mode:diff

# Drawing a rectangle that will end up looking like two blue circles with parts cut out.
FILL color:"dodgerblue"
RECTANGLE x:-2cm y:0cm w:6cm h:4cm

Versions and Changes ​

Available since ADOxx 1.3