All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.scravy.jazz.Colors Maven / Gradle / Ivy

Go to download

An easy drawing library for Java using Swing for drawing (therefor Jazz).

The newest version!
// Generated by delombok at Tue May 26 01:14:02 CEST 2015
package de.scravy.jazz;

/**
 * Static utility methods to deal with colors.
 *
 * @author Julian Fleischer
 * @since 1.0.0
 */
public final class Colors {

  public static Color fromRGB(final int r, final int g, final int b) {
    return new RgbColor(r, g, b);
  }

  public static Color fromRGB(final int r, final int g, final int b, final int alpha) {
    return new RgbColor(r, g, b, alpha);
  }

  public static Color fromHSV(final int h, final int s, final int v) {
    return new HsvColor(h, s, v);
  }

  public static Color randomColor() {
    return new RgbColor(Jazz.randomInt(256), Jazz.randomInt(256), Jazz.randomInt(256));
  }

  public static Color randomColor(final int r, final int g, final int b) {
    return new RgbColor(r >= 0 && r < 256 ? r : Jazz.randomInt(256), g >= 0 && g < 256 ? g : Jazz.randomInt(256), b >= 0 && b < 256 ? b : Jazz.randomInt(256));
  }

  public static Color randomColor(final int minR, final int maxR, final int minG, final int maxG, final int minB, final int maxB) {
    return new RgbColor(Jazz.randomInt(minR, maxR), Jazz.randomInt(minG, maxG), Jazz.randomInt(minB, maxB));
  }

  public static Color randomColor(final int gray) {
    return randomColor(gray, gray, gray);
  }

  public static Color randomColor(final int minGray, final int maxGray) {
    return randomColor(Jazz.randomInt(minGray, maxGray));
  }

  @SuppressWarnings("all")
  @javax.annotation.Generated("lombok")
  private Colors() {
    throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy