This element specifies an image file and allows to name regions within that file.
<images file="filename.png">
....
</images>
| attribute |
required |
description |
| file |
yes |
specifies the URL for the image file - the default renderer only supports PNG. |
| format |
no |
how to load that image:
- COLOR
- ALPHA (only applicable to gray scale images)
|
| filter |
no |
how to filter that image on resizing:
|
Elements on the first child level are named (eg they need a name attribute). Elements below the first
level can't have names. Images and cursors have an independent name space.
The following predefined elements exist:
| name |
type |
description |
| none |
image |
A 0x0 pixel image object. Can be used to make holes in a grid. |
| os-default |
cursor |
The OS default cursor. |
The following child elements are supported:
<area name="name" xywh="x,y,width,height"/>
Creates a image which uses the specified area of the enclosing image file.
The area can optionally be split horizontally (by specifying splitx), vertically
(by specifying splity) or both to create a 3x1, 1x3 or 3x3 grid with the
following weights: 0,1,0. This results in the center column and center row to consume any additional width / height.
The splitx and splity
specify 2 split points on their respective axis. The first row/column starts at 0,0 relative to the specified x/y coordinate,
and ends at the first split point (exclusive). The 2nd column/row starts at the first split point (inclusive) and end at the
2nd split point (exclusive). The last column/row starts at the 2nd split point (inclusive) and ends at the end of this area
(width/height). If both split points are identical then the center column/row is not present.
| attribute |
required |
description |
| name |
yes (if at top level) |
the name of the image |
| xywh |
yes |
Specified the area in the image file in the following order: x, y, width and height.
The position starts with 0 in the top left corner of the image file.
Negative width/height cause the area to be flipped.
A special value is xywh="*" which will use the complete image file
|
| tiled |
no |
If "true" then the image is repeat in both axis and not scaled. This will disable repeatX & repeatY and is the preferred approch. |
| rot |
no |
Clock wise rotation of the area by 0°, 90°, 180° or 270°. |
| splitx |
no |
2 split points seprated by a comma. The split points are relative to the area defined by xywh.
Each split point can optionally be prefixed by either 'L' (default) or 'R' to make it relative to the left or right edge.
Example: splitx="L3,R5" causes the first split point be 3 px from the left edge, and the second 5 px from the right edge.
|
| splity |
no |
2 split points seprated by a comma. The split points are relative to the area defined by xywh.
Each split point can optionally be prefixed by either 'T' (default) or 'B' to make it relative to the top or bottom edge.
Example: splity="T3,B5" causes the first split point be 3 px from the top edge, and the second 5 px from the bottom edge. |
| nocenter |
no |
If true then the center element in the grid is removed. Can be used to create a border/frame. This is faster then drawing a transparent image. |
<alias name="name" ref="ref-name"/>
References another image and allows modification using the standard attributes.
| attribute |
required |
description |
| name |
yes |
the name of the image |
| ref |
yes |
the referenced image |
<grid weightsX="weights" weightsY="weights"/>
A grid places it's children in a grid in the order left to right, top to bottom. The width of the grid is
the sum of the maximal width of each column. Similar for the height.
The number of child images must be equal to the product of the number of weights in weightsX
and weightsY.
When a grid is scaled the extra width is distributed based on the weights. Asuuming the following weights:
weightsX="0,1,2" then the 1st column will get no extra width, the 2nd
column will receive 1/3 and the last column 2/3 of the extra width. Every weight must be >= 0 and the sum of all
weights must be >= 1.
| attribute |
required |
description |
| weightsX |
yes |
A comma separated list of weights. The number of weights define the number of columns in the grid. |
| weightsY |
yes |
A comma separated list of weights. The number of weights define the number of rows in the grid. |
<select/>
A select element will draw only one of it's children based on their conditions. The conditions of the child elements are
evaluated in the order in which they are specified in the theme XML file. The first element with a matching condition
is selected and rendered. The size of the first element will be used to determine the size of this select element.
The last child element is the only one which can omit it's condition, t will act as a default (or as the else in
a if/elseif/elsif/else chain)
<composed/>
All child elements are rendered on top of each other starting with the first element which will also be used to determine
the size of this composed element.
- animation
- cursor
The following attributes are support on nearly any child element:
| attribute |
required |
description |
| border |
no |
Specifies a border which can be used in a theme. It is accessible as property. All values must be positive.
| format |
description |
| "T,L,B,R" |
4 values for Top, Left, Bottom and Right |
| "H,V" |
2 values for Horizontal and Vertical. Identical to "V,H,V,H" |
| "B" |
1 value for Border. Identical to "B,B,B,B" or "B,B" |
|
| inset |
no |
The inset is added to the size of the image but not considered while rendering.
This allows for effects like glow or shadows. The inset can also be negative.
It can be specified in the same way as the border. |
| sizeOverwriteH |
no |
Changes the size of image. This can be used to force scaling. |
| sizeOverwriteV |
no |
Changes the size of image. This can be used to force scaling. |
| tint |
no |
Optional tinting of that image. The color is multiplied with the image.
See de.matthiasmann.twl.Color.parseColor |
| center |
no |
if "true" then the image is not scaled up if it's drawn onto a arger area but drawn centered instead. |
| repeatX |
no |
if "true" then the image is repeated and stretched as often as needed to cover the requested area but no parts are cut off.
The number of copies is determined by max(1, floor(targetSize / imageSize)). |
| repeatY |
no |
similar to repeatX |
| if |
no |
Specifies a condition which must evaluate to true in order to render this image. |
| unless |
no |
Specifies a condition which must evaluate to false in order to render this image. |