| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static double | calculateBrightness(Color color)
Calculates a perceptual brightness for a color between 0.0 black and 1.0 while |
| public static float | clamp(float min, float value, float max)
Simple utility function which clamps the given value to be strictly between the min and max values. |
| public static int | clamp(int min, int value, int max)
Simple utility function which clamps the given value to be strictly between the min and max values. |
| public static double | clamp(double min, double value, double max)
Simple utility function which clamps the given value to be strictly between the min and max values. |
| public static long | clamp(long min, long value, long max)
Simple utility function which clamps the given value to be strictly between the min and max values. |
| public static int | clampMax(int value, int max)
Simple utility function which clamps the given value to be strictly under the max value. |
| public static double | clampMin(double value, double min)
Simple utility function which clamps the given value to be strictly above the min value. |
| public static boolean | |
| public static Color | convertLinearRGBtoSRGB(Color color)
Helper function to convert a color in linear RGB space to SRGB space. |
| public static Color | convertSRGBtoLinearRGB(Color color)
Helper function to convert a color in sRGB space to linear RGB space. |
| public static Color | deriveColor(Color
The color to derive from c, double The brightness difference for the new color -1.0 being 100% dark which is always black, 0.0 being
no change and 1.0 being 100% lighter which is always white brightness)Derives a lighter or darker of a given color. |
| private static Bounds | |
| private static HPos | |
| private static double | |
| private static double | |
| private static double | |
| private static double | |
| public static Screen | |
| public static Screen | |
| public static Screen | |
| private static VPos | |
| public static boolean | |
| public static double[] | |
| private static Color | interpolateLinear(double position, Color color1, Color color2)
interpolate at a set |
| public static boolean | |
| private static Color | |
| public static Color | |
| public static double | nearest(double less, double value, double more)
Utility function which returns either |
| public static Point2D | pointRelativeTo(Node parent, Node node, HPos hpos, VPos vpos, double dx, double dy, boolean reposition)
|
| public static Point2D | pointRelativeTo(Node parent, double anchorWidth, double anchorHeight, HPos hpos, VPos vpos, double dx, double dy, boolean reposition)
|
| public static Point2D | pointRelativeTo(Object parent, double width, double height, double screenX, double screenY, HPos hpos, VPos vpos)
This is the fallthrough function that most other functions fall into. |
| private static double | |
| private static double | |
| public static double[] | |
| public static String[] | |
| public static String | |
| public static double |
| Utils | back to summary |
|---|---|
| public Utils() | |
| calculateBrightness | back to summary |
|---|---|
| public static double calculateBrightness(Color color) Calculates a perceptual brightness for a color between 0.0 black and 1.0 while | |
| clamp | back to summary |
|---|---|
| public static float clamp(float min, float value, float max) Simple utility function which clamps the given value to be strictly between the min and max values. | |
| clamp | back to summary |
|---|---|
| public static int clamp(int min, int value, int max) Simple utility function which clamps the given value to be strictly between the min and max values. | |
| clamp | back to summary |
|---|---|
| public static double clamp(double min, double value, double max) Simple utility function which clamps the given value to be strictly between the min and max values. | |
| clamp | back to summary |
|---|---|
| public static long clamp(long min, long value, long max) Simple utility function which clamps the given value to be strictly between the min and max values. | |
| clampMax | back to summary |
|---|---|
| public static int clampMax(int value, int max) Simple utility function which clamps the given value to be strictly under the max value. | |
| clampMin | back to summary |
|---|---|
| public static double clampMin(double value, double min) Simple utility function which clamps the given value to be strictly above the min value. | |
| contains | back to summary |
|---|---|
| public static boolean contains(String src, String s) Because mobile doesn't have string.contains(s) function, this function was written. | |
| convertLinearRGBtoSRGB | back to summary |
|---|---|
| public static Color convertLinearRGBtoSRGB(Color color) Helper function to convert a color in linear RGB space to SRGB space. | |
| convertSRGBtoLinearRGB | back to summary |
|---|---|
| public static Color convertSRGBtoLinearRGB(Color color) Helper function to convert a color in sRGB space to linear RGB space. | |
| deriveColor | back to summary |
|---|---|
| public static Color deriveColor(Color c, double brightness) Derives a lighter or darker of a given color.
| |
| getBounds | back to summary |
|---|---|
| private static Bounds getBounds(Object obj) To facilitate multiple types of parent object, we unfortunately must allow for Objects to be passed in. This method handles determining the bounds of the given Object. If the Object type is not supported, a default Bounds will be returned. | |
| getHPosOpposite | back to summary |
|---|---|
| private static HPos getHPosOpposite(HPos hpos, VPos vpos) | |
| getIntersectionLength | back to summary |
|---|---|
| private static double getIntersectionLength(double a0, double a1, double b0, double b1) | |
| getIntersectionLengthImpl | back to summary |
|---|---|
| private static double getIntersectionLengthImpl(double v0, double v1, double v) | |
| getOuterDistance | back to summary |
|---|---|
| private static double getOuterDistance(double a0, double a1, double b0, double b1) | |
| getOuterDistance | back to summary |
|---|---|
| private static double getOuterDistance(double v0, double v1, double v) | |
| getScreen | back to summary |
|---|---|
| public static Screen getScreen(Object obj) This function attempts to determine the best screen given the parent object from which we are wanting to position another item relative to. This is particularly important when we want to keep items from going off screen, and for handling multiple monitor support. | |
| getScreenForPoint | back to summary |
|---|---|
| public static Screen getScreenForPoint(double x, double y) | |
| getScreenForRectangle | back to summary |
|---|---|
| public static Screen getScreenForRectangle(Rectangle2D rect) | |
| getVPosOpposite | back to summary |
|---|---|
| private static VPos getVPosOpposite(HPos hpos, VPos vpos) | |
| hasFullScreenStage | back to summary |
|---|---|
| public static boolean hasFullScreenStage(Screen screen) | |
| HSBtoRGB | back to summary |
|---|---|
| public static double[] HSBtoRGB(double hue, double saturation, double brightness) | |
| interpolateLinear | back to summary |
|---|---|
| private static Color interpolateLinear(double position, Color color1, Color color2) interpolate at a set | |
| isQVGAScreen | back to summary |
|---|---|
| public static boolean isQVGAScreen() | |
| ladder | back to summary |
|---|---|
| private static Color ladder(double position, Stop[] stops) Get the color at the give | |
| ladder | back to summary |
|---|---|
| public static Color ladder(Color color, Stop[] stops) Get the color at the give | |
| nearest | back to summary |
|---|---|
| public static double nearest(double less, double value, double more) Utility function which returns either | |
| pointRelativeTo | back to summary |
|---|---|
| public static Point2D pointRelativeTo(Node parent, Node node, HPos hpos, VPos vpos, double dx, double dy, boolean reposition) | |
| pointRelativeTo | back to summary |
|---|---|
| public static Point2D pointRelativeTo(Node parent, double anchorWidth, double anchorHeight, HPos hpos, VPos vpos, double dx, double dy, boolean reposition) | |
| pointRelativeTo | back to summary |
|---|---|
| public static Point2D pointRelativeTo(Object parent, double width, double height, double screenX, double screenY, HPos hpos, VPos vpos) This is the fallthrough function that most other functions fall into. It takes care specifically of the repositioning of the item such that it remains onscreen as best it can, given its unique qualities. As will all other functions, this one returns a Point2D that represents an x,y location that should safely position the item onscreen as best as possible.
Note that
Don't use the BASELINE vpos, it doesn't make sense and would produce a wrong result.
| |
| positionX | back to summary |
|---|---|
| private static double positionX(Bounds parentBounds, double width, HPos hpos) Utility function that returns the x-axis position that an object should be positioned at, given the parents screen bounds, the width of the object, and the required HPos. | |
| positionY | back to summary |
|---|---|
| private static double positionY(Bounds parentBounds, double height, VPos vpos) Utility function that returns the y-axis position that an object should be positioned at, given the parents screen bounds, the height of the object, and the required VPos. The BASELINE vpos doesn't make sense here, 0 is returned for it. | |
| RGBtoHSB | back to summary |
|---|---|
| public static double[] RGBtoHSB(double r, double g, double b) | |
| split | back to summary |
|---|---|
| public static String[] split(String str, String separator) Because mobile doesn't have string.split(s) function, this function was written. | |
| stripQuotes | back to summary |
|---|---|
| public static String stripQuotes(String str) Helper to remove leading and trailing quotes from a string. Works with single or double quotes. | |
| sum | back to summary |
|---|---|
| public static double sum(double[] values) helper function for calculating the sum of a series of numbers | |