List of usage examples for com.badlogic.gdx.graphics Color sub
public Color sub(Color color)
From source file:de.bioviz.svg.SVGManager.java
License:Open Source License
/** * Exports a drawableField to svg.//w w w .j a va 2 s . c o m * * @param field * The field to export * @return svg string representation of a field */ private List<Element> toSVG(final DrawableField field) { Point pos = getFieldPosInSVGCoords(field); int yCoord = pos.snd; int xCoord = pos.fst; DisplayValues vals = field.getDisplayValues(); Color fieldCol = vals.getColor(); if (field.isHovered()) { fieldCol.sub(Colors.HOVER_DIFF_COLOR); } String fieldID = SVGUtils.generateColoredID(vals.getTexture().toString(), fieldCol); List<Element> fieldElems = new ArrayList<>(); Element elem = doc.createElement("use"); elem.setAttribute("x", String.valueOf(xCoord)); elem.setAttribute("y", String.valueOf(yCoord)); elem.setAttribute("transform", "scale(" + SCALE_FACTOR + " " + SCALE_FACTOR + ")"); elem.setAttribute("xlink:href", "#" + fieldID); fieldElems.add(elem); if (assay.getDisplayOptions().getOption(BDisplayOptions.NetColorOnFields)) { fieldElems.addAll(createGradient(field)); } return fieldElems; }
From source file:de.bioviz.svg.SVGUtils.java
License:Open Source License
/** * Returns the color of the field in an unhovered state. * * @param field//from w ww . j av a 2 s . c o m * the field * @return the unhovered color */ public static Color getUnhoveredColor(final DrawableField field) { Color fieldCol = field.getColor().cpy(); if (field.isHovered()) { fieldCol = fieldCol.sub(Colors.HOVER_DIFF_COLOR); } return fieldCol; }
From source file:de.bioviz.ui.DrawableDroplet.java
License:Open Source License
/** * Computes the droplet's color.//ww w . ja v a 2 s.c o m * * @return The color used to display the droplet */ public Color getDisplayColor() { Color color = this.dropletColor.cpy(); Net net = droplet.getNet(); if (net != null && parentAssay.getDisplayOptions().getOption(BDisplayOptions.NetColorOnDroplets)) { color = net.getColor().buildGdxColor(); } Rectangle pos = droplet.getPositionAt(parentAssay.getCurrentTime()); if (pos != null) { Point p = pos.upperLeft(); // if the droplet is currently not present, make it 'invisible' by // making it totally transparent if (p == null) { color.sub(Color.BLACK).clamp(); } else { if (this.isHidden()) { color.a = 0.25f; } else { color.add(Color.BLACK).clamp(); } } } else { color.sub(Color.BLACK).clamp(); } return color; }