A wide variety of effects are generated with HMatte that are part of the component hierarchy. The root of the hierarchy is an instance of HScene , leaf nodes are instances of HComponent, and intermediate nodes are instances of HContainer . Components within a container are ordered from back to front. An example is shown in Figure 8.17, where c3, a container, is the backmost component and c1 the frontmost. With the HMatte interface, the scene hierarchy can be modified by the inclusion of mattes (additional alpha sources), potentially for each member (see Figure 8.17 for an example composition). Figure 8.17. An example of component mattes.
The mattes influence the rendering of the scene, and their operation can be visualized using a 2fiD or a layering model. Where pixels in a component already have an alpha value (e.g., from a PNG image), the alpha value from the component and the alpha value from the matte are multiplied together to obtain the actual alpha value to be used for that pixel. A great variety of effects (e.g., wipes and fades) can be performed using matte animations. Matte animations are sequences of mattes where the active element is changed over time (recall Figure 8.13). Matte animations can be combined with other techniques, such as component movement, to produce additional effects. 8.12.1 HFlatEffectMatteThe HFlatEffectMatte class represents a matte that is constant over space but varies over time. It is specified as a sequence of floating-point values in the range 0.0 to 1.0 where:
The data for any HFlatEffectMatte may be changed on the fly using the setMatteData() method. However, some implementations may be asynchronously referencing their content (i.e., through a separate implementation-specific animation thread). Therefore the following restrictions apply to the setMatteData() method:
8.12.2 HFlatMatteThe HFlatMatte class represents a matte that is constant over space and time. It is specified as a floating-point value in the range 0.0 to 1.0. 8.12.3 HImageMatteThe HImageMatte class represents a matte that varies over space but is constant over time, it can be specified by an image mask (a single channel image) where the pixels indicate matte transparency. 8.12.4 HImageEffectMatteThe HImageEffectMatte class represents a matte that varies over both space and time, it is specified as a sequence of image masks. The data for any HImageEffectMatte may be changed on the fly using the setMatteData() method. However, some implementations could be asynchronously referencing their content (i.e., through a separate implementation-specific animation thread). Therefore the following restrictions apply to the setMatteData() method:
8.12.5 Matte Sizes and OffsetsWhen an HImageMatte or HImageEffectMatte is assigned to a component, the associated image (or images) is by default aligned with the component so that their origins, the pixel at (0,0), coincide. The offset of the matte with respect to the component can be altered using the setOffset() method of HImageMatte and HImageEffectMatte . Regions of the component outside the matte (resulting from either a matte being smaller than the component or from shifting the matte) are not matted. 8.12.6 Matte of Component GroupsA container is either grouped or ungrouped. When a container is ungrouped , its matte only influences the appearance of those regions of the container not covered by members of the container (i.e., exposed regions of the container's background). When a container is grouped, its matte influences the appearance of its background and all members of the container. For example, grouping a container and setting its matte to indicate 50% transparency should fade its background and all members of the container. If it is ungrouped only the background should fade. |