genode/repos/gems/src/app/backdrop/README

85 lines
3.0 KiB
Plaintext

This directory contains a backdrop program for Nitpicker. It composes a
background image out of a solid color and an arbitrary number of PNG image
files. It is able to dynamically respond to configuration changes as well
as a changed screen size.
Configuration
~~~~~~~~~~~~~
A typical example configuration looks as follows.
! <config>
! <libc>
! <vfs>
! <rom name="genode_logo.png"/>
! <rom name="grid.png"/>
! </vfs>
! </libc>
! <fill color="#224433" />
! <image png="grid.png" tiled="yes" alpha="200" />
! <image png="genode_logo.png" anchor="bottom_right" alpha="150"
! xpos="-20" ypos="-20" />
! </config>
Backdrop obtains PNG images file from the libc VFS. In the example, the VFS is
configured to present two ROM modules as files in the root directory. Those
files are then referred to by the subsequent '<image>' nodes.
The final background image is generated by applying a number of graphical
operations in the order of their appearance in the configuration. The
'<fill>' operation fills the entire screen with the solid color as
specified by the 'color' attribute. The default color is black.
The '<image>' operation loads a PNG image from the VFS, scales and positions
it according to the '<image>' attributes, and paints it either as tiles
covering the whole screen or as a single image. The supported attributes are
:tiled (default "no"):
If set to "yes", the image will be used as tile to cover the entire screen.
:alpha (default is opaque):
A number in the range of 0..255 that specifies the opacity of the image
when painted.
:anchor (default "center"):
Defines the screen position that is used as a basis for positioning the
image. Supported values are "top_left", "top", "top_right", "left",
"center", "right", "bottom_left", "bottom", and "bottom_right".
In the example above, the _genode_logo.png_ image will be positioned
in the bottom-right corner of the screen.
:xpos and ypos (default "0"):
The 'xpos' and 'ypos' attributes define the position of the image relative
to the anchor. It is meant for allowing the pixel-perfect fine tuning of
positions.
:scale (no scaling by default):
The 'attribute' specifies the way of how the image should be adjusted to
the screen size by the means of proportional scaling. Possible values are
"fit" and "zoom". The former scales the image such that the entire image
is visible on screen. The latter makes sure that the entire screen is
filled with (a viewport of) the image. When using the "zoom" value, the
viewport can be defined via the 'anchor', 'xpos', and 'ypos' attributes.
Customized size
---------------
By default, the backdrop adjusts itself to the physical screen size as
reported by the nitpicker GUI server. This default size can be overridden by
specifying a fixed size as '<config>' attributes 'width' and 'height'.
Example
~~~~~~~
Please refer to the _gems/run/wm.run_ script for a practical example of
using the backdrop.