java.lang.Object
io.github.shimeoki.jfx.rasterization.Colorf

public final class Colorf extends Object
Simple color class with float values.

Uses 4 (RGBA) color channels as floats to store the color.

Since:
2.0.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Colorf(float r, float g, float b, float a)
    Creates a new Colorf instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    float
    Gets this color's alpha channel.
    float
    Gets this color's blue channel.
    float
    Gets this color's green channel.
    javafx.scene.paint.Color
    Gets a Color representing this color.
    float
    red()
    Gets this color's red channel.
    float
    Gets this color's transparency channel.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Colorf

      public Colorf(float r, float g, float b, float a)
      Creates a new Colorf instance.

      Uses Floats.confined(0, v, 1) to write the values.

      Parameters:
      r - red color channel float value
      g - green color channel float value
      b - blue color channel float value
      a - alpha color channel float value
      Since:
      2.0.0
      See Also:
  • Method Details

    • red

      public float red()
      Gets this color's red channel.
      Returns:
      red color channel float value in range from 0.0 to 1.0
      Since:
      2.0.0
    • green

      public float green()
      Gets this color's green channel.
      Returns:
      green color channel float value in range from 0.0 to 1.0
      Since:
      2.0.0
    • blue

      public float blue()
      Gets this color's blue channel.
      Returns:
      blue color channel float value in range from 0.0 to 1.0
      Since:
      2.0.0
    • alpha

      public float alpha()
      Gets this color's alpha channel.

      Equivalent to:

      
       1 - transparency()
       
      Returns:
      alpha color channel float value in range from 0.0 to 1.0
      Since:
      2.0.0
      See Also:
    • transparency

      public float transparency()
      Gets this color's transparency channel.

      Equivalent to:

      
       1 - alpha()
       
      Returns:
      transparency color channel float value in range from 0.0 to 1.0
      Since:
      2.0.0
      See Also:
    • jfxColor

      public javafx.scene.paint.Color jfxColor()
      Gets a Color representing this color.

      Creates a new instance everytime.

      Returns:
      JavaFX's Color class with equivalent color channels
      Since:
      2.0.0
      See Also:
      • Color