Java DTV API 1.3
18-Nov-2009

com.sun.dtv.ui
Class StaticMatte

java.lang.Object
  extended by com.sun.dtv.ui.StaticMatte
All Implemented Interfaces:
Matte

public class StaticMatte
extends Object
implements Matte

This class represents a non-animated matte, i.e. a matte not changing over time. A static mask can have a single opacity value, being constant for the whole matte, or alternatively an image mask, where the pixel values determine the matte transparency for every pixel.

See Also:
Matte

Constructor Summary
StaticMatte()
           
 
Method Summary
 Image getImageOpacity()
          Gets the opacity value image for this matte.
 Dimension getOffset()
          Obtains the offset the image matte has relatively to the top left corner of the component's area.
 float getOpacity()
          Gets the opacity value for this matte.
 int getOpacityAsInt()
          Gets the opacity value for this matte as integer.
 boolean hasOpacityImage()
          Obtains whether an opacity image is assigned to this matte.
 void setOffset(Dimension d)
          Determines the offset for the opacity image to be assigned with this matte.
 void setOpacity(float opacity)
          Sets the opacity of the matte to a single value, valid for all pixels.
 void setOpacity(Image image)
          Sets the opacity of the matte.
 void setOpacity(int opacity)
          Sets the opacity of the matte to a single value, valid for all pixels.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticMatte

public StaticMatte()
Method Detail

setOpacity

public void setOpacity(int opacity)
Sets the opacity of the matte to a single value, valid for all pixels. A previously assigned opacity value or opacity image will be overwritten by the unitary opacity caused by a call to this method. This method has exactly the same aim as setOpacity(float), where a call to setOpacity(i) has the same effect as a call to setOpacity((float)(i/255)).

Parameters:
opacity - the value for the opacity, which has to be an integer value between 0 and 255, where 0 stands for full transparency, and 255 for full opacity. Values below 0 will be interpreted as 0 (fully transparent), values greater 255 as 255 (fully opaque).
See Also:
getOpacityAsInt(), setOpacity(float)

setOpacity

public void setOpacity(float opacity)
Sets the opacity of the matte to a single value, valid for all pixels. A previously assigned opacity value or opacity image will be overwritten by the unitary opacity caused by a call to this method. This method has exactly the same aim as setOpacity(int), where a call to setOpacity(f) has the same effect as a call to setOpacity((int)(f * 255)).

Parameters:
opacity - the value for the opacity, which has to be a floating point value between 0.0 and 1.0, where 0.0 stands for full transparency, and 1.0 for full opacity. Values below 0.0 will be interpreted as 0.0 (fully transparent), values greater 1.0 as 1.0 (fully opaque).
See Also:
getOpacity(), setOpacity(int)

setOpacity

public void setOpacity(Image image)
Sets the opacity of the matte. The provided image may be smaller than the affected component, in this case the remaining area is shown as it would be covered by a matte with unitary opacity of 1.0 (even if this image overwrites a previously set unitary opacity with a different value). By default the images matte is aligned with the top left corner of the components area. This can be changed using the setOffset() method. A previously assigned opacity value or opacity image will be overwritten by the opacity image provided by a call to this method.

Parameters:
image - the value for the opacity, which has to be an image, containing pixel values between 0.0 and 1.0. 0.0 stands for full transparency, and 1.0 for full opacity. Values below 0.0 will be interpreted as 0.0 (fully transparent), values greater 1.0 as 1.0 (fully opaque).
See Also:
getImageOpacity(), getOpacity()

getOpacity

public float getOpacity()
Gets the opacity value for this matte. If the matte has an opacity image assigned, always 1.0 is returned. In order to find out whether this really means an unitary opacity of 1.0, or rather an image opacity hasOpacityImage() has to be called.

Returns:
the opacity value for this matte. This is always a floating point value in the range between 0.0 and 1.0, where 0.0 stands for full transparency, and 1.0 for full opacity. 1.0 could also mean that there is an opacity image assigned to this matte.
See Also:
setOpacity(float)

getOpacityAsInt

public int getOpacityAsInt()
Gets the opacity value for this matte as integer. If the matte has an opacity image assigned, always 255 is returned. In order to find out whether this really means an unitary opacity of 255, or rather an image opacity hasOpacityImage() has to be called.

Returns:
the opacity value for this matte. This is always an integer value in the range between 0 and 255, where 0 stands for full transparency, and 255 for full opacity. 255 could also mean that there is an opacity image assigned to this matte.
See Also:
setOpacity(int), getOpacity()

getImageOpacity

public Image getImageOpacity()
Gets the opacity value image for this matte.

Returns:
the opacity value for this matte in form of an image, containing pixel values between 0.0 and 1.0. 0.0 stands for full transparency, and 1.0 for full opacity. If null is returned, there is an unitary opacity value assigned to the matte at the moment.
See Also:
setOpacity(com.sun.dtv.lwuit.Image)

setOffset

public void setOffset(Dimension d)
Determines the offset for the opacity image to be assigned with this matte. While per default the images matte is aligned with the top left corner of the components area, this can be changed using this method. If there is not an opacity image assigned to this matte, a call to this method has no effect.

Parameters:
d - a Dimension object determining the offset toward the top left corner of the component's area

if the parameter is null, no offset will be determined, and a previously assigned offset will be removed

See Also:
getOffset()

getOffset

public Dimension getOffset()
Obtains the offset the image matte has relatively to the top left corner of the component's area. In case that there is no opacity image assigned to this matte, null is returned.

Returns:
the offset in form of a Dimension object or null (in this case there is either no offset or it is an unitary opacity value assigned to the matte rather than an image)
See Also:
setOffset(com.sun.dtv.lwuit.geom.Dimension)

hasOpacityImage

public boolean hasOpacityImage()
Obtains whether an opacity image is assigned to this matte. Returns true if this is the case, false otherwise.

Returns:
true if an opacity image is assigned to this matte, false if an unitary opacity value is assigned instead.

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.