2.8 tile (pattern)

Graphics, pictures and patterns used within the IDM must be declared as resources. The keyword for this is tile, followed by an identifier and the tile definition. The tile definition is either included directly in the IDM file or in a separate graphics file.

Definition

{ export | reexport } tile <Identifier> <tileSpec> | <variantDef>
tileSpec ::= <tileBitmap> | "<file path>" | "<graphics resource>" { scale | 
		noscale | numscale | propscale | } ;
tileBitmap ::= <x>, <y>,
               "<pattern line>"
           [ , "<pattern line>" ]
variantDef ::=
{
           0 :  <tileSpec> 
  [ <number> :  <tileSpec> ]
}

For the definition of variants it is recommended to always define a variant with the number 0, since this is the default variant if no variant, a non-existent variant, or an invalid variant is set. The other numbers may be arbitrary natural numbers.

The tile variant to be used can be set with the command line option ‑IDMtile when starting the application. During runtime of the application it can be queried and set with the .tile attribute of the setup object.

2.8.1 Internal pattern (Bitmap)

<x> and <y> represent the number of pixels in horizontal and vertical direction. Width (<x>) and height (<y>) may be chosen arbitrarily.

<pattern line> denotes a string of <x> characters in which each character represents one pixel of the tile. Only rectangular tiles are possible, therefore exactly <y> pattern lines with <x> characters each have to be defined.

