com.sun.electric.database.geometry
Class EGraphics

java.lang.Object
  extended by java.util.Observable
      extended by com.sun.electric.database.geometry.EGraphics
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class EGraphics
extends java.util.Observable
implements java.lang.Cloneable, java.io.Serializable

Class to define the appearance of a piece of geometry.

See Also:
Serialized Form

Nested Class Summary
static class EGraphics.Outline
          Class to define the type of outline around a stipple pattern.
 
Field Summary
static int BLACK
          Describes the color black.
static int BLUE
          Describes the color blue.
static int BROWN
          Describes the color brown.
static int CELLOUT
          Describes the cell outline.
static int CELLTXT
          Describes the cell and port names.
static int CURSOR
          Describes the cursor color.
static int CYAN
          Describes the color cyan.
static int DBLUE
          Describes the color dark blue.
static int DGRAY
          Describes the color dark gray.
static int DGREEN
          Describes the color dark green.
static int DRED
          Describes the color dark red.
static int FULLRGBBIT
          Describes the full RGB escape bit.
static int GRAY
          Describes the color gray.
static int GREEN
          Describes the color green.
static int HMENBOR
          Describes the highlighted menu border color.
static int HWINBOR
          Describes the highlighted window border color.
static int LAYERT1
          Describes transparent layer 1.
static int LAYERT10
          Describes transparent layer 10.
static int LAYERT11
          Describes transparent layer 11.
static int LAYERT12
          Describes transparent layer 12.
static int LAYERT2
          Describes transparent layer 2.
static int LAYERT3
          Describes transparent layer 3.
static int LAYERT4
          Describes transparent layer 4.
static int LAYERT5
          Describes transparent layer 5.
static int LAYERT6
          Describes transparent layer 6.
static int LAYERT7
          Describes transparent layer 7.
static int LAYERT8
          Describes transparent layer 8.
static int LAYERT9
          Describes transparent layer 9.
static int LBLUE
          Describes the color light blue.
static int LGRAY
          Describes the color light gray.
static int LGREEN
          Describes the color light green.
static int LRED
          Describes the color light red.
static int MAGENTA
          Describes the color magenta.
static int MENBOR
          Describes the menu border color.
static int MENGLY
          Describes the menu glyph color.
static int MENTXT
          Describes the menu text color.
static int OPAQUEBIT
          Describes opaque color escape bit.
static int ORANGE
          Describes the color orange.
static int PURPLE
          Describes the color purple.
static int RED
          Describes the color red.
static int TRANSPARENT_1
          defines the 1st transparent layer.
static int TRANSPARENT_10
          defines the 10th transparent layer.
static int TRANSPARENT_11
          defines the 11th transparent layer.
static int TRANSPARENT_12
          defines the 12th transparent layer.
static int TRANSPARENT_2
          defines the 2nd transparent layer.
static int TRANSPARENT_3
          defines the 3rd transparent layer.
static int TRANSPARENT_4
          defines the 4th transparent layer.
static int TRANSPARENT_5
          defines the 5th transparent layer.
static int TRANSPARENT_6
          defines the 6th transparent layer.
static int TRANSPARENT_7
          defines the 7th transparent layer.
static int TRANSPARENT_8
          defines the 8th transparent layer.
static int TRANSPARENT_9
          defines the 9th transparent layer.
static int WHITE
          Describes the color white.
static int WINBOR
          Describes the window border color.
static int YELLOW
          Describes the color yellow.
 
Constructor Summary
EGraphics(boolean displayPatterned, boolean printPatterned, EGraphics.Outline outlineWhenPatterned, int transparentLayer, int red, int green, int blue, double opacity, boolean foreground, int[] pattern)
          Method to create a graphics object.
EGraphics(EGraphics g)
          Method to easily copy graphics between similar layers
 
Method Summary
static int findColorIndex(java.lang.String name)
          Method to find the index of a color, given its name.
 java.lang.Object get3DAppearance()
          Method to retrieve current 3D appearance.
 java.awt.Color getColor()
          Method to return the color associated with this EGraphics.
static java.awt.Color getColorFromIndex(int colorIndex)
          Method to convert a color index into a Color.
static java.lang.String getColorIndexName(int colorIndex)
          Method to tell the name of the color with a given index.
