com.swfm.mica.renderers
Class MiCustomGradientRenderer

java.lang.Object
  extended bycom.swfm.mica.renderers.MiDeviceRenderer
      extended bycom.swfm.mica.renderers.MiCustomGradientRenderer
All Implemented Interfaces:
MiiAttributeTypes, MiiDeviceRenderer, MiiTypes

public class MiCustomGradientRenderer
extends com.swfm.mica.renderers.MiDeviceRenderer
implements MiiTypes, MiiAttributeTypes

Constructs a renderer which generates a background gradient image effect when assigned to one or more parts using their setBackgroundRenderer() method.

Version:
%I% %G%
Author:
Michael L. Davis

Field Summary
     
Constructor Summary
MiCustomGradientRenderer()
          Constructs a renderer which generates a background gradient image effect when assigned to one or more parts using their setBackgroundRenderer() method.
 
Method Summary
 java.awt.Image createImage(int width, int height)
           
 boolean drawLine(java.awt.Graphics g, MiAttributes attributes, int x1, int y1, int x2, int y2)
           
 boolean drawOval(java.awt.Graphics g, MiAttributes attributes, int xmin, int ymin, int width, int height)
           
 boolean drawPolygon(java.awt.Graphics g, MiAttributes attributes, int[] xpts, int[] ypts, int numPts)
           
 boolean drawRect(java.awt.Graphics g, MiAttributes atts, int dxmin, int dymin, int dwidth, int dheight)
           
 boolean drawRoundRect(java.awt.Graphics g, MiAttributes attributes, int xmin, int ymin, int width, int height, int arcWidth, int arcHeight)
           
 boolean drawText(java.awt.Graphics g, MiAttributes attributes, java.lang.String text, int x, int y)
           
 java.awt.Color getBaseColor()
          Gets the base color of this renderer.
 int getBaseHeight()
           
 int getBaseWidth()
           
 boolean getBounds(MiAttributes attributes, MiBounds drawBounds, MiBounds renderedBounds)
           
 boolean getGradientBaseColorEqualsPartBGColor()
          Gets whether this renderer looks at the background color of each part that is being renderered or whether this uses the assigned base color.
 void setBaseColor(java.awt.Color c)
          Sets the base color of this renderer.
 void setBaseSize(int width, int height)
           
 void setGradientBaseColorEqualsPartBGColor(boolean flag)
          Sets whether this renderer looks at the background color of each part that is being renderered or whether this uses the assigned base color.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MiCustomGradientRenderer

public MiCustomGradientRenderer()
Constructs a renderer which generates a background gradient image effect when assigned to one or more parts using their setBackgroundRenderer() method.

See Also:
MiPart.setBackgroundRenderer(com.swfm.mica.renderers.MiiDeviceRenderer), setGradientBaseColorEqualsPartBGColor
Method Detail

setBaseSize

public void setBaseSize(int width,
                        int height)

getBaseWidth

public int getBaseWidth()

getBaseHeight

public int getBaseHeight()

setBaseColor

public void setBaseColor(java.awt.Color c)
Sets the base color of this renderer. This is used in conjunction with light direction to generate a gradient. TRANSPARENT_COLOR as a background, then this renderer does nothing for that part.

Parameters:
c - the color.
See Also:
setGradientBaseColorEqualsPartBGColor(boolean), getGradientBaseColorEqualsPartBGColor(), getBaseColor()

getBaseColor

public java.awt.Color getBaseColor()
Gets the base color of this renderer. This is used in conjunction with light direction to generate a gradient. TRANSPARENT_COLOR as a background, then this renderer does nothing for that part.

Returns:
the color.
See Also:
setGradientBaseColorEqualsPartBGColor(boolean), getGradientBaseColorEqualsPartBGColor(), setBaseColor(java.awt.Color)

setGradientBaseColorEqualsPartBGColor

public void setGradientBaseColorEqualsPartBGColor(boolean flag)
Sets whether this renderer looks at the background color of each part that is being renderered or whether this uses the assigned base color. This is true by default. In any case, if a part that is being rendered has TRANSPARENT_COLOR as a background, then this renderer does nothing for that part.

Parameters:
flag - true if the background color of the part being rendered determine the base color.
See Also:
getGradientBaseColorEqualsPartBGColor(), setBaseColor(java.awt.Color), getBaseColor()

getGradientBaseColorEqualsPartBGColor

public boolean getGradientBaseColorEqualsPartBGColor()
Gets whether this renderer looks at the background color of each part that is being renderered or whether this uses the assigned base color. This is true by default. In any case, if a part that is being rendered has TRANSPARENT_COLOR as a background, then this renderer does nothing for that part.

Returns:
true if the background color of the part being rendered determine the base color.
See Also:
setGradientBaseColorEqualsPartBGColor(boolean), setBaseColor(java.awt.Color), getBaseColor()

drawRect

public boolean drawRect(java.awt.Graphics g,
                        MiAttributes atts,
                        int dxmin,
                        int dymin,
                        int dwidth,
                        int dheight)
Specified by:
drawRect in interface MiiDeviceRenderer

createImage

public java.awt.Image createImage(int width,
                                  int height)

getBounds

public boolean getBounds(MiAttributes attributes,
                         MiBounds drawBounds,
                         MiBounds renderedBounds)
Specified by:
getBounds in interface MiiDeviceRenderer

drawLine

public boolean drawLine(java.awt.Graphics g,
                        MiAttributes attributes,
                        int x1,
                        int y1,
                        int x2,
                        int y2)
Specified by:
drawLine in interface MiiDeviceRenderer

drawRoundRect

public boolean drawRoundRect(java.awt.Graphics g,
                             MiAttributes attributes,
                             int xmin,
                             int ymin,
                             int width,
                             int height,
                             int arcWidth,
                             int arcHeight)
Specified by:
drawRoundRect in interface MiiDeviceRenderer

drawPolygon

public boolean drawPolygon(java.awt.Graphics g,
                           MiAttributes attributes,
                           int[] xpts,
                           int[] ypts,
                           int numPts)
Specified by:
drawPolygon in interface MiiDeviceRenderer

drawOval

public boolean drawOval(java.awt.Graphics g,
                        MiAttributes attributes,
                        int xmin,
                        int ymin,
                        int width,
                        int height)
Specified by:
drawOval in interface MiiDeviceRenderer

drawText

public boolean drawText(java.awt.Graphics g,
                        MiAttributes attributes,
                        java.lang.String text,
                        int x,
                        int y)
Specified by:
drawText in interface MiiDeviceRenderer