The pattern lines consist of the characters period (.) space ( ) and hash (#), which have the following meaning:

.
(Leerzeichen)

Adopts the background color, i.e. the pattern will be transparent at this point.

If the tile resource is used in the .picture or .picture[enum] attributes of an image object whose .imagebgc attribute is set, a pixel in the color .imagebgc is displayed here.

#

At this point, a pixel in the foreground color will be displayed.

When using the tile resource in the .picture or .picture[enum] attributes of an image object, this will be the color set in the .imagefgc attribute of the image object.

Example for the Definition of an Internal Pattern

tile TiGray 16, 16,
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ",
  "# # # # # # # # ",
  " # # # # # # # #",
  "# # # # # # # # ";

2.8.2 External pattern

With the definition using a file name (including path), the IDM assumes that the definition of the tile is in a separate graphics file. The IDM loads the corresponding file and displays its contents using the system functions of the respective toolkit. Therefore it depends on the platform which graphics formats can be displayed.

The following table shows which graphics formats are supported on each platform:

Table 20-4: Graphics formats supported by the tile resource

Graphics Format

File Extension

Microsoft Windows

Motif

Qt

Graphics Interchange Format

.gif

yes

yes

yes

Device Independent Bitmap

.bmp

yes

no

yes

X PixMap

.xpm

no

since Motif 2.1

no

JPEG File Interchange Format

.jpg

yes

since Motif 2.3

yes

Portable Network Graphics

.png

yes

since Motif 2.3

yes

Enhanced Metafile
Windows Metafile

.emf
.wmf

yes

no

no

Aldus Placeable Metafile

.apm

yes

no

no

Windows Icon Resource File

.ico

yes

no

no

Windows Icon Resource
Windows Bitmap Resource

yes

no

no

Scalable Vector Graphics .svg yes no

yes

The definition using a graphics resource is only supported by the IDM for Windows. The identifiers IDM_AppIcon and IDM_DefIcon of the resources defined in the IDM libraries may be used here (see also attribute .icon in the “Attribute Reference”).

Additionally, on Microsoft Windows, the following identifiers for predefined bitmap resources of the system can be specified:

BTNCORNERS

BTSIZE

CHECK

CHECKBOXES

CLOSE

COMBO

DNARROW

DNARROWD

DNARROWI

LFARROW

LFARROWD

LFARROWI

MNARROW

OLD_CLOSE

OLD_DNARROW

OLD_LFARROW

OLD_REDUCE

OLD_RESTORE

OLD_RGARROW

OLD_UPARROW

OLD_ZOOM

REDUCE

REDUCED

RESTORE

RESTORED

RGARROW

RGARROWD

RGARROWI

SIZE

UPARROW

UPARROWD

UPARROWI

ZOOM

ZOOMD

 

Note

The images of the tile resource are now automatically enlarged according to the configured scaling factor. It is assumed hereby that the images were designed for a DPI value of 96. If the images of the application are designed for a higher resolution, then this can be set in the setup object with the attribute .tiledpi.

When specifying an external file, it is recommended not to define the absolute path but rather to use an environment variable, e.g. "IDM_IMAGEPATH:Check.gif".

Other graphics formats can be processed using a self-implemented graphics handler (GFX handler; see function DM_PictureHandler in manual “C Interface - Functions”).

2.8.3 Scaling

By specifying a scalestyle in the tile definition, the tile or picture will be resized to fit the available space according to specific criteria.

Best practice: If possible, patterns should already be available in the correct or used size, as any scaling is associated with a loss of sharpness or richness of detail.

scale | noscale | numscale | propscale

Determines the type of scaling of the pattern or image.

Definition on Tile Dynamic setting Meaning
noscale scalestyle_none

The pattern or image is not scaled. .tiledpi has no impact.

scale scalestyle_any

The height and width of the pattern or image are fully enlarged to fit the available area.

propscale scalestyle_prop

Height and width of the pattern or image are enlarged to the available area, while height and width proportions of the pattern or image are maintained in any case. I.e. free spaces can be created above and below or left and right.

numscale scalestyle_num

The scaling of the pattern or image is done by a numerical scaling divider. The scaling is done in quarter steps, i.e. 1.25-fold, 1.5-fold, 1.75-fold, 2-fold, 2.25-fold, 2.5-fold, and so on.
A downscaling is done down to a maximum of 0.25-fold.

dpi scalestyle_dpi

The pattern or image is always scaled according to the set screen scaling.

Not provided

scalestyle_auto

The pattern or image is scaled according to the set screen scaling. A scaling compatible to the previous version takes place. Default value

See also

Attribute .scalestyle in manual “Attribute Reference”

2.8.4 Dynamically Changeable Attributess

The modifiable attributes can be found in the following table. It should be noted that .name on the one hand and .width, .height and .pattern on the other hand are mutually exclusive, so that get leads to a can't get value error message.

For variant tile resources, the attributes of the current tile variant are accessed; the current variant can be queried and set using the .tile attribute of the setup object.

Table 20-5: Modifiable attributes of the tile resource

Attribute

Data Type

Index Range

Description

.name

string

File path of an image file.

.width

integer

Width of the pattern in pixels.

.height

integer

Height of the pattern in pixels.

.pattern

string

Complete pattern as string.

.pattern[integer]

string

1 … .height

Single lines of the pattern.

The length of each string must be equal to .width.

.scale

boolean

Resizing to the available space.

Default value false (no resizing).

.scalestyle

enum

Controls the display and scaling of a tile.

Default value scalestyle_auto

2.8.5 SVG Support

On Windows and Qt, the tile resource now also supports vector images in SVG format.

2.8.5.1 Qt

The IDM for Qt was already able to display SVG images, but only via a pixel-based proxy image that was scaled accordingly. The .svg file extension is now recognized as an SVG image format and vector-based drawing is used when displaying it in the various objects. This ensures the best possible reproduction of vector images for applications that are displayed on HiDPI screens.
For performance reasons, the pixel-based proxy image is used when drawing background tiles of grouping objects in the tilestyle_tiled style.

Installation note: The Qt package qt5-qtsvg must already be installed in order to make the corresponding SVG support library available and to ensure that an IDM application can be started.

2.8.5.2 Windows

Microsoft Direct2D is used to ensure the support of graphic formats. The SVG support of Microsoft Direct2D depends on the Microsoft Windows version. As of the Windows 10 Creators Update, support is provided in a limited form.

Notes on the usage of the svg Format as ICON

The SVG format cannot be perfectly converted to an icon, so it is not suitable for displaying as a .picture of the treeview or notepage object. Nor is it suitable as an .icon of the window object. Unsightly edges may appear at the transition between the transparent and drawn areas.

Possible changes to the previous version:
As this graphics package uses different scaling methods than the Windows GDI, patterns (images) that need to be scaled for display may look different than in the previous versions of the IDM. This applies in particular to patterns that are used as window icons or as images in the treeview and notepage objects, as Microsoft Windows requires the icon data type here.
Best practice: Patterns (images) are already stored in the required size.

The SVG support with Microsoft Direct2D

Support depends on the Microsoft Windows version. As of the Windows 10 Creators Update, the following SVG elements and attributes are supported:

Element

Supported attributes

circle

id, style, transform, cx, cy, r

clipPath

id, style, transform, clipPathUnits

defs

id, style, transform

desc

id

ellipse

id, style, transform, cx, cy, rx, ry

g

id, style, transform

image

id, style, transform, x, y, width, height, preserveAspectRatio, xlink:href

line

id, style, transform, x1, y1, x2, y2

linearGradient

id, style, x1, y1, x2, y2, gradientUnits, gradientTransform, spreadMethod, xlink:href

path

id, style, transform, d

polygon

id, style, transform, points

polyline

id, style, transform, points

radialGradient

id, style, cx, cy, r, fx, fy, gradientUnits, gradientTransform, spreadMethod, xlink:href

rect

id, style, transform, x, y, width, height, rx, ry

stop

id, style, offset

svg

id, style, x, y, width, height, viewBox, preserveAspectRatio

title

id

use

id, style, transform, x, y, width, height, xlink:href

SVG presentation attributes

- clip-path

- clip-rule

- color

- display

- fill

- fill-opacity

- fill-rule

- opacity

- overflow

- stop-color

- stop-opacity

- stroke

- stroke-dasharray

- stroke-dashoffset

- stroke-linecap

- stroke-linejoin

- stroke-miterlimit

- stroke-opacity

- stroke-width

- visibility

Supported length units

The user-space length values and percentage length values as well as absolute unit identifiers: px, pt, pc, cm, mm and in.

Image sources

The image element is only supported if its xlink:href attribute is set to a base64-encoded Image.

See also: https://learn.microsoft.com/en-us/windows/win32/direct2d/svg-support