static int[] getColorIndices()
          Method to return the array of color indices.
 int getFactoryColor()
          Method to get the RGB value representing the color by factory default.
 double getFactoryOpacity()
          Method to return the opacity by factory default.
 EGraphics.Outline getFactoryOutlined()
          Method describes the type of outline pattern by factory default.
 int[] getFactoryPattern()
          Method to return the stipple pattern by factory default.
 int getFactoryTransparentLayer()
          Method to return the transparent layer number by factory default.
 boolean getForeground()
          Method to get whether this EGraphics should be drawn in the foreground.
 Layer getLayer()
          Method to return the Layer associated with this EGraphics.
 double getOpacity()
          Method to get the opacity of this EGraphics.
 java.awt.Color getOpaqueColor()
          Method to return the color associated with this EGraphics with full opacity.
 EGraphics.Outline getOutlined()
          Method to tell the type of outline pattern.
 int[] getPattern()
          Method to get the stipple pattern of this EGraphics.
 int[] getReversedPattern()
          Method to get the reversed stipple pattern of this EGraphics.
 int getRGB()
          Returns the RGB value representing the color associated with this EGraphics.
static int[] getTransparentColorIndices()
          Method to return the array of transparent color indices.
 int getTransparentLayer()
          Method to return the transparent layer number associated with this EGraphics.
 boolean isFactoryPatternedOnDisplay()
          Method describes how this EGraphics appears on a display by factory default.
 boolean isFactoryPatternedOnPrinter()
          Method describes how this EGraphics appears on a printer by factory default.
 boolean isPatternedOnDisplay()
          Method describes how this EGraphics appears on a display.
 boolean isPatternedOnPrinter()
          Method describes how this EGraphics appears on a printer.
static int makeIndex(java.awt.Color color)
          Method to convert a Color to a color index.
static int makeIndex(int transparentLayer)
          Method to convert a transparent layer to a color index.
 void notifyVisibility(java.lang.Boolean layerVis)
          Method to notify 3D observers
 void recachePrefs()
          Method to recache the graphics information from the preferences.
 void set3DAppearance(java.lang.Object obj)
          Method to set 3D appearance.
 void setColor(java.awt.Color color)
          Method to set the color associated with this EGraphics.
 void setColorIndex(int colorIndex)
          Method to set the color of this EGraphics from a "color index".
 void setForeground(boolean f)
          Method to set whether this EGraphics should be drawn in the foreground.
 void setLayer(Layer layer)
          Method to set which Layer is associated with this EGraphics.
 void setOpacity(double opacity)
          Method to set the opacity of this EGraphics.
 void setOutlined(EGraphics.Outline o)
          Method to set whether this pattern has an outline around it.
 void setPattern(int[] pattern)
          Method to set the stipple pattern of this EGraphics.
 void setPatternedOnDisplay(boolean p)
          Method to set how this EGraphics appears on a display.
 void setPatternedOnPrinter(boolean p)
          Method to set how this EGraphics appears on a printer.
 void setTransparentLayer(int transparentLayer)
          Method to set the transparent layer number associated with this EGraphics.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULLRGBBIT

public static final int FULLRGBBIT
Describes the full RGB escape bit.

See Also:
Constant Field Values

OPAQUEBIT

public static final int OPAQUEBIT
Describes opaque color escape bit.

See Also:
Constant Field Values

WHITE

public static final int WHITE
Describes the color white.

See Also:
Constant Field Values

BLACK

public static final int BLACK
Describes the color black.

See Also:
Constant Field Values

RED

public static final int RED
Describes the color red.

See Also:
Constant Field Values

BLUE

public static final int BLUE
Describes the color blue.

See Also:
Constant Field Values

GREEN

public static final int GREEN
Describes the color green.

See Also:
Constant Field Values

CYAN

public static final int CYAN
Describes the color cyan.

See Also:
Constant Field Values

MAGENTA

public static final int MAGENTA
Describes the color magenta.

See Also:
Constant Field Values

YELLOW

public static final int YELLOW
Describes the color yellow.

See Also:
Constant Field Values

CELLTXT

public static final int CELLTXT
Describes the cell and port names.

See Also:
Constant Field Values

CELLOUT

public static final int CELLOUT
Describes the cell outline.

See Also:
Constant Field Values

WINBOR

public static final int WINBOR
Describes the window border color.

See Also:
Constant Field Values

HWINBOR

public static final int HWINBOR
Describes the highlighted window border color.

See Also:
Constant Field Values

MENBOR

public static final int MENBOR
Describes the menu border color.

See Also:
Constant Field Values

HMENBOR

public static final int HMENBOR
Describes the highlighted menu border color.

See Also:
Constant Field Values

MENTXT

public static final int MENTXT
Describes the menu text color.

See Also:
Constant Field Values

MENGLY

