public void setTintAlpha(final float alpha) { if (_tint == null) { _tint = new ColorRGBA(1.0f, 1.0f, 1.0f, alpha); } else { _tint.setAlpha(alpha); } } }
public void setTintAlpha(final float alpha) { if (_tint == null) { _tint = new ColorRGBA(1.0f, 1.0f, 1.0f, alpha); } else { _tint.setAlpha(alpha); } } }
public void actionPerformed(final ActionEvent e) { _sColorPanel.setEnabled(colorCheck.isSelected()); alphaLabel.setEnabled(colorCheck.isSelected()); colorLabel.setEnabled(colorCheck.isSelected()); _alphaSpinner.setEnabled(colorCheck.isSelected()); final ColorRGBA color = AwtColorUtil.makeColorRGBA(_sColorPanel.getBackground()); color.setAlpha(((Number) _alphaSpinner.getValue()).intValue() / 255f); entry.setColor(colorCheck.isSelected() ? color : RampEntry.DEFAULT_COLOR); } });
/** * Updates the values of the given color from the specified buffer at the index provided. * * @param store * the color to set data on * @param buf * the buffer to read from * @param index * the position (in terms of colors, not floats) to read from the buf */ public static void populateFromBuffer(final ColorRGBA store, final FloatBuffer buf, final int index) { store.setRed(buf.get(index * 4)); store.setGreen(buf.get(index * 4 + 1)); store.setBlue(buf.get(index * 4 + 2)); store.setAlpha(buf.get(index * 4 + 3)); }
/** * Updates the values of the given color from the specified buffer at the index provided. * * @param store * the color to set data on * @param buf * the buffer to read from * @param index * the position (in terms of colors, not floats) to read from the buf */ public static void populateFromBuffer(final ColorRGBA store, final FloatBuffer buf, final int index) { store.setRed(buf.get(index * 4)); store.setGreen(buf.get(index * 4 + 1)); store.setBlue(buf.get(index * 4 + 2)); store.setAlpha(buf.get(index * 4 + 3)); }
public void actionPerformed(final ActionEvent e) { final Color color = _colorChooser.getColor(); if (color == null) { return; } final ColorRGBA rgba = AwtColorUtil.makeColorRGBA(color); rgba.setAlpha((Integer.parseInt(_alphaSpinner.getValue().toString()) / 255f)); entry.setColor(rgba); _sColorPanel.setBackground(color); _colorHex.setText(convColorToHex(_sColorPanel.getBackground())); _colorChooserDialog.setVisible(false); } });
@Override public void mouseClicked(final MouseEvent e) { final Color picked = JColorChooser.showDialog(RGBAChooserPanel.this, "Pick a color", _rgbPanel.getBackground()); if (picked == null) { return; } _rgbPanel.setBackground(picked); final ColorRGBA color = AwtColorUtil.makeColorRGBA(picked); color.setAlpha(((Integer) _alphaSpinner.getValue()) / 255f); setColor(color); } });
public void stateChanged(final ChangeEvent e) { final ColorRGBA color = new ColorRGBA(entry.getColor()); color.setAlpha(((Number) _alphaSpinner.getValue()).intValue() / 255f); entry.setColor(color); } });
public void stateChanged(final ChangeEvent e) { final ColorRGBA color = AwtColorUtil.makeColorRGBA(_rgbPanel.getBackground()); color.setAlpha(snm.getNumber().floatValue() / 255f); setColor(color); } });
@Override public void read(final InputCapsule capsule) throws IOException { setRed(capsule.readFloat("r", 1)); setGreen(capsule.readFloat("g", 1)); setBlue(capsule.readFloat("b", 1)); setAlpha(capsule.readFloat("a", 1)); }
@Override public void read(final InputCapsule capsule) throws IOException { setRed(capsule.readFloat("r", 1)); setGreen(capsule.readFloat("g", 1)); setBlue(capsule.readFloat("b", 1)); setAlpha(capsule.readFloat("a", 1)); }
/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setRed(in.readFloat()); setGreen(in.readFloat()); setBlue(in.readFloat()); setAlpha(in.readFloat()); }
/** * Used with serialization. Not to be called manually. * * @param in * ObjectInput * @throws IOException * @throws ClassNotFoundException */ @Override public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException { setRed(in.readFloat()); setGreen(in.readFloat()); setBlue(in.readFloat()); setAlpha(in.readFloat()); }
/** * Set transparency based on distance from camera to text. if (distance < range.x) then opaque, if (distance > * range.y) then transparent, else lerp */ protected void distanceAlphaFade(final ReadOnlyVector2 range, final double distance) { float alpha = 1; if (distance > range.getY()) { alpha = 0; } else if (distance > range.getX()) { final float a = (float) (distance - range.getX()); final float r = (float) (range.getY() - range.getX()); alpha = 1.0f - a / r; } _tempClr.set(_textClr); _tempClr.setAlpha(_textClr.getAlpha() * alpha); setDefaultColor(_tempClr); }
/** * Set transparency based on distance from camera to text. if (distance < range.x) then opaque, if (distance > * range.y) then transparent, else lerp */ protected void distanceAlphaFade(final ReadOnlyVector2 range, final double distance) { float alpha = 1; if (distance > range.getY()) { alpha = 0; } else if (distance > range.getX()) { final float a = (float) (distance - range.getX()); final float r = (float) (range.getY() - range.getX()); alpha = 1.0f - a / r; } _tempClr.set(_textClr); _tempClr.setAlpha(_textClr.getAlpha() * alpha); setDefaultColor(_tempClr); }
public void draw(final Renderer renderer, final ReadOnlyTransform xform) { if (getSelectionLength() == 0) { return; } // set our alpha final ColorRGBA color = ColorRGBA.fetchTempInstance(); color.set(_standin.getDefaultColor()).setAlpha(UIComponent.getCurrentOpacity()); _standin.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); // set our location _standin.setWorldTransform(xform); // draw _standin.render(renderer); }
public void draw(final Renderer renderer, final ReadOnlyTransform xform) { if (getSelectionLength() == 0) { return; } // set our alpha final ColorRGBA color = ColorRGBA.fetchTempInstance(); color.set(_standin.getDefaultColor()).setAlpha(UIComponent.getCurrentOpacity()); _standin.setDefaultColor(color); ColorRGBA.releaseTempInstance(color); // set our location _standin.setWorldTransform(xform); // draw _standin.render(renderer); }
/** * Performs a linear interpolation between this color and the given end color, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is * closer to 1, the result will be closer to the end value. The result is stored back in this color. * * @param endColor * @param scalar * @return this color for chaining * @throws NullPointerException * if endVec is null. */ public ColorRGBA lerpLocal(final ReadOnlyColorRGBA endColor, final float scalar) { setRed((1.0f - scalar) * getRed() + scalar * endColor.getRed()); setGreen((1.0f - scalar) * getGreen() + scalar * endColor.getGreen()); setBlue((1.0f - scalar) * getBlue() + scalar * endColor.getBlue()); setAlpha((1.0f - scalar) * getAlpha() + scalar * endColor.getAlpha()); return this; }
/** * Performs a linear interpolation between this color and the given end color, using the given scalar as a percent. * iow, if changeAmnt is closer to 0, the result will be closer to the current value of this color and if it is * closer to 1, the result will be closer to the end value. The result is stored back in this color. * * @param endColor * @param scalar * @return this color for chaining * @throws NullPointerException * if endVec is null. */ public ColorRGBA lerpLocal(final ReadOnlyColorRGBA endColor, final float scalar) { setRed((1.0f - scalar) * getRed() + scalar * endColor.getRed()); setGreen((1.0f - scalar) * getGreen() + scalar * endColor.getGreen()); setBlue((1.0f - scalar) * getBlue() + scalar * endColor.getBlue()); setAlpha((1.0f - scalar) * getAlpha() + scalar * endColor.getAlpha()); return this; }
/** * Performs a linear interpolation between the given begin and end colors, using the given scalar as a percent. iow, * if changeAmnt is closer to 0, the result will be closer to the begin value and if it is closer to 1, the result * will be closer to the end value. The result is stored back in this color. * * @param beginColor * @param endColor * @param changeAmnt * the scalar as a percent. * @return this color for chaining * @throws NullPointerException * if beginVec or endVec are null. */ public ColorRGBA lerpLocal(final ReadOnlyColorRGBA beginColor, final ReadOnlyColorRGBA endColor, final float scalar) { setRed((1.0f - scalar) * beginColor.getRed() + scalar * endColor.getRed()); setGreen((1.0f - scalar) * beginColor.getGreen() + scalar * endColor.getGreen()); setBlue((1.0f - scalar) * beginColor.getBlue() + scalar * endColor.getBlue()); setAlpha((1.0f - scalar) * beginColor.getAlpha() + scalar * endColor.getAlpha()); return this; }