javafx.scene.paint.Color.getOpacity()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(243)

本文整理了Java中javafx.scene.paint.Color.getOpacity()方法的一些代码示例,展示了Color.getOpacity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Color.getOpacity()方法的具体详情如下:
包路径:javafx.scene.paint.Color
类名称:Color
方法名:getOpacity

Color.getOpacity介绍

暂无

代码示例

代码示例来源:origin: jfoenixadmin/JFoenix

/**
   * {@inheritDoc}
   */
  @Override
  protected void interpolate(double frac) {
    if (start == null) {
      starting();
    }
    Color newColor = start.interpolate(end, frac);
    if (Color.TRANSPARENT.equals(start)) {
      newColor = new Color(end.getRed(), end.getGreen(), end.getBlue(), newColor.getOpacity());
    }
    region.get().setBackground(new Background(new BackgroundFill(newColor, radii, insets)));
  }
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

private static int alpha(Color color) {
  return toIntColor(color.getOpacity());
}

代码示例来源:origin: com.aquafx-project/aquafx

private String colorToRGBA(Color color) {
  // Older version didn't care about opacity
  // return String.format((Locale) null, "#%02x%02x%02x",
  // Math.round(color.getRed() * 255),
  // Math.round(color.getGreen() * 255),
  // Math.round(color.getBlue() * 255));
  return String.format((Locale) null, "rgba(%d, %d, %d, %f)", (int) Math.round(color.getRed() * 255),
      (int) Math.round(color.getGreen() * 255), (int) Math.round(color.getBlue() * 255), color.getOpacity());
}

代码示例来源:origin: org.fxmisc.richtext/richtextfx

@Override
public void encode(DataOutputStream os, Color c)
    throws IOException {
  os.writeDouble(c.getRed());
  os.writeDouble(c.getGreen());
  os.writeDouble(c.getBlue());
  os.writeDouble(c.getOpacity());
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

public static String toCssColor(Color color) {
    return "rgba(" +
        Math.round(255 * color.getRed()) + "," +
        Math.round(255 * color.getGreen()) + "," +
        Math.round(255 * color.getBlue()) + "," +
        color.getOpacity() +
        ")";
  }
}

代码示例来源:origin: com.cedarsoft.commons/javafx

@Nonnull
public static String toRGBA(@Nonnull Color color) {
 int r = (int) (color.getRed() * 255);
 int g = (int) (color.getGreen() * 255);
 int b = (int) (color.getBlue() * 255);
 return "rgb(" + r + ", " + g + ", " + b + ", " + color.getOpacity() + ")";
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

private String toCssColor(Color color) {
  return "rgba(" + Math.round(255 * color.getRed()) + "," + Math.round(255 * color.getGreen()) + "," + Math.round(255 * color.getBlue()) + "," + color.getOpacity() + ")";
}

代码示例来源:origin: com.bitplan.radolan/com.bitplan.radolan

/**
 * get the integer for the given color
 * 
 * @param c
 * @return the color integer
 */
public static int getIntFromColor(Color c) {
 int R = (int) Math.round(255 * c.getRed());
 int G = (int) Math.round(255 * c.getGreen());
 int B = (int) Math.round(255 * c.getBlue());
 int A = (int) Math.round(255 * c.getOpacity());
 A = (A << 24) & 0xFF000000;
 R = (R << 16) & 0x00FF0000;
 G = (G << 8) & 0x0000FF00;
 B = B & 0x000000FF;
 return A | R | G | B;
}

代码示例来源:origin: us.ihmc/ihmc-graphics-description

public static java.awt.Color jfxToAwt(javafx.scene.paint.Color jfxColor)
{
 return new java.awt.Color((float) jfxColor.getRed(), (float) jfxColor.getGreen(), (float) jfxColor.getBlue(), (float) jfxColor.getOpacity());
}

代码示例来源:origin: com.github.peterbecker/configuration-parser

/**
 * Method to decode an AWT color encoded the JavaFX/web way.
 * <p/>
 * AWT has Color::decode, but that needs a full three byte integer value. JavaFX allows all CSS variants, including
 * names.
 */
private static Color decodeAwtColor(String s) {
  javafx.scene.paint.Color color = javafx.scene.paint.Color.valueOf(s);
  return new Color((float) color.getRed(), (float) color.getGreen(), (float) color.getBlue(), (float) color.getOpacity());
}

代码示例来源:origin: org.copper-engine/copper-monitoring-client

private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeObject(idRegEx.getValue());
  out.writeObject(occurrenceRegEx.getValue());
  out.writeObject(conversationIdRegEx.getValue());
  out.writeObject(loglevelRegEx.getValue());
  out.writeObject(contextRegEx.getValue());
  out.writeObject(workflowInstanceIdRegEx.getValue());
  out.writeObject(correlationIdRegEx.getValue());
  out.writeObject(transactionIdRegEx.getValue());
  out.writeObject(messageTypeRegEx.getValue());
  out.writeDouble(color.getValue().getRed());
  out.writeDouble(color.getValue().getGreen());
  out.writeDouble(color.getValue().getBlue());
  out.writeDouble(color.getValue().getOpacity());
}

代码示例来源:origin: com.guigarage/imaging

@Override
  public int[] filter(int imageWidth, int imageHeigth, int[] inPixels) {
    int[] filteredPixels = new int[inPixels.length];

    for(int index = 0; index < inPixels.length; index++) {
      int argb = inPixels[index];
      int a = (argb >> 24) & 0xff;
      int r = (argb >> 16) & 0xff;
      int g = (argb >> 8) & 0xff;
      int b = argb & 0xff;
      Color c = Color.rgb(r, g, b, a / 255.0);
      c = c.invert();
      filteredPixels[index] = ((int)(c.getOpacity() *  255.0) << 24) | ((int)(c.getRed() *  255.0) << 16) | ((int)(c.getGreen() *  255.0) << 8) | (int)(c.getBlue() *  255.0);
    }
    return filteredPixels;
  }
}

代码示例来源:origin: com.jfoenix/jfoenix

/**
   * {@inheritDoc}
   */
  @Override
  protected void interpolate(double frac) {
    if (start == null) {
      starting();
    }
    Color newColor = start.interpolate(end, frac);
    if (Color.TRANSPARENT.equals(start)) {
      newColor = new Color(end.getRed(), end.getGreen(), end.getBlue(), newColor.getOpacity());
    }
    region.get().setBackground(new Background(new BackgroundFill(newColor, radii, insets)));
  }
}

相关文章