public static final int MENGLY
Describes the menu glyph color.

See Also:
Constant Field Values

CURSOR

public static final int CURSOR
Describes the cursor color.

See Also:
Constant Field Values

GRAY

public static final int GRAY
Describes the color gray.

See Also:
Constant Field Values

ORANGE

public static final int ORANGE
Describes the color orange.

See Also:
Constant Field Values

PURPLE

public static final int PURPLE
Describes the color purple.

See Also:
Constant Field Values

BROWN

public static final int BROWN
Describes the color brown.

See Also:
Constant Field Values

LGRAY

public static final int LGRAY
Describes the color light gray.

See Also:
Constant Field Values

DGRAY

public static final int DGRAY
Describes the color dark gray.

See Also:
Constant Field Values

LRED

public static final int LRED
Describes the color light red.

See Also:
Constant Field Values

DRED

public static final int DRED
Describes the color dark red.

See Also:
Constant Field Values

LGREEN

public static final int LGREEN
Describes the color light green.

See Also:
Constant Field Values

DGREEN

public static final int DGREEN
Describes the color dark green.

See Also:
Constant Field Values

LBLUE

public static final int LBLUE
Describes the color light blue.

See Also:
Constant Field Values

DBLUE

public static final int DBLUE
Describes the color dark blue.

See Also:
Constant Field Values

LAYERT1

public static final int LAYERT1
Describes transparent layer 1.

See Also:
Constant Field Values

LAYERT2

public static final int LAYERT2
Describes transparent layer 2.

See Also:
Constant Field Values

LAYERT3

public static final int LAYERT3
Describes transparent layer 3.

See Also:
Constant Field Values

LAYERT4

public static final int LAYERT4
Describes transparent layer 4.

See Also:
Constant Field Values

LAYERT5

public static final int LAYERT5
Describes transparent layer 5.

See Also:
Constant Field Values

LAYERT6

public static final int LAYERT6
Describes transparent layer 6.

See Also:
Constant Field Values

LAYERT7

public static final int LAYERT7
Describes transparent layer 7.

See Also:
Constant Field Values

LAYERT8

public static final int LAYERT8
Describes transparent layer 8.

See Also:
Constant Field Values

LAYERT9

public static final int LAYERT9
Describes transparent layer 9.

See Also:
Constant Field Values

LAYERT10

public static final int LAYERT10
Describes transparent layer 10.

See Also:
Constant Field Values

LAYERT11

public static final int LAYERT11
Describes transparent layer 11.

See Also:
Constant Field Values

LAYERT12

public static final int LAYERT12
Describes transparent layer 12.

See Also:
Constant Field Values

TRANSPARENT_1

public static final int TRANSPARENT_1
defines the 1st transparent layer.

See Also:
Constant Field Values

TRANSPARENT_2

public static final int TRANSPARENT_2
defines the 2nd transparent layer.

See Also:
Constant Field Values

TRANSPARENT_3

public static final int TRANSPARENT_3
defines the 3rd transparent layer.

See Also:
Constant Field Values

TRANSPARENT_4

public static final int TRANSPARENT_4
defines the 4th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_5

public static final int TRANSPARENT_5
defines the 5th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_6

public static final int TRANSPARENT_6
defines the 6th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_7

public static final int TRANSPARENT_7
defines the 7th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_8

public static final int TRANSPARENT_8
defines the 8th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_9

public static final int TRANSPARENT_9
defines the 9th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_10

public static final int TRANSPARENT_10
defines the 10th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_11

public static final int TRANSPARENT_11
defines the 11th transparent layer.

See Also:
Constant Field Values

TRANSPARENT_12

public static final int TRANSPARENT_12
defines the 12th transparent layer.

See Also:
Constant Field Values
Constructor Detail

EGraphics

public EGraphics(boolean displayPatterned,
                 boolean printPatterned,
                 EGraphics.Outline outlineWhenPatterned,
                 int transparentLayer,
                 int red,
                 int green,
                 int blue,
                 double opacity,
                 boolean foreground,
                 int[] pattern)
Method to create a graphics object.

Parameters:
displayPatterned - true if drawn with a pattern on the display.
printPatterned - true if drawn with a pattern on a printer.
outlineWhenPatterned - the outline texture to use when patterned.
transparentLayer - the transparent layer number (0 for none).
red - the red component of this EGraphics.
green - the green component of this EGraphics.
blue - the blue component of this EGraphics.
opacity - the opacity of this EGraphics (1 for opaque, 0 for transparent).
foreground - the foreground factor of this EGraphics (1 for to be in foreground).
pattern - the 16x16 stipple pattern of this EGraphics (16 integers).

