net.ctdp.rfdynhud.widgets.base.widget
Class WidgetBackground

java.lang.Object
  extended by net.ctdp.rfdynhud.widgets.base.widget.WidgetBackground

public class WidgetBackground
extends java.lang.Object

This class encapsulates a Widget's effective background. This can be a simple color or a scaled image.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
WidgetBackground(Widget widget, BackgroundProperty property)
           
 
Method Summary
 java.awt.Color getColor()
          Gets the Color from this WidgetBackground.
 int getHeight()
           
 TextureImage2D getMergedTexture()
          Gets the merged background, composed of the backgrounds of this (possibly assembled) Widget and the parts of this Widget.
 float getScaleX()
          Gets the factor, by which the background image has been scaled to fit the area.
 float getScaleY()
          Gets the factor, by which the background image has been scaled to fit the area.
 TextureImage2D getTexture()
          Gets the TextureImage2D from this BackgroundProperty.
 BackgroundProperty.BackgroundType getType()
          Gets the current type of this background.
 int getWidth()
           
 boolean valueEquals(java.awt.Color color)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WidgetBackground

public WidgetBackground(Widget widget,
                        BackgroundProperty property)
Method Detail

getType

public final BackgroundProperty.BackgroundType getType()
Gets the current type of this background.

Returns:
the current type of this background.

getColor

public final java.awt.Color getColor()
Gets the Color from this WidgetBackground. The result is only valid, if the BackgroundProperty.BackgroundType (getType()) is BackgroundProperty.BackgroundType.COLOR.

Returns:
the Color from this WidgetBackground.

getWidth

public final int getWidth()

getHeight

public final int getHeight()

getTexture

public final TextureImage2D getTexture()
Gets the TextureImage2D from this BackgroundProperty. The result is only valid, if the BackgroundProperty.BackgroundType (getType()) is BackgroundProperty.BackgroundType.IMAGE.

Returns:
the TextureImage2D from this BackgroundProperty.

getMergedTexture

public final TextureImage2D getMergedTexture()
Gets the merged background, composed of the backgrounds of this (possibly assembled) Widget and the parts of this Widget. If this Widget is not an AbstractAssembledWidget and has a background color (no image) and doesn't override the Widget.drawBackground(net.ctdp.rfdynhud.gamedata.LiveGameData, boolean, TextureImage2D, int, int, int, int, boolean) method, this method returns null.

Returns:
the marged background texture or null.

getScaleX

public final float getScaleX()
Gets the factor, by which the background image has been scaled to fit the area. Returns 1.0, if a background color is used.

Returns:
the factor, by which the background image has been scaled to fit the area.

getScaleY

public final float getScaleY()
Gets the factor, by which the background image has been scaled to fit the area. Returns 1.0, if a background color is used.

Returns:
the factor, by which the background image has been scaled to fit the area.

valueEquals

public final boolean valueEquals(java.awt.Color color)