UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.objects
Class Style

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.objects.Style
All Implemented Interfaces:
Cloneable, SatinConstants, Serializable

public class Style
extends Object
implements SatinConstants, Serializable, Cloneable

The interface for styles, for Screen Data Objects. Styles dictate how GraphicalObjects are drawn.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v1.0-1.0.0, Oct 06 1998, JH
               Created class
             - SATIN-v2.1-1.0.0, Aug 11 2000, JH
               Touched for SATIN release
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Aug 11 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Field Summary
static int CAP_BUTT
           
static int CAP_ROUND
           
static int CAP_SQUARE
           
static byte DRAW_AND
           
static byte DRAW_ANDINVERTED
           
static byte DRAW_ANDREVERSE
           
static byte DRAW_CLEAR
          Clear out what is underneath
static byte DRAW_COPY
           
static byte DRAW_COPYINVERTED
           
static byte DRAW_EQUIV
           
static byte DRAW_INVERT
           
static byte DRAW_NAND
           
static byte DRAW_NOOP
           
static byte DRAW_NOR
           
static byte DRAW_OR
           
static byte DRAW_ORINVERTED
           
static byte DRAW_ORREVERSE
           
static byte DRAW_SET
           
static byte DRAW_XOR
           
static int JOIN_BEVEL
           
static int JOIN_MITER
           
static int JOIN_ROUND
           
static byte TRANSPARENT
           
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Constructor Summary
Style()
          Create a Style with default parameters.
Style(Properties props)
           
Style(String strFileName)
           
Style(String strFileName, Style defaults)
           
Style(Style s)
          Create a clone of the specified Style.
 
Method Summary
 Object clone()
          Make a clone of this Style.
 float[] getDashArray()
          Return a copy of the dash array (not a reference to the original one!).
 float getDashPhase()
           
 Color getDrawColor()
          Get the color to draw lines with.
 Font getDrawFont()
          Get the font style.
 BasicStroke getDrawStroke()
          Get the drawing style.
 int getEndCap()
           
 Color getFillColor()
          Get the color to fill with.
 Color getFontColor()
           
 int getLineJoin()
           
 float getLineWidth()
           
 float getMiterLimit()
           
static void main(String[] argv)
           
 void setDashArray(float[] fArray)
          Set the dash array for the pen used to draw with this style.
 void setDashPhase(float newDashPhase)
          Set the dash phase for the pen used to draw with this style.
 void setDrawColor(Color newColor)
          Set the drawing color.
 void setDrawColorHSV(float h, float s, float v)
          Set the drawing color in HSV format.
 void setDrawColorRGBA(float r, float g, float b, float a)
          Set the drawing color in RGB format.
 void setDrawColorRGBA(int r, int g, int b, int a)
          Set the drawing color in RGB format.
 void setDrawFont(Font newFont)
          Set the font to use.
 void setDrawStroke(BasicStroke s)
          Set the drawing style.
 void setDrawTransparency(float aa)
          Set the transparency for drawing.
 void setDrawTransparency(int aa)
          Set the transparency for draw.
 void setEndCap(int newEndCap)
          Set the end cap for the pen used to draw with this style.
 void setFillColor(Color newColor)
          Set the fill color.
 void setFillColorHSV(float h, float s, float v)
          Set the fill color in HSV format.
 void setFillColorRGBA(float r, float g, float b, float a)
          Set the fill color in RGB format.
 void setFillColorRGBA(int r, int g, int b, int a)
          Set the fill color in RGB format.
 void setFillTransparency(float aa)
          Set the transparency for fill.
 void setFillTransparency(int aa)
          Set the transparency for fill.
 void setFontColor(Color newColor)
           
 void setLineJoin(int newLineJoin)
          Set the line join for the pen used to draw with this style.
 void setLineWidth(float newLineWidth)
          Set the line width for the pen used to draw with this style.
 void setMiterLimit(float newMiterLimit)
          Set the miter limit for the pen used to draw with this style.
 String toString()
          Debugging info.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TRANSPARENT

