コード例 #1
0
  protected java.awt.Color modulateColorOpacity(java.awt.Color color, double opacity) {
    float[] compArray = new float[4];
    color.getRGBComponents(compArray);
    compArray[3] *= (float) opacity;

    return new java.awt.Color(compArray[0], compArray[1], compArray[2], compArray[3]);
  }
コード例 #2
0
  protected void applyColor(DrawContext dc, java.awt.Color color, double opacity) {
    if (dc.isPickingMode()) return;

    double finalOpacity = opacity * (color.getAlpha() / 255.0);
    GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.
    OGLUtil.applyColor(gl, color, finalOpacity, true);
  }
コード例 #3
0
 public static java.awt.Color getContrastingColor(java.awt.Color color) {
   float[] hsbvals = new float[3];
   java.awt.Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsbvals);
   java.awt.Color c = Color.getHSBColor(0, 0, (hsbvals[2] + 0.5f) % 1f);
   return new java.awt.Color(c.getRed(), c.getGreen(), c.getBlue(), color.getAlpha());
 }
コード例 #4
0
  protected void applyColor(DrawContext dc, java.awt.Color color, double opacity) {
    if (dc.isPickingMode()) return;

    double finalOpacity = opacity * (color.getAlpha() / 255.0);
    OGLUtil.applyColor(dc.getGL(), color, finalOpacity, true);
  }