object Color
This companion object of class Color
provides methods for creating new Color
objects.
There is also a small selection of related utility methods and constants.
For many constants of type Color that represent different preset colors, see o1.gui.colors.
This object has an alias in the top-level package o1, so it’s accessible to students simply
via import o1._
.
- Alphabetic
- By Inheritance
- Color
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val Max: Int
The maximum value of a Color’s RGB and opacity components.
The maximum value of a Color’s RGB and opacity components. (They range between 0 and 255, so this equals 255.
- val Min: Int
The minimum value of a Color’s RGB and opacity components.
The minimum value of a Color’s RGB and opacity components. (They range between 0 and 255, so this equals zero.
- def apply(red: Double, green: Double, blue: Double, opacity: Double): Color
Creates a new Color with the given RGB components and opacity.
Creates a new Color with the given RGB components and opacity.
- red
the amount of red in the color; values outside the 0--255 range are clamped to fit it
- green
the amount of green in the color; values outside the 0--255 range are clamped to fit it
- blue
the amount of blue in the color; values outside the 0--255 range are clamped to fit it
- opacity
the opacity of the color; values outside the 0--255 range are clamped to fit it
- returns
the color
- def apply(red: Double, green: Double, blue: Double): Color
Creates a new fully opaque Color with the given RGB components.
Creates a new fully opaque Color with the given RGB components.
- red
the amount of red in the color; values outside the 0--255 range are clamped to fit it
- green
the amount of green in the color; values outside the 0--255 range are clamped to fit it
- blue
the amount of blue in the color; values outside the 0--255 range are clamped to fit it
- returns
the color
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def fromHSI(hue: Double, saturation: Double, value: Double, opacity: Double = Max): Color
Creates a Color specified in terms of the HSI (hue--saturation--intensity) color scheme.
Creates a Color specified in terms of the HSI (hue--saturation--intensity) color scheme.
- hue
the hue (“main observable color”) component of color, in degrees around the color wheel (0--360)
- saturation
the saturation (“richness”) component of the color; values outside the 0--255 range are clamped to fit it
- value
the intensity (“brightness”) component of the color; values outside the 0--255 range are clamped to fit it
- returns
the color (represented internally as RGB nonetheless)
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString: String
- Definition Classes
- AnyRef → Any
- def unapply(color: Color): Option[(Int, Int, Int, Int)]
This method deconstructs a Color to its components and returns them as a tuple.
This method deconstructs a Color to its components and returns them as a tuple. Its presence here in the companion object enables us to write things like:
myColor match { case Color(r, g, b, 255) => "opaque color: " + r + "," + g + "," + b case Color(r, _, _, _) if r > 200 => "high in red" case _ => "other color" }
- color
any Color
- returns
a
Some
that contains a tuple with all the RGB components of the given color and its opacity
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.