public static final byte TRANSPARENT

DRAW_CLEAR

public static final byte DRAW_CLEAR
Clear out what is underneath

DRAW_SET

public static final byte DRAW_SET

DRAW_COPY

public static final byte DRAW_COPY

DRAW_NOOP

public static final byte DRAW_NOOP

DRAW_COPYINVERTED

public static final byte DRAW_COPYINVERTED

DRAW_INVERT

public static final byte DRAW_INVERT

DRAW_OR

public static final byte DRAW_OR

DRAW_AND

public static final byte DRAW_AND

DRAW_XOR

public static final byte DRAW_XOR

DRAW_EQUIV

public static final byte DRAW_EQUIV

DRAW_NAND

public static final byte DRAW_NAND

DRAW_NOR

public static final byte DRAW_NOR

DRAW_ANDINVERTED

public static final byte DRAW_ANDINVERTED

DRAW_ANDREVERSE

public static final byte DRAW_ANDREVERSE

DRAW_ORINVERTED

public static final byte DRAW_ORINVERTED

DRAW_ORREVERSE

public static final byte DRAW_ORREVERSE

CAP_BUTT

public static final int CAP_BUTT
See Also:
BasicStroke.CAP_BUTT

CAP_ROUND

public static final int CAP_ROUND
See Also:
BasicStroke.CAP_ROUND

CAP_SQUARE

public static final int CAP_SQUARE
See Also:
BasicStroke.CAP_SQUARE

JOIN_BEVEL

public static final int JOIN_BEVEL
See Also:
BasicStroke.JOIN_BEVEL

JOIN_MITER

public static final int JOIN_MITER
See Also:
BasicStroke.JOIN_MITER

JOIN_ROUND

public static final int JOIN_ROUND
See Also:
BasicStroke.JOIN_ROUND
Constructor Detail

Style

public Style()
Create a Style with default parameters.

Style

public Style(Style s)
Create a clone of the specified Style.
Parameters:
s - is the Style to copy.

Style

public Style(String strFileName)
Parameters:
strFileName - is the name of the style properties file in Satin's data directory to load up.

Style

public Style(String strFileName,
             Style defaults)
Parameters:
strFileName - is the name of the style properties file in Satin's data directory to load up.
defaults - is the default Style to use if some of the style properties do not exist.

Style

public Style(Properties props)
Method Detail

getDrawStroke

public BasicStroke getDrawStroke()
Get the drawing style.
Returns:
a BasicStroke.

getDashArray

public float[] getDashArray()
Return a copy of the dash array (not a reference to the original one!).
See Also:
BasicStroke.getDashArray()

getDashPhase

public float getDashPhase()
See Also:
BasicStroke.getDashPhase()

getEndCap

public int getEndCap()
See Also:
BasicStroke.getEndCap()

getLineJoin

public int getLineJoin()
See Also:
BasicStroke.getLineJoin()

getLineWidth

public float getLineWidth()
See Also:
BasicStroke.getLineWidth()

getMiterLimit

public float getMiterLimit()
See Also:
BasicStroke.getMiterLimit()

getDrawColor

public Color getDrawColor()
Get the color to draw lines with.
Returns:
the line drawing color.

getDrawFont

public Font getDrawFont()
Get the font style.
Returns:
a font.

getFontColor

public Color getFontColor()

getFillColor

public Color getFillColor()
Get the color to fill with.
Returns:
the fill color.

setDrawStroke

public void setDrawStroke(BasicStroke s)
Set the drawing style.
Parameters:
s - is the drawing style to set to.

setDashArray

public void setDashArray(float[] fArray)
Set the dash array for the pen used to draw with this style.
Parameters:
fArray - the array representing the dashing pattern
See Also:
BasicStroke.getDashArray()

setDashPhase

public void setDashPhase(float newDashPhase)
Set the dash phase for the pen used to draw with this style.
Parameters:
newDashPhase - is the offset to start the dashing pattern
See Also:
BasicStroke.getDashPhase()

