/** * Gets the alpha value (transparency) for this group. * * @return double between 0 and 1 */ @Override public double getAlpha() { return getAttributes().getAlpha(); }
/** * Gets the alpha value for this shape. * * @return double */ @Override public double getAlpha() { return getAttributes().getAlpha(); }
/** * Returns global alpha value. * * @return double */ public final double getGlobalAlpha() { double alpha = 1; Node<?> node = this; while (null != node) { Attributes attr = node.getAttributes(); if (attr.isDefined(Attribute.ALPHA)) { alpha = alpha * attr.getAlpha(); } node = node.getParent(); } return alpha; }
public Shape(ShapeType type, JSONObject node) { super(NodeType.SHAPE, node); m_type = type; final Attributes attr = getAttributes(); if (NativeInternalType.NUMBER != attr.typeOf(Attribute.X)) { setX(0); } if (NativeInternalType.NUMBER != attr.typeOf(Attribute.Y)) { setY(0); } if (NativeInternalType.NUMBER != attr.typeOf(Attribute.ALPHA)) { setAlpha(1); } else { attr.setAlpha(attr.getAlpha()); // normalizes alpha if out of range } if (NativeInternalType.BOOLEAN != attr.typeOf(Attribute.DRAGGABLE)) { setDraggable(false); } }
/** * Constructor. Creates an instance of a group. */ protected Group(JSONObject node) { super(NodeType.GROUP, node); final Attributes attr = getAttributes(); if (NativeInternalType.NUMBER != attr.typeOf(Attribute.X)) { setX(0); } if (NativeInternalType.NUMBER != attr.typeOf(Attribute.Y)) { setY(0); } if (NativeInternalType.NUMBER != attr.typeOf(Attribute.ALPHA)) { setAlpha(1); } else { attr.setAlpha(attr.getAlpha()); // normalizes alpha if out of range } if (NativeInternalType.BOOLEAN != attr.typeOf(Attribute.DRAGGABLE)) { setDraggable(false); } }