Skip to content

PATTERN_RECT ​

Draws and repeats a raster graphic / image in a rectangular area.

Syntax ​

leo-grammar
PATTERN_RECT [ x:measureValue ] [ y:measureValue ] [ w:measureValue ] [ h:measureValue ]
    [ bitmap:strValue pw:measureValue ph:measureValue ] [ rotation:realValue ] .

Parameters ​

  • x (measureValue, optional) - The x-coordinate of the top-left corner of the area. The default is 0cm.
  • y (measureValue, optional) - The y-coordinate of the top-left corner of the area. The default is 0cm.
  • w (measureValue, optional) - The width of the area. The default is 0cm.
  • h (measureValue, optional) - The height of the area. The default is 0cm.
  • bitmap (strValue, optional) - The path to a file, either local, in the database or accessible via HTTP/S. Must point to a valid image file.
  • pw (measureValue, optional) - The width for the image. Must be provided when bitmap is specified.
  • ph (measureValue, optional) - The height for the image. Must be provided when bitmap is specified.
  • rotation (realValue, optional) - The rotation to apply to the image in degrees. Default is 0.0.

Details ​

This command is not influenced by any style commands.

The image is drawn as a repeating pattern in the specified rectangular area with the top left corner at x and y coordinates and the width w and height h. For the width and height of the image the values from pw and ph are used, squashing or stretching the image accordingly. Use the command BITMAPINFO to determine an image's original size. The parameter rotation can be usd to rotate the image counter-clockwise in the area, but will not rotate the rectangular area where the pattern is drawn.

Caution

When a value is specified for bitmap, but the image can not be retrieved or when valid values for pw and ph are missing then the application will crash. Furthermore using rotation can make drawing the pattern very slow.

The image data is loaded from a file by providing its path via the bitmap parameter. The path can lead either to the local file system, the database (paths starting with "db:\\") or a resource on the internet accessible via HTTP/S (paths that start with "http://" or "https://"). As the path is provided as a string it is necessary to escape various characters, for example \ escaped as \\ in a path like c:\bitmaps\logo.png leading to "c:\\bitmaps\\logo.png".

The following file formats are supported (with color depths in parentheses):

  • bmp - Windows Bitmap (1, 4, 8, 16, 24, 32)
  • gif - Graphics Interchange Format (8)
  • ico - Windows Icon (1, 4, 8, 16, 24, 32)
  • jpeg - JPEG Graphics Format (8, 24)
  • png - Portable Network Graphics (1, 4, 8, 24, 32)
  • targa - Truevision Targa (8, 16, 24, 32)
  • tiff - Tagged Image File Format (1, 4, 8, 24, 32)
  • wbmp - Wireless Bitmap (1)
  • webp - WebP graphics format
  • xpm - X11 Pixmap (24)

The file extension is irrelevant, but the data of the image has to be according to one of those formats. Transparency however is ignored for all formats when using this command.

When loading the image data from a file, then the data is cached internally based on the path. Changes to the image file are not reflected until it is removed from the cache. The file is removed from the cache when all models where the file is used are closed.

The rotation of the rectangular area is not possible. This has an influence on the drawing of relations where a rectangular shape will change with different rotations.

See Also ​

Examples ​

Repeat the image from a local file located at c:\temp\adoxx_logo.png (scaled to a size of 2cm by 2cm) in a rectangular area of size 5cm by 3cm.
The ADOxx logo

leo
GRAPHREP

PATTERN_RECT x:0cm y:0cm w:5cm h:3cm bitmap:"c:\\temp\\adoxx_logo.png" pw:2cm ph:2cm

Versions and Changes ​

Available since ADOxx 1.3