EGraphics

public EGraphics(EGraphics g)
Method to easily copy graphics between similar layers

Parameters:
g - graphics to copy data from
Method Detail

getLayer

public Layer getLayer()
Method to return the Layer associated with this EGraphics.

Returns:
the Layer associated with this EGraphics.

setLayer

public void setLayer(Layer layer)
Method to set which Layer is associated with this EGraphics. Since this is called only during initialization, it also examines preferences and uses them to override the graphics information.

Parameters:
layer - the Layer to associate with this EGraphics.

recachePrefs

public void recachePrefs()
Method to recache the graphics information from the preferences. Called after new preferences have been imported.


isPatternedOnDisplay

public boolean isPatternedOnDisplay()
Method describes how this EGraphics appears on a display. This EGraphics can be drawn as a solid fill or as a pattern.

Returns:
true to draw this EGraphics patterned on a display. False to draw this EGraphics as a solid fill on a display.

isFactoryPatternedOnDisplay

public boolean isFactoryPatternedOnDisplay()
Method describes how this EGraphics appears on a display by factory default. This EGraphics can be drawn as a solid fill or as a pattern.

Returns:
true to draw this EGraphics patterned on a display by factory default. False to draw this EGraphics as a solid fill on a display by factory default.

setPatternedOnDisplay

public void setPatternedOnDisplay(boolean p)
Method to set how this EGraphics appears on a display. This EGraphics can be drawn as a solid fill or as a pattern.

Parameters:
p - true to draw this EGraphics patterned on a display. False to draw this EGraphics as a solid fill on a display.

isPatternedOnPrinter

public boolean isPatternedOnPrinter()
Method describes how this EGraphics appears on a printer. This EGraphics can be drawn as a solid fill or as a pattern.

Returns:
true to draw this EGraphics patterned on a printer. False to draw this EGraphics as a solid fill on a printer.

isFactoryPatternedOnPrinter

public boolean isFactoryPatternedOnPrinter()
Method describes how this EGraphics appears on a printer by factory default. This EGraphics can be drawn as a solid fill or as a pattern.

Returns:
true to draw this EGraphics patterned on a printer by factory default. False to draw this EGraphics as a solid fill on a printer by factory default.

setPatternedOnPrinter

public void setPatternedOnPrinter(boolean p)
Method to set how this EGraphics appears on a printer. This EGraphics can be drawn as a solid fill or as a pattern.

Parameters:
p - true to draw this EGraphics patterned on a printer. False to draw this EGraphics as a solid fill on a printer.

getOutlined

public EGraphics.Outline getOutlined()
Method to tell the type of outline pattern. When the EGraphics is drawn as a pattern, the outline can be defined more clearly by drawing a line around the edge.

Returns:
the type of outline pattern.

getFactoryOutlined

public EGraphics.Outline getFactoryOutlined()
Method describes the type of outline pattern by factory default. When the EGraphics is drawn as a pattern, the outline can be defined more clearly by drawing a line around the edge.

Returns:
the type of outline pattern by factory default.

setOutlined

public void setOutlined(EGraphics.Outline o)
Method to set whether this pattern has an outline around it. When the EGraphics is drawn as a pattern, the outline can be defined more clearly by drawing a line around the edge.

Parameters:
o - the outline pattern.

getTransparentLayer

public int getTransparentLayer()
Method to return the transparent layer number associated with this EGraphics.

Returns:
the transparent layer number associated with this EGraphics. A value of zero means that this EGraphics is not drawn transparently. Instead, use the "getColor()" method to get its solid color.

getFactoryTransparentLayer

public int getFactoryTransparentLayer()
Method to return the transparent layer number by factory default.

Returns:
the transparent layer number by factory default. A value of zero means that this EGraphics is not drawn transparently.

setTransparentLayer

public void setTransparentLayer(int transparentLayer)
Method to set the transparent layer number associated with this EGraphics.

Parameters:
transparentLayer - the transparent layer number associated with this EGraphics. A value of zero means that this EGraphics is not drawn transparently. Then, use the "setColor()" method to set its solid color.

getPattern

public int[] getPattern()
Method to get the stipple pattern of this EGraphics. The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.

Returns:
the stipple pattern of this EGraphics.

getReversedPattern

public int[] getReversedPattern()
Method to get the reversed stipple pattern of this EGraphics. The reversed stipple pattern is a 16 x 32 pattern that is stored in 16 integers.

