Java Utililty Methods Integer Clip

List of utility methods to do Integer Clip

Description

The list of methods to do Integer Clip are organized into topic(s).

Method

intclip(final int value)
Clip a value for compare
if (value <= -1) {
    return -1;
if (value >= 1) {
    return 1;
return 0;
intclip(int a, int min, int max)
clip
return a < min ? min : (a > max ? max : a);
intclip(int lower, int upper, int x)
Clips a value within a range.
return Math.min(Math.max(x, lower), upper);
intclip(int val, int from, int to)
clip
return val < from ? from : (val > to ? to : val);
intclip(int val, int from, int to)
clip
return val < from ? from : (val > to ? to : val);
intclip(int x)
clip
if (x < 0)
    return 0;
if (x > 255)
    return 255;
return x;
voidclip(int[][][] data, int startX, int startY, int stopX, int stopY)
This method clips the values of the pixel so that they are in the range 0-255
for (int y = startY; y < stopY; y++) {
    for (int x = startX; x < stopX; x++) {
        data[y][x][1] = clip(data[y][x][1]);
        data[y][x][2] = clip(data[y][x][2]);
        data[y][x][3] = clip(data[y][x][3]);
intclipColor(final int compIn, final boolean allowRGB555)
clip Color
final int compOut;
if (5 < compIn || !allowRGB555) {
    compOut = 8;
} else {
    compOut = 5;
return compOut;
voidclipHistogram(final int[] hist, final int[] clippedHist, final int limit)
Clip histogram and redistribute clipped entries.
System.arraycopy(hist, 0, clippedHist, 0, hist.length);
int clippedEntries = 0, clippedEntriesBefore;
do {
    clippedEntriesBefore = clippedEntries;
    clippedEntries = 0;
    for (int i = 0; i < hist.length; ++i) {
        final int d = clippedHist[i] - limit;
        if (d > 0) {
...
intclipInt(int value, int max)
clip Int
return clipInt(value, 0, max);