PulpCore

pulpcore.image.filter
Class Glow

java.lang.Object
  extended by pulpcore.image.filter.Filter
      extended by pulpcore.image.filter.Blur
          extended by pulpcore.image.filter.Glow

public final class Glow
extends Blur

A Glow filter. This Glow filter uses 3 parameters : - amount : the amount of glow to be used. float value that could go from 0 to up to 2 depending on the effect you're expecting to have. Default value is 0.5; - radius : the radius of glow to be used. Default value is 3. - quality : the rendering quality of the filter. A better quality needs more time to render. Default value is 3. In some cases values below 3 should be OK (quality 1 is very poor though). Quality value more than 3 won't really affect the rendering since this 3 fast blur are somehow equivalent to a real Gaussian Blur. Example of use below that mimic the PS3 menu selection : public void load() { add(new FilledSprite(Colors.BLACK)); Glow glow = new Glow(0.8, 5); Timeline timeline = new Timeline(); timeline.animate(glow.amount, 0.2, 0.8, 500, null, 0); timeline.animate(glow.amount, 0.8, 0.2, 500, null, 500); timeline.loopForever(); addTimeline(timeline); CoreFont font = CoreFont.getSystemFont().tint(0xff80ff80); Label lb = new Label(font, "An example of glowing text...", 20, 20); lb.setFilter(glow); add(lb); }

Author:
Florent Dupont

Field Summary
 Fixed amount
          The amount of glow to be used, typically from 0 to 8.
 
Fields inherited from class pulpcore.image.filter.Blur
quality, radius
 
Constructor Summary
Glow()
          Creates a Glow filter with a radius of 3, a quality of 3 and amount of 0,5.
Glow(double amount)
          Creates a Glow filter with the specified amount, a radius of 3 and a quality of 3.
Glow(double amount, int radius)
          Creates a Glow filter with the specified amount and radius.
Glow(double amount, int radius, int quality)
          Creates a Glow filter with the specified amount, radius and quality.
 
Method Summary
 Filter copy()
          Creates a copy of the Filter for another Sprite to use.
protected  void filter(CoreImage src, CoreImage dst)
          Performs this filter on the input image onto the specified output image.
 void update(int elapsedTime)
          Updates the filter.
 
Methods inherited from class pulpcore.image.filter.Blur
filter, getClampEdges, getHeight, getWidth, getX, getY, isOpaque, setClampEdges
 
Methods inherited from class pulpcore.image.filter.Filter
filter, getInput, getOutput, isDirty, setDirty, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amount

public final Fixed amount
The amount of glow to be used, typically from 0 to 8. The default value is 0.5.

Constructor Detail

Glow

public Glow()
Creates a Glow filter with a radius of 3, a quality of 3 and amount of 0,5.


Glow

public Glow(double amount)
Creates a Glow filter with the specified amount, a radius of 3 and a quality of 3.


Glow

public Glow(double amount,
            int radius)
Creates a Glow filter with the specified amount and radius. Default quality of 3.


Glow

public Glow(double amount,
            int radius,
            int quality)
Creates a Glow filter with the specified amount, radius and quality.

Method Detail

copy

public Filter copy()
Description copied from class: Filter
Creates a copy of the Filter for another Sprite to use. The input filter is also copied. The properties of the copy, if any, will be bound to the original filter's properties.

This method is used by the Sprite class. Most apps will not need to call this method.

Subclasses should bind all properties of the cloned object using bindWithInverse(). For example, for the HSBAdjust filter:

        public Filter copy() {
            HSBAdjust copy = new HSBAdjust();
            copy.hue.bindWithInverse(hue);
            copy.brightness.bindWithInverse(brightness);
            copy.saturation.bindWithInverse(saturation);
            return copy;
        }
        

Overrides:
copy in class Blur

update

public void update(int elapsedTime)
Description copied from class: Filter
Updates the filter. The default method does nothing.

Overrides:
update in class Blur

filter

protected void filter(CoreImage src,
                      CoreImage dst)
Description copied from class: Filter
Performs this filter on the input image onto the specified output image.

This method is called from Filter.getOutput() if Filter.isDirty() returns true. The output image will be the same dimensions as (Filter.getWidth() x Filter.getHeight(). Implementors must ensure that every pixel in output is drawn.

Overrides:
filter in class Blur

PulpCore

Copyright © 2007-2009 Interactive Pulp, LLC.