Returns:
the stipple pattern of this EGraphics.

getFactoryPattern

public int[] getFactoryPattern()
Method to return the stipple pattern by factory default. The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.

Returns:
the stipple pattern by factory default.

setPattern

public void setPattern(int[] pattern)
Method to set the stipple pattern of this EGraphics. The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.

Parameters:
pattern - the stipple pattern of this EGraphics.

getOpacity

public double getOpacity()
Method to get the opacity of this EGraphics. Opacity runs from 0 (transparent) to 1 (opaque).

Returns:
the opacity of this EGraphics.

getFactoryOpacity

public double getFactoryOpacity()
Method to return the opacity by factory default. Opacity runs from 0 (transparent) to 1 (opaque).

Returns:
the opacity by factory default.

setOpacity

public void setOpacity(double opacity)
Method to set the opacity of this EGraphics. Opacity runs from 0 (transparent) to 1 (opaque).

Parameters:
opacity - the opacity of this EGraphics.

getForeground

public boolean getForeground()
Method to get whether this EGraphics should be drawn in the foreground. The foreground is the main "mix" of layers, such as metals and polysilicons. The background is typically used by implant and well layers.

Returns:
the whether this EGraphics should be drawn in the foreground.

setForeground

public void setForeground(boolean f)
Method to set whether this EGraphics should be drawn in the foreground. The foreground is the main "mix" of layers, such as metals and polysilicons. The background is typically used by implant and well layers.

Parameters:
f - true if this EGraphics should be drawn in the foreground.

getColor

public java.awt.Color getColor()
Method to return the color associated with this EGraphics.

Returns:
the color associated with this EGraphics.

getOpaqueColor

public java.awt.Color getOpaqueColor()
Method to return the color associated with this EGraphics with full opacity.

Returns:
the color associated with this EGraphics.

getFactoryColor

public int getFactoryColor()
Method to get the RGB value representing the color by factory default. (Bits 16-23 are red, 8-15 are green, 0-7 are blue). Alpha/opacity component is not returned

Returns:
the RGB value representing the color by factory default.

getRGB

public int getRGB()
Returns the RGB value representing the color associated with this EGraphics. (Bits 16-23 are red, 8-15 are green, 0-7 are blue). Alpha/opacity component is not returned

Returns:
the RGB value of the color

setColor

public void setColor(java.awt.Color color)
Method to set the color associated with this EGraphics.

Parameters:
color - the color to set.

getColorFromIndex

public static java.awt.Color getColorFromIndex(int colorIndex)
Method to convert a color index into a Color. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values.

Parameters:
colorIndex - the color index to convert.
Returns:
a Color that describes the index Returns null if the index is a transparent layer.

setColorIndex

public void setColorIndex(int colorIndex)
Method to set the color of this EGraphics from a "color index". Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values. Artwork nodes and arcs represent individualized color by using color indices.

Parameters:
colorIndex - the color index to set.

makeIndex

public static int makeIndex(java.awt.Color color)
Method to convert a Color to a color index. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values. Artwork nodes and arcs represent individualized color by using color indices.

Parameters:
color - a Color object
Returns:
the color index that describes that color.

makeIndex

public static int makeIndex(int transparentLayer)
Method to convert a transparent layer to a color index. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values.

Parameters:
transparentLayer - the transparent layer number.
Returns:
the color index that describes that transparent layer.

findColorIndex

public static int findColorIndex(java.lang.String name)
Method to find the index of a color, given its name.

Parameters:
name - the name of the color.
Returns:
the index of the color.

getColorIndexName

public static java.lang.String getColorIndexName(int colorIndex)
Method to tell the name of the color with a given index. Color indices are more general than colors, because they can handle transparent layers, C-Electric-style opaque layers, and full color values.

Parameters:
colorIndex - the color number.
Returns:
the name of that color.

getColorIndices

public static int[] getColorIndices()
Method to return the array of color indices.

Returns:
an array of the possible color indices.

getTransparentColorIndices

public static int[] getTransparentColorIndices()
Method to return the array of transparent color indices.

Returns:
an array of the possible transparent color indices.

set3DAppearance

public void set3DAppearance(java.lang.Object obj)
Method to set 3D appearance. If Java3D, Appearance class will be the type.

Parameters:
obj -

get3DAppearance

public java.lang.Object get3DAppearance()
Method to retrieve current 3D appearance.

Returns:
the current 3D appearance.

notifyVisibility

public void notifyVisibility(java.lang.Boolean layerVis)
Method to notify 3D observers

Parameters:
layerVis -