Skip to content

CLIP_ROUNDPOLY ​

Restrict drawing to an area by setting or modifying the clipping region with a closed shape with rounded corners by connecting several points.

Syntax ​

leo-grammar
CLIP_ROUNDPOLY arrayValue [ r:measureValue ]
    [ combine-mode: CombineMode ] .

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

Parameters ​

  • <main-parameter> (arrayValue) - Used in the array version to specify the points. The array must have an even amount of measure values.
  • r (measureValue, optional) - The radius to use for rounding corners. 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_ROUNDPOLY command sets / modifies the clipping region with a custom polygonal shape with rounded corners. For additional details about polygons with rounded corners and their parameters see the ROUNDPOLYGON 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 only a part of the image "nao_1.jepg" (located in the library's database), with the cut-out using a diamond shape with rounded corners.
Part of an image of a blue NAO robot

leo
GRAPHREP

CLIP_ROUNDPOLY ({0cm, 1.35cm, 1cm, 0cm, 2cm, 1.35cm, 1cm, 2.7cm}) r:0.3cm
BITMAPINFO ("db:\\nao_1.jpeg")
# Image assumed at 120dpi (2.54cm = 1inch) scaled down by a factor of 3
BITMAP ("db:\\nao_1.jpeg")
    x:-0.9cm y:-1.5cm
    w:(bmpwidth / 120 * 2.54cm / 3) h:(bmpheight / 120 * 2.54cm / 3)

Versions and Changes ​

Available since ADOxx 1.3