⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 egraphics.java

📁 The ElectricTM VLSI Design System is an open-source Electronic Design Automation (EDA) system that c
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		Pref transparentLayerPref = transparentLayerMap.get(layer);		transparentLayer = transparentLayerPref.getInt();		Pref opacityPref = opacityMap.get(layer);		opacity = validateOpacity(opacityPref.getDouble());		Pref colorPref = colorMap.get(layer);		int color = colorPref.getInt();		red = (color >> 16) & 0xFF;		green = (color >> 8) & 0xFF;		blue = color & 0xFF;		Pref patternPref = patternMap.get(layer);		String pat = patternPref.getString();		parsePatString(pat, pattern);		setPatternLow(pattern);	}	/**	 * Method to reset this Graphics to its factory state.	 */	public void factoryReset()	{		if (getFactoryColor() != getRGB()) setColor(new Color(getFactoryColor()));		if (getFactoryTransparentLayer() != getTransparentLayer()) setTransparentLayer(getFactoryTransparentLayer());		if (getFactoryOpacity() != getOpacity()) setOpacity(getFactoryOpacity());		if (getForeground() != getForeground()) setForeground(getForeground());		if (!getFactoryPattern().equals(getPattern())) setPattern(getFactoryPattern());		if (!getFactoryOutlined().equals(getOutlined())) setOutlined(getFactoryOutlined());		if (isFactoryPatternedOnDisplay() != isPatternedOnDisplay()) setPatternedOnDisplay(isFactoryPatternedOnDisplay());		if (isFactoryPatternedOnPrinter() != isPatternedOnPrinter()) setPatternedOnPrinter(isFactoryPatternedOnPrinter());	}	private String makePatString(int [] pattern)	{		StringBuffer sb = new StringBuffer();		for(int i=0; i<16; i++)		{			if (i > 0) sb.append("/");			sb.append(Integer.toString(pattern[i]));		}		return sb.toString();	}	private void parsePatString(String patString, int [] pattern)	{		int pos = 0;		for(int i=0; i<16; i++)		{			pattern[i] = TextUtils.atoi(patString.substring(pos)) & 0xFFFF;			pos = patString.indexOf('/', pos) + 1;		}	}	/**	 * Method describes how this EGraphics appears on a display.	 * This EGraphics can be drawn as a solid fill or as a pattern.	 * @return true to draw this EGraphics patterned on a display.	 * False to draw this EGraphics as a solid fill on a display.	 */	public boolean isPatternedOnDisplay() { return displayPatterned; }	/**	 * 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.	 * @return 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.	 */	public boolean isFactoryPatternedOnDisplay()	{		if (layer != null)		{			Pref pref = usePatternDisplayMap.get(layer);			return pref.getBooleanFactoryValue();		}		return false;	}	/**	 * Method to set how this EGraphics appears on a display.	 * This EGraphics can be drawn as a solid fill or as a pattern.	 * @param p true to draw this EGraphics patterned on a display.	 * False to draw this EGraphics as a solid fill on a display.	 */	public void setPatternedOnDisplay(boolean p)	{		displayPatterned = p;		if (layer != null)		{			Pref pref = usePatternDisplayMap.get(layer);			if (pref != null) pref.setBoolean(p);		}	}	/**	 * Method describes how this EGraphics appears on a printer.	 * This EGraphics can be drawn as a solid fill or as a pattern.	 * @return true to draw this EGraphics patterned on a printer.	 * False to draw this EGraphics as a solid fill on a printer.	 */	public boolean isPatternedOnPrinter() { return printPatterned; }	/**	 * 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.	 * @return 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.	 */	public boolean isFactoryPatternedOnPrinter()	{		if (layer != null)		{			Pref pref = usePatternPrinterMap.get(layer);			return pref.getBooleanFactoryValue();		}		return false;	}	/**	 * Method to set how this EGraphics appears on a printer.	 * This EGraphics can be drawn as a solid fill or as a pattern.	 * @param p true to draw this EGraphics patterned on a printer.	 * False to draw this EGraphics as a solid fill on a printer.	 */	public void setPatternedOnPrinter(boolean p)	{		this.printPatterned = p;		if (layer != null)		{			Pref pref = usePatternPrinterMap.get(layer);			if (pref != null) pref.setBoolean(p);		}	}	/**	 * 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.	 * @return the type of outline pattern.	 */	public Outline getOutlined() { return patternOutline; }	/**	 * 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.	 * @return the type of outline pattern by factory default.	 */	public Outline getFactoryOutlined()	{		if (layer == null) return null;		Pref pref = outlinePatternMap.get(layer);		return Outline.findOutline(pref.getIntFactoryValue());	}	/**	 * 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.	 * @param o the outline pattern.	 */	public void setOutlined(Outline o)	{		if (o == null) o = Outline.NOPAT;		patternOutline = o;		if (layer != null)		{			Pref pref = outlinePatternMap.get(layer);			if (pref != null) pref.setInt(o.getIndex());		}		// recache the pattern information to test for null patterns with no outlines		setPatternLow(pattern);	}	/**	 * Method to return the transparent layer number associated with this EGraphics.	 * @return 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.	 */	public int getTransparentLayer() { return transparentLayer; }	/**	 * Method to return the transparent layer number by factory default.	 * @return the transparent layer number by factory default.	 * A value of zero means that this EGraphics is not drawn transparently.	 */	public int getFactoryTransparentLayer()	{		if (layer == null) return 0;		Pref pref = transparentLayerMap.get(layer);		return pref.getIntFactoryValue();	}	/**	 * Method to set the transparent layer number associated with this EGraphics.	 * @param 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.	 */	public void setTransparentLayer(int transparentLayer)	{		if (transparentLayer < 0 || transparentLayer > TRANSPARENT_12)		{			System.out.println("Graphics transparent color bad: " + transparentLayer);		}		this.transparentLayer = transparentLayer;		if (layer != null)		{			Pref pref = transparentLayerMap.get(layer);			if (pref != null) pref.setInt(transparentLayer);		}	}	/**	 * Method to get the stipple pattern of this EGraphics.	 * The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.	 * @return the stipple pattern of this EGraphics.	 */	public int [] getPattern() { return pattern; }	/**	 * 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.	 * @return the stipple pattern of this EGraphics.	 */	public int [] getReversedPattern() { return reversedPattern; }	/**	 * Method to return the stipple pattern by factory default.	 * The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.	 * @return the stipple pattern by factory default.	 */	public int [] getFactoryPattern()	{		if (layer == null) return null;		Pref pref = patternMap.get(layer);		int [] retPat = new int[16];		parsePatString(pref.getStringFactoryValue(), retPat);		return retPat;	}	/**	 * Method to set the stipple pattern of this EGraphics.	 * The stipple pattern is a 16 x 16 pattern that is stored in 16 integers.	 * @param pattern the stipple pattern of this EGraphics.	 */	public void setPattern(int [] pattern)	{		setPatternLow(pattern);		if (layer != null)		{			Pref pref = patternMap.get(layer);			if (pref != null) pref.setString(makePatString(pattern));		}	}	private void setPatternLow(int [] pattern) {		if (pattern.length != 16)		{			System.out.println("Graphics bad: has " + pattern.length + " pattern entries instead of 16");		}		this.pattern = pattern;		reversedPattern = new int[16];		boolean emptyPattern = true;		for (int i = 0; i < reversedPattern.length; i++) {			int shortPattern = pattern[i];			if (shortPattern != 0) emptyPattern = false;			if ((shortPattern >>> 16) != 0)				System.out.println("Graphics bad: has " + Integer.toHexString(shortPattern) + " pattern line");			for (int j = 0; j < 16; j++) {				if ((shortPattern & (1 << (15 - j))) != 0)					reversedPattern[i] |= 0x10001 << j;			}		}		// if the pattern is empty and has no outline, it cannot be seen		if (emptyPattern && patternOutline == Outline.NOPAT)		{			if (displayPatterned || printPatterned)			{				String msg = "Warning: layer ";				if (layer != null)				{					msg += layer.getName();					if (layer.getTechnology() != null) msg += " in technology " + layer.getTechnology().getTechName();				}				msg += " has an empty pattern.  Outlining it.";				System.out.println(msg);				patternOutline = Outline.PAT_S;			}		}	}	/**	 * Method to get the opacity of this EGraphics.	 * Opacity runs from 0 (transparent) to 1 (opaque).	 * @return the opacity of this EGraphics.	 */	public double getOpacity() { return opacity; }	/**	 * Method to return the opacity by factory default.	 * Opacity runs from 0 (transparent) to 1 (opaque).	 * @return the opacity by factory default.	 */	public double getFactoryOpacity()	{		if (layer == null) return 0;		Pref pref = opacityMap.get(layer);		return pref.getDoubleFactoryValue();	}    /**     * Method to check range of opacity provided.     * If < 0, reset it to zero.     * If > 1, reset it to one.     * @param opacity     * @return     */    private static double validateOpacity(double opacity)    {        if (opacity < 0)        {            System.out.println("Opacity " + opacity + " smaller than 0. Resetting to 0");            return 0;        }        else if (opacity > 1)        {            System.out.println("Opacity " + opacity + " bigger than 1. Resetting to 1");            return 1;        }        return opacity;    }    /**	 * Method to set the opacity of this EGraphics.	 * Opacity runs from 0 (transparent) to 1 (opaque).	 * @param opacity the opacity of this EGraphics.	 */	public void setOpacity(double opacity)	{        this.opacity = validateOpacity(opacity);		if (layer != null)		{			Pref pref = opacityMap.get(layer);			if (pref != null) pref.setDouble(this.opacity);		}	}	/**	 * 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.	 * @return the whether this EGraphics should be drawn in the foreground.	 */	public boolean getForeground() { return foreground; }	/**	 * 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.	 * @param f true if this EGraphics should be drawn in the foreground.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -