Skip to content

CLIP_ROUNDRECT ​

Restrict drawing to an area by setting or modifying the clipping region with a rectangular shape with rounded corners.

Syntax ​

leo-grammar
CLIP_ROUNDRECT [ x:measureValue ] [ y:measureValue ] [ w:measureValue ] [ h:measureValue ]
    [ rx:measureValue ] [ ry:measureValue ] [ combine-mode: CombineMode ] .

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

Parameters ​

  • x (measureValue, optional) - The x-coordinate of the top-left corner of the rectangle. The default is 0cm.
  • y (measureValue, optional) - The y-coordinate of the top-left corner of the rectangle. The default is 0cm.
  • w (measureValue, optional) - The width of the rectangle. The default is 0cm.
  • h (measureValue, optional) - The height of the rectangle. The default is 0cm.
  • rx (measureValue, optional) - The elliptical x-radius for the corners. The default is 0cm.
  • ry (measureValue, optional) - The elliptical y-radius for the 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_ROUNDRECT command sets / modifies the clipping region with a rectangular shape with rounded corners. For additional details about rectangles with rounded corners and their parameters see the ROUNDRECT 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 rounded rectangle.
Two NAO robots next to each other

leo
GRAPHREP

CLIP_ROUNDRECT w:3.7cm h:2.7cm rx:0.5cm ry:0.5cm
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