Search in sources :

Example 21 with Attribute

use of com.cburch.logisim.data.Attribute in project logisim-evolution by reds-heig.

the class AbstractCanvasObject method setForStroke.

protected boolean setForStroke(Graphics g) {
    List<Attribute<?>> attrs = getAttributes();
    if (attrs.contains(DrawAttr.PAINT_TYPE)) {
        Object value = getValue(DrawAttr.PAINT_TYPE);
        if (value == DrawAttr.PAINT_FILL)
            return false;
    }
    Integer width = getValue(DrawAttr.STROKE_WIDTH);
    if (width != null && width.intValue() > 0) {
        Color color = getValue(DrawAttr.STROKE_COLOR);
        if (color != null && color.getAlpha() == 0) {
            return false;
        } else {
            GraphicsUtil.switchToWidth(g, width.intValue());
            if (color != null)
                g.setColor(color);
            return true;
        }
    } else {
        return false;
    }
}
Also used : Attribute(com.cburch.logisim.data.Attribute) Color(java.awt.Color)

Aggregations

Attribute (com.cburch.logisim.data.Attribute)21 AttributeSet (com.cburch.logisim.data.AttributeSet)12 AbstractCanvasObject (com.cburch.draw.model.AbstractCanvasObject)5 CanvasObject (com.cburch.draw.model.CanvasObject)4 Map (java.util.Map)4 Component (com.cburch.logisim.comp.Component)3 ComponentFactory (com.cburch.logisim.comp.ComponentFactory)3 Direction (com.cburch.logisim.data.Direction)3 HashMap (java.util.HashMap)3 AbstractAttributeSet (com.cburch.logisim.data.AbstractAttributeSet)2 Color (java.awt.Color)2 LogisimVersion (com.cburch.logisim.LogisimVersion)1 ReplacementMap (com.cburch.logisim.circuit.ReplacementMap)1 EndData (com.cburch.logisim.comp.EndData)1 AttributeEvent (com.cburch.logisim.data.AttributeEvent)1 AttributeListener (com.cburch.logisim.data.AttributeListener)1 BitWidth (com.cburch.logisim.data.BitWidth)1 Selection (com.cburch.logisim.gui.main.Selection)1 ToolAttributeAction (com.cburch.logisim.gui.main.ToolAttributeAction)1 Action (com.cburch.logisim.proj.Action)1