Java examples for 2D Graphics:Color
Snaps the color value within the byte range (0-255)
//package com.java2s; public class Main { /**/*from w w w. j a v a2 s .c om*/ * Snaps the color value within the byte range (0-255) * @param rgbavalue The value to snap. * @return The snapped value. */ public static int colorSnap(int rgbavalue) { if (rgbavalue > 255) rgbavalue = 255; if (rgbavalue < 0) rgbavalue = 0; return rgbavalue; } }