BitmapGauge
The BitmapGauge displays a statically loaded bitmap on the page. The bitmap is loaded onto the background layer, and so other controls will appear on top of it. If another bitmap is placed on top, their drawing order is based on their position within the page description, so the bitmap appearing first in the gauge list will be drawn first.
Example:
<gauge>
<name>vehicleimage</name>
<type>BitmapGauge</type>
<x>424</x>
<y>80</y>
<xscale>0.7</xscale>
<yscale>0.7</yscale>
<background>tpmscar.bmp</background>
<visible>1</visible>
</gauge>
Attribute | Mandatory? | Value Type | Description |
---|---|---|---|
x | Yes | Integer | The x coordinate of the bottom left of the gauge |
y | Yes | Integer | The y coordinate of the bottom left of the gauge |
background | yes | String | The filename of the bitmap file to load. Bitmaps must be 32bit, and stored the right way up in the file (old standards had them upside down) |
visible | No | Integer 1 or 0 | Allows the gauge to be shown or hidden by default |
xscale | No | Floating Point | Optionally scale the bitmap horizontally. Values less than 1 make it smaller, greater than 1 larger |
yscale | No | Floating Point | Optionally scale the bitmap vertically. Values less than 1 make it smaller, greater than 1 larger |
alwaysontop | No | Integer 1 or 0 | Default 0. By default, bitmaps are drawn on a background layer so that they don’t have to be frequently redrawn. By contrast things like needles and values are drawn on a layer above, meaning they don’t affect the images beneath. Sometimes it is necessary to get a bitmap to appear on top of a gauge (e.g. a scale on a fuel gauge). To achieve this, the bitmap is drawn on the same layer as the gauge, and given a ‘z order’ higher so that it is drawn afterwards. Note the downside of this is that the bitmap has to be drawn for every frame, so the number of always on top bitmaps can affect display performance. A small number of relatively small ones will be un-noticeable. |
rotation | No | Integer | Specifies a rotation angle for the bitmap. |
Sometimes monitors do not have an exact 1:1 ratio between pixel height and width. In such cases, you can play with the scaling to make round things round. Alternatively you might just want a bigger version of a bitmap somewhere. The scaling is performed by the GPU so it actually does a pretty good job of avoiding pixelation that occurs when a simple scaling is applied to an image, until the scaling gets pretty large (it will get blurry at that point). A scale of 1.5 will be completely unnoticeable to most people.
Some gauges have their own background image in their configuration, but sometimes you simply want to add an image alongside some other related controls. For example, I have a low fuel warning composite page which contains a yellow fuel pump warning image. This is implemented with a BitmapGauge.