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

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

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

Color.getBrightness介绍

暂无

代码示例

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

(int) (newColor.getHue()),
(int) (newColor.getSaturation() * 100),
(int) (newColor.getBrightness() * 100));

代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit

@Override
public float[] getTextureLocation(Color color)
{
 float x;
 if (hueResolution != -1)
   x = (float) (color.getHue() / 360.0);
 else if (saturationResolution != -1)
   x = (float) color.getSaturation();
 else
   x = (float) color.getBrightness();
 float y = 0.5f;
 return new float[] {x, y};
}

代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit

@Override
public float[] getTextureLocation(Color color)
{
 float x;
 if (hueResolution != -1)
   x = (float) (color.getHue() / 360.0);
 else if (saturationResolution != -1)
   x = (float) color.getSaturation();
 else
   x = (float) color.getBrightness();
 float y = 0.5f;
 return new float[] {x, y};
}

代码示例来源:origin: us.ihmc/ihmc-javafx-toolkit

@Override
public float[] getTextureLocation(Color color)
{
 float x = (float) (hueResolution != -1 ? color.getHue() / 360.0 : color.getSaturation());
 float y = (float) (brightnessResolution != -1 ? color.getBrightness() : color.getSaturation());
 return new float[] {x, y};
}

代码示例来源:origin: us.ihmc/IHMCJavaFXToolkit

@Override
public float[] getTextureLocation(Color color)
{
 float x = (float) (hueResolution != -1 ? color.getHue() / 360.0 : color.getSaturation());
 float y = (float) (brightnessResolution != -1 ? color.getBrightness() : color.getSaturation());
 return new float[] {x, y};
}

代码示例来源:origin: edu.utah.bmi.nlp/nlp-core

public static int[] getRandomBeautifulColors() {
    String colorString=Integer.toHexString((int)Math.floor(Math.random()*16777215));
    if(colorString.length()==5) {
      colorString = "0" + colorString;
//            System.out.println(colorString);
    }

    Color color =  Color.valueOf(colorString);
    if(color.getSaturation()>0.78){
      color=Color.hsb(color.getHue(),0.78,color.getBrightness());
    }
    if(color.getBrightness()<0.43){
      color=Color.hsb(color.getHue(),color.getSaturation(),0.43);
    }
//        System.out.println(color.getRed());
//        System.out.println(color.getGreen());
//        System.out.println(color.getBlue());

    int red = (int) (color.getRed() * 255);
    int green = (int) (color.getGreen() * 255);
    int blue = (int) (color.getBlue() * 255);
    return new int[]{red, green, blue};
  }

代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers

private Node createConcaveHullGraphics(PlanarRegion data)
{
 int regionId = data.getRegionId();
 JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(16));
 RigidBodyTransform transform = new RigidBodyTransform();
 data.getTransformToWorld(transform);
 Point2D[] concaveHullVerticesLocal = data.getConcaveHull();
 Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
 List<Point3D> concaveHullVertices = Arrays.stream(concaveHullVerticesLocal).map(Point3D::new).map(p -> {
   transform.transform(p);
   return p;
 }).collect(Collectors.toList());
 for (int vertexIndex = 0; vertexIndex < concaveHullVertices.size(); vertexIndex++)
 {
   Point3D vertex = concaveHullVertices.get(vertexIndex);
   Point3D nextVertex = ListWrappingIndexTools.getNext(vertexIndex, concaveHullVertices);
   Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), regionColor.getBrightness());
   meshBuilder.addLine(vertex, nextVertex, 0.0015, lineColor);
 }
 MeshView meshView = new MeshView(meshBuilder.generateMesh());
 meshView.setMaterial(meshBuilder.generateMaterial());
 meshView.setMouseTransparent(true);
 return meshView;
}

代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers

