public class PixelTools
extends java.lang.Object
Constructor and Description |
---|
PixelTools() |
Modifier and Type | Method and Description |
---|---|
static int |
alpha(int pixel)
Returns the alpha component of a pixel as a value between 0 and 255.
|
static boolean |
approx(java.awt.Color color,
int tolerance,
Pixel[] pixels)
Returns true if the colors of all pixels in the array are within the given tolerance
compared to the referenced color
|
static int |
argb(int a,
int r,
int g,
int b)
Returns an encoded argb int from the given components.
|
static int |
blue(int pixel)
Returns the blue component of a pixel as a value between 0 and 255.
|
static boolean |
colorMatches(java.awt.Color color,
int tolerance,
Pixel[] pixels)
Returns true if the colors of all pixels in the array are within the given tolerance
compared to the referenced color
|
static int |
coordsToOffset(int x,
int y,
int w) |
static int |
gray(int pixel)
Returns the gray value of a pixel as a value between 0 and 255.
|
static int |
green(int pixel)
Returns the green component of a pixel as a value between 0 and 255.
|
static java.awt.Point |
offsetToPoint(int offset,
int width)
Given a width and an offset returns the coordinate for that offset.
|
static int |
pointToOffset(java.awt.Point point,
int w) |
static int |
red(int pixel)
Returns the red component of a pixel as a value between 0 and 255.
|
static Pixel |
replaceTransparencyWithColor(Pixel p,
java.awt.Color color)
Returns a new Pixel with the transparency in the given pixel replaced by the given color.
|
static int |
rgb(int r,
int g,
int b)
Returns an encoded rgb int, with alpha 255, from the given components.
|
static int |
scale(java.lang.Double factor,
int pixel)
Scales the brightness of a pixel.
|
static int |
truncate(java.lang.Double value) |
static boolean |
uniform(java.awt.Color color,
Pixel[] pixels)
Returns true if all pixels in the array have the same color
|
public static int rgb(int r, int g, int b)
public static int argb(int a, int r, int g, int b)
public static int alpha(int pixel)
public static int red(int pixel)
public static int green(int pixel)
public static int blue(int pixel)
public static int gray(int pixel)
public static int truncate(java.lang.Double value)
public static boolean uniform(java.awt.Color color, Pixel[] pixels)
public static int scale(java.lang.Double factor, int pixel)
public static boolean approx(java.awt.Color color, int tolerance, Pixel[] pixels)
public static boolean colorMatches(java.awt.Color color, int tolerance, Pixel[] pixels)
public static int pointToOffset(java.awt.Point point, int w)
public static int coordsToOffset(int x, int y, int w)
public static java.awt.Point offsetToPoint(int offset, int width)