<layer>
Description
One or more layer nodes make up an image. An image is referenced by either a panoelement or uielement and shown on screen.
layer images can be built from from bitmap files or text with basic HTML markup. layers can contain full 8 bit alpha-channels, either directly from an imagefile (eg 32 bit PNG), or by loading a separate grayscale imagefile as alpha.
Multiple layers can be combined to easily add mouseover effects etc.
Syntax
<tour> <scene> ... <image id="someImage" /> <layer class="base" type="bitmap" src="file.jpg" alphatype="bitmap" alphasrc="alpha.jpg" /> <layer class="hover" type="text" src="text.html" /> <layer class="press" type="bitmap" src="file.jpg" alphatype="text"> <![CDATA[Some text <i>with</i> basic <b>markup</b>]]> </layer> ... </image> ... </scene> </tour>
Attributes
-
class
Specifies the class of layer.Values:-
base (default)
This is the default appearance of the image. If no base layer is specified, the image will look fully transparent, but can still have a specified hitarea (for irregularly shaped hotspots) or a mouseover effect. -
hover
If specified, this layer is shown when the mouse hovers over the element referencing the image. -
press
If specified, this layer is shown when the mouse is pressed down over the element referencing the image. -
disabled
If specified, this layer is shown when the element referencing the image is disabled. -
hitarea
1 bit image mask constraining mouse over effects and clicking to a specific area. If no hitarea is specified, the whole element is active. The hitarea image can be a low resolution (scaled down) image to conserve bandwidth and system memory.
hitarea layers are implemented in SPi-V 1.4 and newer. -
preview
An alternative image that is shown while the other resources of the image are loaded. Once the other resources have been loaded and the image element has been created, this layer will be destroyed.
-
-
type
Specifies the type of image to use for this layer.Values:-
bitmap
Loads the layer from an image (JPG, PNG, GIF, BMP, PICT or SWF)
If an SWF file is specified, only the first frame will show. -
text
Creates an image from text, either from a file or from the child elements of the layer node. The text may contain simple markup in HTML format (<b>, <i>, <hr> and <font> nodes are supported).
Note that inline markup needs to be padded with <![CDATA[ and ]]> to conform with XML standards. A referenced HTML document should at least contain a html and body tag, or SPi-V will use the file as plain text.
The text is rendered on a canvas that has a width that conforms to the width of the image node.' -
matte
Fills the rgb-part of the layer with a solid color, specified by the color attribute. -
gradient
Fills the rgb-part of the layer with a gradient, specified by the color and endcolor attributes. The direction can be set in degrees, or it can be set to 'radial'.
-
-
src
Source for bitmap or text image. -
color
Color value for layers with type="matte" or type="gradient".hex rgb colors (eg: FFFFFF for white) -
endcolor
Color value for layers with type="gradient".hex rgb colors (eg: FFFFFF for white) -
direction
Direction of gradient for layers with type="gradient".0-360 or "radial" -
alphatype
Specifies the type of the alpha-channel for this layer.Values: same as type, but adds the following:-
auto (default)
Uses the embedded alpha channel if available, or none if one is not embedded in the image. -
bitmap
Use a grayscale copy of the image referenced with alphasrc as an alphachannel. -
text
Use a grayscale copy of the inlined or referenced text as an alphachannel. -
matte
Fills the alphachannel of the layer with a solid color, specified by the alphacolor attribute. -
gradient
Fills the alphachannel of the layer with a gradient, specified by the alphacolor and alphaendcolor attributes. The direction can be set in degrees, or it can be set to 'radial'. -
none
Uses no alpha-channel, even if one is embedded in the image (fully opaque).
-
-
alphasrc
Source for bitmap or text alpha image. Ignored for auto and none alpha -
alphacolor
Color value for layers with alphatype="matte" or type="gradient".hex rgb colors (eg: FFFFFF for white) -
alphaendcolor
Color value for layers with alphatype="gradient".hex rgb colors (eg: FFFFFF for white) -
alphadirection
Direction of gradient for layers with alphatype="gradient".0-360 or "radial" -
depth
Specifies the bit depth to use for textures of this layer. If you specifiy high, SPi-V will create 16 bit textures (rgba5650 or rgba4444 depending on alpha channel) instead of 24/32 bit (rgba8880 or rgba8888 depending on alpha channel).
Often, the difference between high or true color is only very minor, while 16 bit textures have 33% lower memory requirements. The difference between high and true color textures is most noticable in blue skies."high" or "true" (default) -
dynamic
If dynamic is set to true, the layer can be updated on the fly (eg replacing its text or color attributes).
Marking a layer dynamic will cause an extra copy of the created image to remain in memory to speed up changes. Layers are normally not marked dynamic to conserve memory."true" or "false" (default)
Children
- CHARDATA
History
- 22-Mar-07: Gradient layers
- 07-Jan-07: Hitarea implemented in SPi-V 1.4
- 05-Jan-05: Added preview class
- 27-Nov-05: Added dynamic attribute
- 20-Nov-05: Added matte type and color attribute
- 14-Oct-05: Added bitmap and text alphatypes, preview layer
- 02-Dec-04: Fixed description of inline and referenced text
- 10-Oct-04: Removed ADR references
- 20-Apr-04: Initial version
fieldOfView | SPi-V dev
disabled typo
TYPO:
If specified, this layer is shown the element referencing the image is disabled.
If specified, this layer is shown when the element referencing the image is disabled.
Re: disabled typo
Thanks
Re: <layer>
Aldo,
please correct "alpahtype" to "alphatype" in this documentation.
Karol
Re: <layer>
Thanks