setEndCap

public void setEndCap(int newEndCap)
Set the end cap for the pen used to draw with this style.
Parameters:
newEndCap - is the decoration of the ends.
See Also:
BasicStroke.getEndCap()

setLineJoin

public void setLineJoin(int newLineJoin)
Set the line join for the pen used to draw with this style.
Parameters:
newLineJoin - is the decoration applied where path segments meet.
See Also:
BasicStroke.getLineJoin()

setLineWidth

public void setLineWidth(float newLineWidth)
Set the line width for the pen used to draw with this style.
Parameters:
newLineWidth - is the width of the pen.
See Also:
BasicStroke.getLineWidth()

setMiterLimit

public void setMiterLimit(float newMiterLimit)
Set the miter limit for the pen used to draw with this style.
Parameters:
newMiterLimit - is the limit to trim the miter join.
See Also:
BasicStroke.getMiterLimit()

setDrawFont

public void setDrawFont(Font newFont)
Set the font to use.
Parameters:
newFont - is the font to set to.

setFontColor

public void setFontColor(Color newColor)

setDrawColor

public void setDrawColor(Color newColor)
Set the drawing color.
Parameters:
newColor - is the color to set to.

setDrawColorHSV

public void setDrawColorHSV(float h,
                            float s,
                            float v)
Set the drawing color in HSV format.
Parameters:
h - is the hue value.
s - is the saturation value.
v - is the brightness value.

setDrawColorRGBA

public void setDrawColorRGBA(int r,
                             int g,
                             int b,
                             int a)
Set the drawing color in RGB format.
Parameters:
r - is the red value (0-255).
g - is the green value (0-255).
b - is the blue value (0-255).
a - is the transparency value (0-255).

setDrawColorRGBA

public void setDrawColorRGBA(float r,
                             float g,
                             float b,
                             float a)
Set the drawing color in RGB format.
Parameters:
r - is the red value (0.00 - 1.00).
g - is the green value (0.00 - 1.00).
b - is the blue value (0.00 - 1.00).
a - is the transparency value (0.00 - 1.00).

setDrawTransparency

public void setDrawTransparency(float aa)
Set the transparency for drawing.
Parameters:
aa - is the transparency value, from 0 to 1, 0 being transparent and 1 being solid.

setDrawTransparency

public void setDrawTransparency(int aa)
Set the transparency for draw.
Parameters:
aa - is the transparency value (0-255).

setFillColor

public void setFillColor(Color newColor)
Set the fill color.
Parameters:
newColor - is the color to set to.

setFillColorHSV

public void setFillColorHSV(float h,
                            float s,
                            float v)
Set the fill color in HSV format.
Parameters:
h - is the hue value.
s - is the saturation value.
v - is the brightness value.

setFillColorRGBA

public void setFillColorRGBA(int r,
                             int g,
                             int b,
                             int a)
Set the fill color in RGB format.
Parameters:
r - is the red value (0-255).
g - is the green value (0-255).
b - is the blue value (0-255).
a - is the transparency value (0-255).

setFillColorRGBA

public void setFillColorRGBA(float r,
                             float g,
                             float b,
                             float a)
Set the fill color in RGB format.
Parameters:
r - is the red value (0.00 - 1.00).
g - is the green value (0.00 - 1.00).
b - is the blue value (0.00 - 1.00).
a - is the transparency value (0.00 - 1.00).

setFillTransparency

public void setFillTransparency(float aa)
Set the transparency for fill.
Parameters:
aa - is the transparency value (0.00 - 1.00).

setFillTransparency

public void setFillTransparency(int aa)
Set the transparency for fill.
Parameters:
aa - is the transparency value (0-255).

toString

public String toString()
Debugging info.
Overrides:
toString in class Object

clone

public Object clone()
Make a clone of this Style.
Overrides:
clone in class Object

main

public static void main(String[] argv)

Copyright Information