org.diamondspin
Class DSShadowManager

java.lang.Object
  extended by org.diamondspin.DSShadowManager
All Implemented Interfaces:
Serializable

public class DSShadowManager
extends Object
implements Serializable

from Romain Guy's code.

See Also:
Serialized Form

Field Summary
protected  DSFrame element
           
protected  double shadowAdditionnalAngle
           
protected  Shape shadowClip
           
protected  ConvolveOp shadowConvolveOp
           
protected  int shadowDistance
           
protected  int shadowDistance_x
           
protected  int shadowDistance_y
           
protected  boolean shadowHighQuality
           
protected  BufferedImage shadowImage
           
protected  float shadowOpacity
           
protected  int shadowSize
           
protected  double shadowSourceAlpha
           
protected  double shadowSourceD
           
protected  Image sourceImage
           
 
Constructor Summary
DSShadowManager(DSFrame frame)
          Constructs a DSShadowManager
 
Method Summary
protected  void applyShadow(BufferedImage image, Color shadowColor_arg)
           
protected  void computeShadowPosition()
          compute the angle the the gap between document and shadow
protected  BufferedImage createShadowMask(BufferedImage image, Color shadowColor)
           
protected  ConvolveOp getLinearBlurOp(int size)
           
 double getShadowAdditionnalAngle()
          return an option of the shadow called AdditionnalAngle which is added to the computed angle
 Shape getShadowClip()
          set an optionql clip to the shqdow (the region on which the shadow can be displayed)
 int getShadowDistance()
           
 BufferedImage getShadowImage()
          return the last shadow image produced
 Point getShadowPosition()
          return shadow offset
 int getShadowSize()
          return how far the shadow get blurred
 boolean isShadowHighQuality()
          tells what quality is used to display the shadow.
 boolean isShadowSource()
          return if the shadow is displayed against a light source or not
 void paintShadow(Graphics2D g)
          paint the shadow with the given graphics (may be clipped)
protected  BufferedImage prepareImage(Image image)
           
 void setShadowAdditionnalAngle(double shadowAdditionnalAngle)
          set an option of the shadow called AdditionnalAngle which is added to the computed angle
 void setShadowClip(Shape shadowClip)
          set an optionql clip to the shqdow (the region on which the shadow can be displayed)
 void setShadowDistance(int shadowDistance)
           
 void setShadowHighQuality(boolean shadowHighQuality)
          change what quality is used to display the shadow.
 void setShadowSource(double ssAlpha, double ssD)
          set the light source position used to find the angle of the light
 void setSourceImage(Image image)
           
 void updateDropShadow(Color color)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

element

protected DSFrame element

shadowHighQuality

protected boolean shadowHighQuality

shadowImage

protected transient BufferedImage shadowImage

sourceImage

protected transient Image sourceImage

shadowAdditionnalAngle

protected double shadowAdditionnalAngle

shadowSourceAlpha

protected double shadowSourceAlpha

shadowSourceD

protected double shadowSourceD

shadowSize

protected int shadowSize

shadowOpacity

protected float shadowOpacity

shadowClip

protected Shape shadowClip

shadowDistance_x

protected int shadowDistance_x

shadowDistance_y

protected int shadowDistance_y

shadowDistance

protected int shadowDistance

shadowConvolveOp

protected transient ConvolveOp shadowConvolveOp
Constructor Detail

DSShadowManager

public DSShadowManager(DSFrame frame)
Constructs a DSShadowManager

Parameters:
frame -
Method Detail

applyShadow

protected void applyShadow(BufferedImage image,
                           Color shadowColor_arg)

computeShadowPosition

protected void computeShadowPosition()
compute the angle the the gap between document and shadow


getShadowPosition

public Point getShadowPosition()
return shadow offset


getShadowSize

public int getShadowSize()
return how far the shadow get blurred


createShadowMask

protected BufferedImage createShadowMask(BufferedImage image,
                                         Color shadowColor)

getShadowImage

public BufferedImage getShadowImage()
return the last shadow image produced


paintShadow

public void paintShadow(Graphics2D g)
paint the shadow with the given graphics (may be clipped)

Parameters:
g - the graphics object to paint with

prepareImage

protected BufferedImage prepareImage(Image image)

updateDropShadow

public void updateDropShadow(Color color)

setSourceImage

public void setSourceImage(Image image)

getLinearBlurOp

protected final ConvolveOp getLinearBlurOp(int size)

getShadowAdditionnalAngle

public double getShadowAdditionnalAngle()
return an option of the shadow called AdditionnalAngle which is added to the computed angle

Returns:
AdditionnalAngle

isShadowHighQuality

public boolean isShadowHighQuality()
tells what quality is used to display the shadow. 2 qualities are available.

Returns:
true is hightest quality is used

isShadowSource

public boolean isShadowSource()
return if the shadow is displayed against a light source or not

Returns:
if the shadow has a specified source

getShadowClip

public Shape getShadowClip()
set an optionql clip to the shqdow (the region on which the shadow can be displayed)

Returns:
the clip as a shape

setShadowClip

public void setShadowClip(Shape shadowClip)
set an optionql clip to the shqdow (the region on which the shadow can be displayed)

Parameters:
shadowClip - the clip as a shape

setShadowAdditionnalAngle

public void setShadowAdditionnalAngle(double shadowAdditionnalAngle)
set an option of the shadow called AdditionnalAngle which is added to the computed angle

Parameters:
shadowAdditionnalAngle -

setShadowHighQuality

public void setShadowHighQuality(boolean shadowHighQuality)
change what quality is used to display the shadow. 2 qualities are available.

Parameters:
shadowHighQuality - true is hightest quality is used

setShadowSource

public void setShadowSource(double ssAlpha,
                            double ssD)
set the light source position used to find the angle of the light

Parameters:
ssAlpha - angle of the source in polar coordinate system
ssD - distance of the source in polar coordinate system

getShadowDistance

public int getShadowDistance()
Returns:
the shadowDistance

setShadowDistance

public void setShadowDistance(int shadowDistance)
Parameters:
shadowDistance - the shadowDistance to set


Copyright © 2006 Frederic Vernier(LIMSI) Chia Shen(MERL) Guillaume Besacier(LIMSI). All Rights Reserved.