de.enough.polish.ui.backgrounds
Class PulsatingCirclesBackground

java.lang.Object
  extended by de.enough.polish.ui.Background
      extended by de.enough.polish.ui.backgrounds.PulsatingCirclesBackground
All Implemented Interfaces:
Serializable

public class PulsatingCirclesBackground
extends Background

Paints an animated background filled with several ever-growing circles.

Following CSS-attributes are supported:

Copyright Enough Software 2004 - 2009

 history
        17-Jul-2004 - rob creation
 

Author:
Robert Virkus, j2mepolish@enough.de

Field Summary
 
Fields inherited from class de.enough.polish.ui.Background
borderWidth
 
Constructor Summary
PulsatingCirclesBackground(int firstColor, int secondColor, Dimension minDiameter, Dimension maxDiameter, int numberOfCircles, int step)
          Creates a new pulsating-circle background.
PulsatingCirclesBackground(int firstColor, int secondColor, int minDiameter, int maxDiameter, int numberOfCircles, int step)
          Creates a new pulsating-circle background.
 
Method Summary
 void animate(Screen screen, Item parent, long currentTime, ClippingRegion repaintRegion)
          Animates this background.
 void paint(int x, int y, int width, int height, Graphics g)
          Renders the background to the screen.
 void setStyle(Style style)
          Allows backgrounds to be animated using CSS attribute animations.
 
Methods inherited from class de.enough.polish.ui.Background
addRelativeToBackgroundRegion, animate, hideNotify, releaseResources, showNotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PulsatingCirclesBackground

public PulsatingCirclesBackground(int firstColor,
                                  int secondColor,
                                  int minDiameter,
                                  int maxDiameter,
                                  int numberOfCircles,
                                  int step)
Creates a new pulsating-circle background.

Parameters:
firstColor - the first color of circles
secondColor - the second color of circles
minDiameter - the minimum diameter in pixel
maxDiameter - the maximum diameter in pixel
numberOfCircles - the number of circles
step - the number of pixels which should be added in each round to each circle

PulsatingCirclesBackground

public PulsatingCirclesBackground(int firstColor,
                                  int secondColor,
                                  Dimension minDiameter,
                                  Dimension maxDiameter,
                                  int numberOfCircles,
                                  int step)
Creates a new pulsating-circle background.

Parameters:
firstColor - the first color of circles
secondColor - the second color of circles
minDiameter - the minimum diameter
maxDiameter - the maximum diameter
numberOfCircles - the number of circles
step - the number of pixels which should be added in each round to each circle
Method Detail

paint

public void paint(int x,
                  int y,
                  int width,
                  int height,
                  Graphics g)
Renders the background to the screen.

Specified by:
paint in class Background
Parameters:
x - the x position of the background
y - the y position of the background
width - the width of the background
height - the height of the background
g - the Graphics instance for rendering this background

animate

public void animate(Screen screen,
                    Item parent,
                    long currentTime,
                    ClippingRegion repaintRegion)
Description copied from class: Background
Animates this background. Subclasses can override this method to create animations. The default implementation calls the animate() method and adds the full content area to the repaint region.

Overrides:
animate in class Background
Parameters:
screen - the parent screen
parent - the parent item, can be null when the background belongs to a screen
currentTime - the current time in milliseconds
repaintRegion - the repaint area that needs to be updated when this item is animated
See Also:
Item.addRelativeToContentRegion(ClippingRegion, int, int, int, int)

setStyle

public void setStyle(Style style)
Description copied from class: Background
Allows backgrounds to be animated using CSS attribute animations.

Overrides:
setStyle in class Background
Parameters:
style - the style containing typically only one element