private Node createPriorityQueueGraphics(PlanarRegionSegmentationRawData rawData, ConcaveHullFactoryResult concaveHullFactoryResult)
{
 JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(512));
 Point3D planeOrigin = rawData.getOrigin();
 Quaternion planeOrientation = rawData.getOrientation();
 Color regionColor = OcTreeMeshBuilder.getRegionColor(rawData.getRegionId());
 for (ConcaveHullVariables intermediateVariables : concaveHullFactoryResult.getIntermediateVariables())
 {
   PriorityQueue<Pair<QuadEdge, QuadEdgeTriangle>> queue = intermediateVariables.getSortedByLengthQueue();
   for (Pair<QuadEdge, QuadEdgeTriangle> edgeAndTriangle : queue)
   {
    QuadEdge edge = edgeAndTriangle.getLeft();
    Point3D dest = PolygonizerTools.toPointInWorld(edge.dest().getX(), edge.dest().getY(), planeOrigin, planeOrientation);
    Point3D orig = PolygonizerTools.toPointInWorld(edge.orig().getX(), edge.orig().getY(), planeOrigin, planeOrientation);
    boolean isEdgeTooLong = dest.distance(orig) > parameters.getEdgeLengthThreshold();
    Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
    meshBuilder.addLine(dest, orig, 0.0015, lineColor);
    QuadEdgeTriangle triangle = edgeAndTriangle.getRight();
    List<Point2D> triangleVerticesLocal = Arrays.stream(triangle.getVertices()).map(v -> new Point2D(v.getX(), v.getY())).collect(Collectors.toList());
    List<Point3D> triangleVerticesWorld = PolygonizerTools.toPointsInWorld(triangleVerticesLocal, planeOrigin, planeOrientation);
    double hue = 360.0 * random.nextDouble();
    double saturation = 0.8 * random.nextDouble() + 0.1;
    double brightness = 0.9;
    meshBuilder.addPolyon(triangleVerticesWorld, Color.hsb(hue, saturation, brightness));
   }
 }
 MeshView trianglesMeshView = new MeshView(meshBuilder.generateMesh());
 trianglesMeshView.setMaterial(meshBuilder.generateMaterial());
 return trianglesMeshView;
}

代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers

Point3D nextVertex = ListWrappingIndexTools.getNext(vertexIndex, concaveHullVertices);
boolean isEdgeTooLong = vertex.distance(nextVertex) > parameters.getEdgeLengthThreshold();
Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
meshBuilder.addLine(vertex, nextVertex, 0.0015, lineColor);

代码示例来源:origin: us.ihmc/robot-environment-awareness-visualizers

private Node createBorderEdgesGraphics(PlanarRegionSegmentationRawData rawData, ConcaveHullFactoryResult concaveHullFactoryResult)
{
 int regionId = rawData.getRegionId();
 JavaFXMultiColorMeshBuilder meshBuilder = new JavaFXMultiColorMeshBuilder(new TextureColorAdaptivePalette(16));
 Point3D planeOrigin = rawData.getOrigin();
 Quaternion planeOrientation = rawData.getOrientation();
 Color regionColor = OcTreeMeshBuilder.getRegionColor(regionId);
 for (ConcaveHullVariables intermediateVariables : concaveHullFactoryResult.getIntermediateVariables())
 {
   Set<QuadEdge> borderEdges = intermediateVariables.getBorderEdges();
   for (QuadEdge edge : borderEdges)
   {
    Point3D dest = PolygonizerTools.toPointInWorld(edge.dest().getX(), edge.dest().getY(), planeOrigin, planeOrientation);
    Point3D orig = PolygonizerTools.toPointInWorld(edge.orig().getX(), edge.orig().getY(), planeOrigin, planeOrientation);
    boolean isEdgeTooLong = dest.distance(orig) > parameters.getEdgeLengthThreshold();
    Color lineColor = Color.hsb(regionColor.getHue(), regionColor.getSaturation(), isEdgeTooLong ? 0.25 : regionColor.getBrightness());
    meshBuilder.addLine(dest, orig, 0.0015, lineColor);
   }
 }
 MeshView meshView = new MeshView(meshBuilder.generateMesh());
 meshView.setMaterial(meshBuilder.generateMaterial());
 meshView.setMouseTransparent(true);
 return meshView;
}

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

(int) (newColor.getHue()),
(int) (newColor.getSaturation() * 100),
(int) (newColor.getBrightness() * 100));

相关文章